From 26b18a7699c443685a7ffb38f8c6843110389aa8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 30 九月 2026 16:17:25 +0800
Subject: [PATCH] feat(migration): 按 dev_新疆_新聚 重新对齐 basic/performance/inspect 三模块
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderRatesServiceImpl.java | 39
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleReceiptMapper.java | 26
basic-server/src/main/resources/mapper/StandardProductListMapper.xml | 13
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java | 177
inspect-server/src/main/resources/mapper/DataAnalysisMapper.xml | 315
inspect-server/src/main/java/com/ruoyi/inspect/dto/CopperInsOrderDto.java | 37
inspect-server/src/main/java/com/ruoyi/inspect/dto/WriteInspectionConditionDto.java | 69
inspect-server/src/main/java/com/ruoyi/inspect/service/SpotCheckQuarterItemService.java | 15
inspect-server/src/main/resources/static/inspection-report-template-v2.docx | 0
performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOriginalHoursServiceImpl.java | 12
performance-server/src/main/java/com/ruoyi/performance/pojo/AuxiliaryOutputWorkingHoursTemporary.java | 116
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java | 284
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/SpotCheckQuarterItemServiceImpl.java | 19
inspect-server/src/main/resources/mapper/InsOrderRatesMapper.xml | 35
basic-server/src/main/java/com/ruoyi/basic/pojo/Laboratory.java | 4
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderTemplateDeviceMapper.java | 16
performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryCorrectionHoursServiceImpl.java | 2
inspect-server/src/main/java/com/ruoyi/inspect/controller/ReportController.java | 32
inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckQuarterItemMapper.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/service/ReportService.java | 13
basic-server/src/main/java/com/ruoyi/basic/mapper/CertificationMapper.java | 2
inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseCell.java | 61
inspect-server/pom.xml | 50
basic-server/src/main/resources/mapper/StandardMethodMapper.xml | 53
performance-server/src/main/java/com/ruoyi/performance/controller/ShiftTimeController.java | 9
performance-server/src/main/java/com/ruoyi/performance/service/AuxiliaryOutputWorkingHoursTemporaryService.java | 25
performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOutputWorkingHoursTemporaryServiceImpl.java | 33
inspect-server/src/main/resources/mapper/InsUnqualifiedHandlerMapper.xml | 67
basic-server/src/main/java/com/ruoyi/basic/dto/SampleDto.java | 5
inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleVo.java | 10
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/WarehouseServiceImpl.java | 189
inspect-server/src/main/resources/mapper/InsSampleMapper.xml | 780 +
inspect-server/src/main/resources/mapper/SpotCheckQuarterItemMapper.xml | 4
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrder.java | 262
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductUserMapper.java | 18
inspect-server/src/main/java/com/ruoyi/inspect/util/UserUtils.java | 90
inspect-server/src/main/resources/mapper/IfsSplitOrderRecordMapper.xml | 43
inspect-server/src/main/resources/mapper/IfsPartPropsRecordMapper.xml | 34
basic-server/src/main/java/com/ruoyi/basic/service/StructureItemParameterService.java | 10
inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseShelfMapper.java | 18
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanDTO.java | 36
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsReportExport.java | 79
performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursTemporaryMapper.xml | 20
basic-server/src/main/java/com/ruoyi/basic/controller/ProductSupplierDensityController.java | 9
inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java | 367
inspect-server/src/main/resources/static/small-wg-report-template.docx | 0
performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursMapper.xml | 9
basic-server/src/main/java/com/ruoyi/basic/controller/StructureTestObjectPartController.java | 9
inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseHistory.java | 56
basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureItemParameterServiceImpl.java | 276
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsUnqualifiedHandlerController.java | 82
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleMapper.java | 137
performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursMapper.java | 11
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleServiceImpl.java | 33
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsSampleReceiptController.java | 58
inspect-server/src/main/java/com/ruoyi/inspect/vo/RawProductAnalysisVo.java | 23
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandlerFile.java | 79
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductResultMapper.java | 29
basic-server/src/main/java/com/ruoyi/basic/controller/CertificationController.java | 11
inspect-server/src/main/java/com/ruoyi/inspect/vo/TemplateConditionVo.java | 36
inspect-server/src/main/java/com/ruoyi/inspect/dto/SpotCheckQuarterDto.java | 22
inspect-server/src/main/java/com/ruoyi/inspect/controller/FinishProductSpotCheckController.java | 198
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFileService.java | 16
basic-server/src/main/java/com/ruoyi/basic/dto/UpdateStandardTreeNodeDto.java | 19
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderStateServiceImpl.java | 19
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductResult.java | 52
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java | 72
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsReportController.java | 205
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningDetailMapper.java | 16
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderStandardTemplateServiceImpl.java | 19
inspect-server/src/main/resources/mapper/InsOrderMapper.xml | 576 +
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTemplate.java | 7
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsProductDeviationWarningController.java | 63
inspect-server/src/main/java/com/ruoyi/inspect/controller/DataAnalysisController.java | 127
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTreeTemplateBinding.java | 37
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptQueryDto.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/dto/SpotCheckYearDto.java | 22
inspect-server/src/main/java/com/ruoyi/inspect/dto/RawMaterialStandardTreeDto.java | 35
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodAttachmentMapper.java | 7
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningDetailServiceImpl.java | 20
basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java | 37
inspect-server/src/main/resources/mapper/InsSampleReceiptMapper.xml | 108
inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYearItem.java | 84
inspect-server/src/main/resources/static/small-wg-detection-template.docx | 0
basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java | 142
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedRetestProduct.java | 148
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderTemplateServiceImpl.java | 93
performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml | 26
basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService.java | 15
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto.java | 28
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderTemplateService.java | 24
basic-server/src/main/java/com/ruoyi/basic/dto/TemplateInspectionItemDto.java | 12
performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursServiceImpl.java | 5
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFactoryVerifyItemService.java | 15
inspect-server/src/main/resources/mapper/SpotCheckYearMapper.xml | 19
basic-server/src/main/java/com/ruoyi/basic/pojo/Certification.java | 4
inspect-server/src/main/java/com/ruoyi/inspect/controller/InformationNotificationController.java | 55
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPrintingVo.java | 50
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java | 823
inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedHandlerService.java | 26
inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderService.java | 161
inspect-server/src/main/resources/mapper/InsOrderTemplateDeviceMapper.xml | 23
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursController.java | 11
ruoyi-framework/src/main/java/com/ruoyi/framework/exception/ErrorException.java | 9
basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml | 17
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarningDetail.java | 75
basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java | 11
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java | 1
performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml | 25
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsulatingDto.java | 20
performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java | 9
basic-server/src/main/java/com/ruoyi/basic/dto/TemplateBindingItemDto.java | 17
performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryOriginalHoursLookDto.java | 7
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOutputWorkingHoursController.java | 12
inspect-server/src/main/java/com/ruoyi/inspect/service/WarehouseService.java | 42
basic-server/src/main/java/com/ruoyi/basic/utils/StandardTreePath.java | 18
inspect-server/src/main/java/com/ruoyi/inspect/mapper/RawMaterialOrderTemplateMapper.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFile.java | 56
inspect-server/src/main/java/com/ruoyi/inspect/vo/IfsOrderVO.java | 80
performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java | 10
inspect-server/src/main/java/com/ruoyi/inspect/util/ReportSignaturePictureUtils.java | 41
basic-server/src/main/java/com/ruoyi/basic/dto/AddStandardTreeNodeDto.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProduct.java | 225
basic-server/src/main/java/com/ruoyi/basic/dto/StandardLibraryTreeRowDto.java | 30
inspect-server/src/main/java/com/ruoyi/inspect/mapper/DataAnalysisMapper.java | 74
inspect-server/src/main/resources/lib/license.xml | 13
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductBindingDto.java | 21
inspect-server/src/main/java/com/ruoyi/inspect/controller/IfsPartPropsRecordController.java | 34
inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckQuarterMapper.java | 39
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTemplateMapper.java | 12
basic-server/src/main/resources/mapper/StandardTemplateMapper.xml | 6
inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsStockQueryDTO.java | 65
inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveInsContextDto.java | 29
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodIndustryMapper.java | 7
ruoyi-system/src/main/resources/mapper/system/UserMapper.xml | 101
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedHandlerFileServiceImpl.java | 76
inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveTemplateContextDto.java | 14
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsReportMapper.java | 53
inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckYearMapper.java | 30
basic-server/src/main/java/com/ruoyi/basic/dto/StandardTreeTemplateBindingDto.java | 11
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarning.java | 66
basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java | 19
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderDeviceRecordMapper.java | 33
inspect-server/src/main/java/com/ruoyi/inspect/dto/DataAnalysisDto.java | 48
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFactoryVerifyItemServiceImpl.java | 19
inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsPartPropsRecordDTO.java | 13
inspect-server/src/main/java/com/ruoyi/inspect/dto/WarehouseCellAndSampleDto.java | 14
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptPageDto.java | 52
inspect-server/src/main/resources/mapper/InsOrderFileMapper.xml | 15
inspect-server/src/main/resources/mapper/InsProductDeviationWarningDetailMapper.xml | 23
performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryCorrectionHoursMapper.java | 2
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductList.java | 7
basic-server/src/main/java/com/ruoyi/basic/controller/ProductPartController.java | 9
inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseHistoryMapper.java | 25
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsReport.java | 138
inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYear.java | 67
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanTaskSwitchVo.java | 35
inspect-server/src/main/resources/static/detection-report-template.docx | 0
basic-server/src/main/resources/mapper/IfsInventoryQuantityMapper.xml | 24
performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryOutputWorkingHoursTemporaryDto.java | 20
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml | 7
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java | 303
inspect-server/src/main/java/com/ruoyi/inspect/vo/UnqualifiedHandlerVO.java | 155
basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityCheckDto.java | 2
basic-server/src/main/java/com/ruoyi/basic/service/impl/CapacityScopeServiceImpl.java | 14
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java | 21
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryCorrectionHoursController.java | 2
basic-server/src/main/java/com/ruoyi/basic/mapper/IfsInventoryQuantityMapper.java | 9
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/OutsourcingFinishProductInspectionServiceImpl.java | 50
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerifyItem.java | 57
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderState.java | 67
inspect-server/src/main/resources/mapper/InsOrderDeviceRecordMapper.xml | 23
inspect-server/src/main/resources/static/report-template.docx | 0
inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsFatherVo.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/dto/ProcurementSuppliesListEDto.java | 54
performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursDayMapper.java | 12
basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantitySupplierDto.java | 12
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderDeviceRecordDto.java | 16
inspect-server/src/main/java/com/ruoyi/inspect/util/PreserveReportPicturePlaceholderHandler.java | 41
inspect-server/src/main/resources/static/spot_check_quarter.docx | 0
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOriginalHoursController.java | 8
basic-server/src/main/java/com/ruoyi/basic/controller/SealController.java | 7
inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java | 48
inspect-server/src/main/java/com/ruoyi/inspect/excel/OrderSplitExcelListener.java | 146
basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java | 35
inspect-server/src/main/java/com/ruoyi/inspect/event/NewJuOrderPlacedEvent.java | 14
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderDeviceRecordService.java | 11
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsOrderInspectionServiceImpl.java | 35
inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveOrderDevicesDto.java | 12
inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarter.java | 67
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderRatesController.java | 56
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplate.java | 48
inspect-server/src/main/java/com/ruoyi/inspect/dto/HistoryDto.java | 13
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java | 130
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java | 1061 ++
performance-server/src/main/java/com/ruoyi/performance/utils/CustomerDoubleSerialize.java | 26
inspect-server/src/main/resources/mapper/InsOrderStateMapper.xml | 4
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsPlaceOrderDto.java | 36
basic-server/src/main/java/com/ruoyi/basic/dto/StandardLibraryTreeNodeDto.java | 30
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java | 122
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursDayController.java | 18
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductDeviationWarningDto.java | 23
ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java | 38
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java | 13
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java | 414
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFactoryVerifyMapper.java | 17
basic-server/src/main/resources/mapper/StandardTreeMapper.xml | 221
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderService.java | 144
inspect-server/src/main/resources/static/factory_verify.docx | 0
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java | 18
basic-server/src/main/java/com/ruoyi/basic/vo/IfsInventoryQuantityVO.java | 37
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderStateService.java | 15
inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningService.java | 27
inspect-server/src/main/java/com/ruoyi/inspect/pojo/Warehouse.java | 44
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderTemplateDetailVo.java | 22
inspect-server/src/main/java/com/ruoyi/inspect/vo/RawMaterialSupplierVo.java | 31
basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityDto.java | 3
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandler.java | 113
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeTemplateBindingMapper.java | 8
inspect-server/src/main/java/com/ruoyi/inspect/dto/OrderTemplateSelectionDto.java | 15
basic-server/src/main/java/com/ruoyi/basic/pojo/IfsInventoryQuantity.java | 11
inspect-server/src/main/java/com/ruoyi/inspect/service/DataAnalysisService.java | 77
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethod.java | 13
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedRetestProductServiceImpl.java | 19
performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryOutputWorkingHoursMapper.java | 16
basic-server/src/main/java/com/ruoyi/basic/utils/StandardTemplateInspectionItemParser.java | 108
inspect-server/src/main/java/com/ruoyi/inspect/service/InsReportService.java | 74
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java | 1254 ++
inspect-server/src/main/resources/mapper/InsSampleUserMapper.xml | 16
inspect-server/src/main/java/com/ruoyi/inspect/mapper/IfsPartPropsRecordMapper.java | 22
inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleReceiptService.java | 24
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedHandlerFileMapper.java | 20
inspect-server/src/main/resources/mapper/InsProductUserMapper.xml | 4
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderDeviceRecord.java | 64
inspect-server/src/main/java/com/ruoyi/inspect/pojo/RawMaterialOrderTemplate.java | 52
basic-server/src/main/java/com/ruoyi/basic/mapper/SealMapper.java | 2
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderRatesMapper.java | 32
inspect-server/src/main/resources/mapper/RawMaterialOrderTemplateMapper.xml | 4
inspect-server/src/main/resources/static/split_order_import_template.xlsx | 0
inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseShelf.java | 61
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeTemplateDeviceMapper.java | 13
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFileServiceImpl.java | 20
basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductSupplierDensityServiceImpl.java | 18
inspect-server/src/main/resources/mapper/InsUnqualifiedRetestProductMapper.xml | 205
performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java | 6
inspect-server/src/main/java/com/ruoyi/inspect/mapper/IfsSplitOrderRecordMapper.java | 20
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSampleUser.java | 72
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java | 332
inspect-server/src/main/resources/mapper/InsReportMapper.xml | 155
inspect-server/src/main/java/com/ruoyi/inspect/vo/OrderTemplateSummaryVo.java | 13
inspect-server/src/main/resources/mapper/WarehouseHistoryMapper.xml | 16
inspect-server/src/main/java/com/ruoyi/inspect/service/FinishProductSpotCheckService.java | 126
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java | 53
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java | 1738 +++
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTreeTemplateDevice.java | 39
inspect-server/src/main/resources/static/detection-report-template-v2.docx | 0
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestProductMapper.java | 33
basic-server/src/main/java/com/ruoyi/basic/dto/InventoryDetailDTO.java | 52
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderRatesService.java | 34
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderUpdateDto.java | 21
inspect-server/src/main/java/com/ruoyi/inspect/vo/DeviationAnalyzeVo.java | 58
inspect-server/src/main/resources/mapper/InsOrderTemplateMapper.xml | 4
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductExportDto.java | 128
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedRetestResult.java | 51
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductUser.java | 40
inspect-server/src/main/java/com/ruoyi/inspect/service/OutsourcingFinishProductInspectionService.java | 38
inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductService.java | 55
performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml | 3
basic-server/src/main/java/com/ruoyi/basic/service/impl/LaboratoryServiceImpl.java | 15
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningMapper.java | 27
inspect-server/src/main/java/com/ruoyi/inspect/pojo/IfsPartPropsRecord.java | 67
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFactoryVerifyItemMapper.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseMapper.java | 23
inspect-server/src/main/resources/static/small-detection-template.docx | 0
inspect-server/src/main/resources/mapper/InsProductResultMapper.xml | 41
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodAttachment.java | 24
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFileMapper.java | 21
basic-server/src/main/resources/mapper/StructureTestMapper.xml | 1
inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedRetestProductService.java | 15
basic-server/src/main/java/com/ruoyi/basic/controller/LaboratoryController.java | 4
inspect-server/src/main/java/com/ruoyi/inspect/dto/ProductResultDto2.java | 19
inspect-server/src/main/resources/static/small-report-template.docx | 0
basic-server/src/main/java/com/ruoyi/basic/utils/StandardTreePathParser.java | 78
performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryOutputWorkingHoursTemporaryMapper.java | 26
inspect-server/src/main/java/com/ruoyi/inspect/excel/OrderSplitExcelData.java | 107
performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java | 10
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java | 10
basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java | 264
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedHandlerMapper.java | 29
inspect-server/src/main/java/com/ruoyi/inspect/controller/IfsOrderInspectionController.java | 38
inspect-server/src/main/java/com/ruoyi/inspect/controller/WarehouseController.java | 103
inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleService.java | 21
inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderTemplateService.java | 25
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 6033 +++++++++++
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/ReportServiceImpl.java | 129
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java | 83
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTree.java | 8
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java | 88
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodIndustry.java | 22
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSampleReceipt.java | 42
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderStandardTemplateService.java | 15
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/WarehouseCellServiceImpl.java | 26
inspect-server/src/main/java/com/ruoyi/inspect/service/IfsPartPropsRecordService.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderTemplateServiceImpl.java | 70
inspect-server/src/main/resources/mapper/InsProductMapper.xml | 184
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderStateMapper.java | 19
inspect-server/src/main/java/com/ruoyi/inspect/dto/OrderSplitDTO.java | 38
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductServiceImpl.java | 316
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsSampleUserVO.java | 33
inspect-server/src/main/java/com/ruoyi/inspect/dto/TemplateRateDto.java | 16
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleReceiptServiceImpl.java | 165
ruoyi-common/src/main/java/com/ruoyi/common/utils/QueryWrappers.java | 6
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java | 72
inspect-server/src/main/java/com/ruoyi/inspect/task/RawMaterIalSchedule.java | 31
inspect-server/src/main/resources/mapper/WarehouseMapper.xml | 24
inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckYearItemMapper.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerify.java | 100
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSample.java | 127
inspect-server/src/main/java/com/ruoyi/inspect/dto/VerifyPlanDto.java | 16
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedHandlerServiceImpl.java | 128
inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsChildrenVo.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/dto/EnterFactoryReport.java | 52
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptActionDto.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductAnalysisDto.java | 29
inspect-server/src/main/java/com/ruoyi/inspect/util/XWPFDocumentUtils.java | 119
basic-server/src/main/java/com/ruoyi/basic/pojo/StructureItemParameter.java | 6
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderStandardTemplateMapper.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java | 677 +
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java | 4
basic-server/src/main/resources/mapper/StandardTreeTemplateDeviceMapper.xml | 10
inspect-server/src/main/java/com/ruoyi/inspect/controller/OutsourcingFinishProductInspectionController.java | 58
inspect-server/src/main/java/com/ruoyi/inspect/service/IfsOrderInspectionService.java | 20
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningServiceImpl.java | 34
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/SpotCheckYearItemServiceImpl.java | 19
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplateDevice.java | 28
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderTemplateMapper.java | 18
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java | 9
performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryAllDto.java | 4
inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningDetailService.java | 16
inspect-server/src/main/java/com/ruoyi/inspect/vo/ProductVo.java | 22
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductListSupplierAsk.java | 4
inspect-server/src/main/java/com/ruoyi/inspect/service/WarehouseCellService.java | 13
inspect-server/src/main/java/com/ruoyi/inspect/dto/UnqualifiedHandlerDto.java | 148
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsSplitOrderRecordServiceImpl.java | 22
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanProductDto.java | 36
inspect-server/src/main/resources/mapper/WarehouseCellMapper.xml | 28
basic-server/src/main/resources/mapper/SealMapper.xml | 4
basic-server/src/main/java/com/ruoyi/basic/dto/StandardTreeTemplateBindingVo.java | 23
inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedHandlerFileService.java | 16
inspect-server/src/main/resources/mapper/SpotCheckQuarterMapper.xml | 25
inspect-server/src/main/java/com/ruoyi/inspect/pojo/IfsSplitOrderRecord.java | 161
inspect-server/src/main/java/com/ruoyi/inspect/dto/OmitOrderProductDto.java | 21
inspect-server/src/main/resources/static/spot_check_year.docx | 0
basic-server/src/main/resources/mapper/CertificationMapper.xml | 21
inspect-server/src/main/java/com/ruoyi/inspect/service/SpotCheckYearItemService.java | 15
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java | 6
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/DataAnalysisServiceImpl.java | 613 +
inspect-server/src/main/java/com/ruoyi/inspect/dto/CostStatisticsDto.java | 63
inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseCellMapper.java | 23
basic-server/src/main/java/com/ruoyi/basic/service/impl/CertificationServiceImpl.java | 6
inspect-server/src/main/java/com/ruoyi/inspect/dto/WarehouseDto.java | 14
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto2.java | 124
/dev/null | 123
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java | 8
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestResultMapper.java | 17
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java | 82
inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml | 44
inspect-server/src/main/java/com/ruoyi/inspect/util/HackLoopTableRenderPolicy.java | 154
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductRawAnalysisDto.java | 41
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleOrderDto.java | 106
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderRates.java | 72
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java | 49
inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarterItem.java | 69
inspect-server/src/main/java/com/ruoyi/inspect/service/IfsSplitOrderRecordService.java | 13
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderDeviceRecordServiceImpl.java | 15
375 files changed, 29,599 insertions(+), 1,549 deletions(-)
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java
index ca15b67..17b4645 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java
@@ -1,41 +1,26 @@
package com.ruoyi.basic.controller;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.excel.EasyExcel;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.core.domain.Result;
-import com.ruoyi.common.core.domain.entity.SysDictData;
-import com.ruoyi.system.service.ISysDictTypeService;
import com.ruoyi.basic.dto.PageTestObjectDto;
import com.ruoyi.basic.dto.ProductDTO1;
import com.ruoyi.basic.excel.StructureTestObjectData;
import com.ruoyi.basic.excel.StructureTestObjectListener;
import com.ruoyi.basic.pojo.Product;
-import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.basic.service.CapacityScopeService;
import com.ruoyi.basic.service.ProductService;
-import com.ruoyi.basic.service.StandardTemplateService;
import com.ruoyi.basic.service.StructureItemParameterService;
+import com.ruoyi.common.core.domain.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
-import org.apache.commons.lang3.ObjectUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Collectors;
/**
* 妫�楠岄」鐩弬鏁�(StructureItemParameter)琛ㄦ帶鍒跺眰
@@ -55,13 +40,10 @@
private StructureItemParameterService structureItemParameterService;
- private ISysDictTypeService dictTypeService;
-
- private StandardTemplateService standardTemplateService;
@Operation(summary = "鑾峰彇椤圭洰妫�楠屽弬鏁板垪琛�")
- @PostMapping("/selectItemParameterList")
- public Result selectItemParameterList(Page page,StructureItemParameter itemParameter) throws Exception {
+ @GetMapping("/selectItemParameterList")
+ public Result selectItemParameterList(Page page,StructureItemParameter itemParameter) {
return Result.success(capacityScopeService.selectItemParameterList(page, itemParameter));
}
@@ -72,7 +54,7 @@
}
@Operation(summary = "鍒犻櫎椤圭洰妫�楠屽弬鏁�")
- @PostMapping("/delItemParameter")
+ @DeleteMapping("/delItemParameter")
public Result<?> delItemParameter(Integer id) {
return Result.success(capacityScopeService.delItemParameter(id));
}
@@ -84,8 +66,8 @@
}
@Operation(summary = "鑾峰彇妫�楠屽璞�")
- @PostMapping("/selectTestObjectList")
- public Result selectTestObjectList(Page page,PageTestObjectDto pageTestObjectDto) throws Exception {
+ @GetMapping("/selectTestObjectList")
+ public Result selectTestObjectList(Page page,PageTestObjectDto pageTestObjectDto) {
return Result.success(capacityScopeService.selectTestObjectList(page, pageTestObjectDto));
}
@@ -96,7 +78,7 @@
}
@Operation(summary = "鍒犻櫎妫�楠屽璞�")
- @PostMapping("/delTestObject")
+ @DeleteMapping("/delTestObject")
public Result<?> delTestObject(Integer id) {
return Result.success(capacityScopeService.delTestObject(id));
}
@@ -114,14 +96,14 @@
}
@Operation(summary = "璁惧閲岄潰閫夋嫨妫�楠岄」鐩�(鏍戝舰缁撴瀯)")
- @PostMapping("/getInsProduction")
+ @GetMapping("/getInsProduction")
public Result getInsProduction() {
return Result.success(capacityScopeService.getInsProduction());
}
@Operation(summary = "缁存姢妫�楠屽璞$殑浜у搧")
- @PostMapping("/selectProductListByObjectId")
- public Result selectProductListByObjectId(Page page,ProductDTO1 productDTO) throws Exception {
+ @GetMapping("/selectProductListByObjectId")
+ public Result selectProductListByObjectId(Page page,ProductDTO1 productDTO) {
return Result.success(productService.selectProductListByObjectId(page, productDTO));
}
@@ -138,7 +120,7 @@
}
@Operation(summary = "鍒犻櫎浜у搧")
- @PostMapping("/delProduct")
+ @DeleteMapping("/delProduct")
public Result delProduct(Integer id) {
return Result.success(productService.delProduct(id));
}
@@ -154,229 +136,7 @@
@PostMapping("/importEquipData")
@Transactional
public Result importEquipData(@RequestParam("file") MultipartFile file) throws Exception {
- InputStream inputStream = file.getInputStream();
- List<StructureItemParameter> lists = new ArrayList<>();
- AtomicReference<String> sample = new AtomicReference<>();
- ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> {
- if (l == 1) {
- sample.set(list1.get(1) + "");
- }
- if (l >= 1) {
- StructureItemParameter str = new StructureItemParameter();
- // 娴嬭瘯瀵硅薄
- if (list1.get(1) == null) {
- str.setSample(null);
- } else {
- String brand = (String) list1.get(1);
- StringBuilder builder = new StringBuilder();
- builder.append("[");
- // 浜у搧
- if (ObjectUtil.isNotEmpty(list1.get(2))) {
- String production = (String) list1.get(2);
- if (!production.contains("锛�")) {
- builder.append(String.format("[\"%s\",\"%s\"]", brand, production));
- } else {
- Arrays.stream(production.split("锛�")).forEach(item -> {
- builder.append(String.format("[\"%s\",\"%s\"],", brand, item));
- });
- builder.deleteCharAt(builder.length() - 1);
- }
- } else {
- builder.append("[");
- builder.append(String.format("\"%s\"", brand));
- builder.append("]");
- }
- builder.append("]");
- str.setSample(builder.toString());
- }
- // 妫�楠岄」
- str.setInspectionItem(list1.get(4).toString().trim());
- // 妫�楠岄」鑻辨枃
- if (list1.get(5) != null) {
- str.setInspectionItemEn(list1.get(5).toString());
- }
- // 妫�楠屽瓙椤�
- if (list1.get(6) == null) {
- str.setInspectionItemSubclass(null);
- } else {
- str.setInspectionItemSubclass(list1.get(6).toString().trim());
- }
- // 妫�楠屽瓙椤硅嫳鏂�
- if (list1.get(7) == null) {
- str.setInspectionItemSubclassEn(null);
- } else {
- str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString()));
- }
- // 妫�楠岄」鍒嗙被
- if (list1.get(22) != null && list1.get(22) != "") {
- str.setInspectionItemClass(list1.get(22).toString().trim());
- } else {
- str.setInspectionItemClass(null);
- }
- // 妫�楠岄」鍒嗙被鑻辨枃
- if (list1.get(23) != null && list1.get(23) != "") {
- str.setInspectionItemClassEn(list1.get(23) + "");
- } else {
- str.setInspectionItemClassEn(null);
- }
-
- LambdaQueryWrapper<StructureItemParameter> wrapper = Wrappers.lambdaQuery(StructureItemParameter.class)
- .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
- .eq(StructureItemParameter::getSample, str.getSample())
-
- .last("limit 1");
- // 鍒ゆ柇鏄惁鏈夋楠岄」绫诲瀷
- if (ObjectUtils.isNotEmpty(str.getInspectionItemClass())) {
- wrapper.eq(StructureItemParameter::getInspectionItemClass, str.getInspectionItemClass());
- }
-
- // 鍒ゆ柇鏄惁鏈夋楠屽瓙椤�
- if (ObjectUtils.isNotEmpty(str.getInspectionItemSubclass())) {
- wrapper.eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass());
- }
- StructureItemParameter db_str = structureItemParameterService.getOne(wrapper);
- if (ObjectUtils.isNotEmpty(db_str)) {
- str.setId(db_str.getId());
- }
- // 鏂规硶鍚嶇О
- if (list1.get(8) == null) {
- str.setMethod(null);
- } else {
- StringBuffer buffer = new StringBuffer();
- String input = list1.get(8).toString();
- buffer.append("[");
- String[] values = input.split("锛�");
- for (String value : values) {
- buffer.append("\"").append(value.trim()).append("\",");
- }
- buffer.deleteCharAt(buffer.length() - 1);
- buffer.append("]");
- str.setMethod(buffer.toString());
- }
- // 璇曢獙瀹�
- if (list1.get(9) == null) {
- str.setSonLaboratory(null);
- } else {
- str.setSonLaboratory(list1.get(9).toString());
- }
- // 璁¢噺鍗曚綅
- if (list1.get(10) == null) {
- str.setUnit(null);
- } else {
- str.setUnit(list1.get(10).toString());
- }
- // 瑕佹眰鍊�
- if (list1.get(11) == null) {
- str.setAskTell(null);
- } else {
- str.setAskTell(list1.get(11).toString());
- }
- // 瑕佹眰鎻忚堪
- if (list1.get(12) == null) {
- str.setAsk(null);
- } else {
- str.setAsk(list1.get(12).toString());
- }
- // 鍗曚环
- if (list1.get(13) == null) {
- str.setPrice(null);
- } else {
- str.setPrice(list1.get(13) + "");
- }
- // 宸ユ椂绯绘暟
- if (list1.get(14) == null) {
- str.setManHour(null);
- } else {
- str.setManHour(Double.valueOf(list1.get(14).toString()));
- }
- // 宸ユ椂鍒嗙粍
- if (list1.get(15) == null) {
- str.setManHourGroup(null);
- } else {
- str.setManHourGroup(list1.get(15).toString());
- }
- // 棰勮瀹屾垚鏃堕棿
- if (list1.get(16) == null) {
- str.setManDay(null);
- } else {
- str.setManDay(Integer.valueOf(list1.get(16).toString()));
- }
- // 鏁版嵁绫诲瀷
- String jy;
- if (list1.get(17).toString().equals("闈為噰闆嗙被鍨�")) {
- jy = "0";
- } else {
- jy = "1";
- }
- str.setInspectionItemType(jy);
- // 妫�楠岄」绫诲瀷
- String validateValueType = list1.get(18).toString();
- if (ObjectUtils.isNotEmpty(validateValueType)) {
- List<SysDictData> enums = dictTypeService.selectDictDataByName("妫�楠屽�肩被鍨�")
- .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(validateValueType)).collect(Collectors.toList());
- str.setInspectionValueType(enums.get(0).getDictValue());
- }
- int bsm;
- //鐗规畩鏍囪瘑
- if (list1.get(19).toString().equals("鍚�")) {
- bsm = 0;
- } else {
- bsm = 1;
- }
- str.setBsm(bsm + "");
- // 鏁板瓧瀛楀吀
- if (list1.get(20) != null) {
- str.setDic(list1.get(20) + "");
- } else {
- str.setDic(null);
- }
- // 鍘熷璁板綍妯℃澘
- StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21)));
- if (standTempIdByName != null) {
- str.setTemplateId(standTempIdByName.getId());
- } else {
- str.setTemplateId(null);
- }
- try {
- if (list1.get(24) != null) {
- str.setLaboratory(list1.get(24) + "");
- }
- } catch (Exception e) {
- }
-
- // 鏉′欢
- if (list1.get(25) == null) {
- str.setRadiusList(null);
- } else {
- StringBuffer buffer = new StringBuffer();
- String input = list1.get(25).toString();
- buffer.append("[");
- String[] values = input.split("锛�");
- for (String value : values) {
- buffer.append("\"").append(value.trim()).append("\",");
- }
- buffer.deleteCharAt(buffer.length() - 1);
- buffer.append("]");
- str.setRadiusList(buffer.toString());
- }
- // 鏀惰垂鏍囧噯
- if (list1.get(26) == null) {
- str.setRates(null);
- } else {
- str.setRates(list1.get(26) + "");
- }
-
- lists.add(str);
- }
- });
-// structureItemParameterService.removeNoSample(sample.get());
- // 濡傛灉鏁版嵁搴撻噷闈㈢殑鏁版嵁瀛樺湪閭d箞灏辨墽琛屾洿鏂版嫹璐濇搷浣�
- try {
- structureItemParameterService.saveOrUpdateBatch(lists);
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("鏈嶅姟绔姤閿�");
- }
+ structureItemParameterService.importEquipData(file);
return Result.success();
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/CertificationController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/CertificationController.java
index 16b690f..28b4f51 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/CertificationController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/CertificationController.java
@@ -7,10 +7,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
@Tag(name = "璧勮川璇存槑")
@AllArgsConstructor
@@ -23,7 +20,7 @@
@Operation(summary = "鏌ヨ璧勮川鏄庣粏鍒楄〃")
- @PostMapping("/getCertificationDetail")
+ @GetMapping("/getCertificationDetail")
public Result getCertificationDetail(Page page,Certification certification) {
return Result.success(certificationService.getCertificationDetail(page, certification));
}
@@ -34,8 +31,8 @@
return Result.success(certificationService.addCertificationDetail(certification));
}
@Operation(summary = "鍒犻櫎璧勮川鏄庣粏鍒楄〃")
- @PostMapping("/delCertificationDetail")
- public Result<?> delCertificationDetail( String ids) {
+ @DeleteMapping("/delCertificationDetail")
+ public Result<?> delCertificationDetail(String ids) {
return Result.success(certificationService.delCertificationDetail(ids));
}
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/LaboratoryController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/LaboratoryController.java
index ca014a5..6f4465d 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/LaboratoryController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/LaboratoryController.java
@@ -24,7 +24,7 @@
private LaboratoryService laboratoryService;
@Operation(summary = "鏌ヨ瀹為獙瀹ょ鐞嗗垪琛�")
- @PostMapping("/selectItemParameter")
+ @GetMapping("/selectItemParameter")
public Result selectItemParameter(Page page ,Laboratory itemParameter) {
return Result.success(laboratoryService.selectItemParameter(page, itemParameter));
}
@@ -36,7 +36,7 @@
}
@Operation(summary = "鍒犻櫎瀹為獙瀹ゅ弬鏁�")
- @PostMapping("/delParameter")
+ @DeleteMapping("/delParameter")
public Result<?> delParameter(Integer id) {
return Result.success(laboratoryService.delParameter(id));
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/ProductPartController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/ProductPartController.java
index 97c1930..ba50a35 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/ProductPartController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/ProductPartController.java
@@ -7,10 +7,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
@RestController
@AllArgsConstructor
@@ -21,7 +18,7 @@
private ProductPartService productPartService;
@Operation(summary = "鏍规嵁浜у搧id鏌ヨ闆朵欢")
- @PostMapping("/selectByProductId")
+ @GetMapping("/selectByProductId")
public Result selectByProductId(Page page,ProductPart productPart){
return Result.success(productPartService.selectByProductId(page,productPart));
}
@@ -41,7 +38,7 @@
}
@Operation(summary = "鍒犻櫎浜у搧闆朵欢")
- @PostMapping("/deleteProductPart")
+ @DeleteMapping("/deleteProductPart")
public Result deleteProductPart(Integer id) {
productPartService.removeById(id);
return Result.success();
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/ProductSupplierDensityController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/ProductSupplierDensityController.java
index bc69d1b..490c2cc 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/ProductSupplierDensityController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/ProductSupplierDensityController.java
@@ -8,10 +8,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
/**
@@ -29,7 +26,7 @@
private ProductSupplierDensityService productSupplierDensityService;
@Operation(summary = "鏍规嵁浜у搧id鏌ヨ鍘傚瀵嗗害缁戝畾")
- @PostMapping("/selectSupplierDensityByProductId")
+ @GetMapping("/selectSupplierDensityByProductId")
public Result selectSupplierDensityByProductId(Page page,ProductSupplierDensity supplierDensity) {
return Result.success(productSupplierDensityService.selectByProductId(page, supplierDensity));
}
@@ -49,7 +46,7 @@
}
@Operation(summary = "鍒犻櫎鍘傚瀵嗗害缁戝畾")
- @PostMapping("/deleteProductSupplierDensity")
+ @DeleteMapping("/deleteProductSupplierDensity")
public Result deleteProductSupplierDensity(Integer id) {
productSupplierDensityService.removeById(id);
return Result.success();
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/SealController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/SealController.java
index 5d37b3c..ad72d15 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/SealController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/SealController.java
@@ -8,10 +8,7 @@
import com.ruoyi.common.utils.JackSonUtil;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.List;
@@ -43,7 +40,7 @@
}
@Operation(summary = "鏌ヨ鍗扮珷鍒楄〃")
- @PostMapping("/selectSeal")
+ @GetMapping("/selectSeal")
public Result selectSeal(Page page,Seal seal) {
return Result.success(sealService.selectSeal(page,seal));
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java
index 3be398d..62280c9 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java
@@ -21,8 +21,8 @@
private StandardMethodService standardMethodService;
@Operation(summary = "鑾峰彇鏍囧噯鏂规硶鍒楄〃")
- @PostMapping("/selectStandardMethodList")
- public Result selectStandardMethodList(Page page,StandardMethod standardMethod) throws Exception {
+ @GetMapping("/selectStandardMethodList")
+ public Result selectStandardMethodList(Page page,StandardMethod standardMethod) {
return Result.success(standardMethodService.selectStandardMethodList(page, standardMethod));
}
@@ -39,7 +39,7 @@
}
@Operation(summary = "鍒犻櫎鏍囧噯鏂规硶")
- @PostMapping("/delStandardMethod")
+ @DeleteMapping("/delStandardMethod")
public Result<?> delStandardMethod(Integer id) {
return Result.success(standardMethodService.delStandardMethod(id));
}
@@ -50,10 +50,29 @@
return Result.success(standardMethodService.upStandardMethod(standardMethod));
}
- @Operation(summary = "瀵煎叆鏍囧噯鏄庣粏")
- @PostMapping("/importStandardDetails")
- public Result<?> importStandardDetails(@RequestPart("file") MultipartFile file) throws IOException {
- standardMethodService.inputExcel(file);
- return Result.success();
+ @Operation(summary = "鑾峰彇琛屼笟閫夐」")
+ @GetMapping("/selectIndustryOptions")
+ public Result selectIndustryOptions() {
+ return Result.success(standardMethodService.selectIndustryOptions());
}
+
+ @Operation(summary = "鏌ヨ鏍囧噯闄勪欢")
+ @GetMapping("/selectAttachments")
+ public Result selectAttachments(Integer standardMethodId) {
+ return Result.success(standardMethodService.selectAttachments(standardMethodId));
+ }
+
+ @Operation(summary = "涓婁紶鏍囧噯闄勪欢")
+ @PostMapping("/uploadAttachment")
+ public Result uploadAttachment(@RequestParam("standardMethodId") Integer standardMethodId,
+ @RequestParam("file") MultipartFile file) {
+ return Result.success(standardMethodService.uploadAttachment(standardMethodId, file));
+ }
+
+ @Operation(summary = "鍒犻櫎鏍囧噯闄勪欢")
+ @DeleteMapping("/deleteAttachment")
+ public Result deleteAttachment(Long id) {
+ return Result.success(standardMethodService.deleteAttachment(id));
+ }
+
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java
index 0c98ebf..49be537 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java
@@ -18,8 +18,8 @@
private StandardTemplateService standardTemplateService;
@Operation(summary = "鑾峰彇鍘熷璁板綍妯℃澘鍒楄〃")
- @PostMapping("/selectStandardTemplatePageList")
- public Result selectStandardTemplatePageList(Page page,StandardTemplate standardTemplate) throws Exception {
+ @GetMapping("/selectStandardTemplatePageList")
+ public Result selectStandardTemplatePageList(Page page,StandardTemplate standardTemplate){
return Result.success(standardTemplateService.selectStandardTemplatePageList(page, standardTemplate));
}
@@ -36,7 +36,7 @@
}
@Operation(summary = "鍒犻櫎鍘熷璁板綍妯℃澘")
- @PostMapping("/delStandardTemplate")
+ @DeleteMapping("/delStandardTemplate")
public Result<?> delStandardTemplate(Integer id) {
return Result.success(standardTemplateService.delStandardTemplate(id));
}
@@ -48,7 +48,7 @@
}
@Operation(summary = "閫氳繃妯℃澘id鑾峰彇妫�楠岄」妯℃澘鍐呭")
- @PostMapping("/getStandTempThingById")
+ @GetMapping("/getStandTempThingById")
public Result<?> getStandTempThingById(Integer id) {
return Result.success(standardTemplateService.getStandTempThingById(id));
}
@@ -56,8 +56,7 @@
@Operation(summary = "缂栬緫妯℃澘缂栧埗")
@GetMapping("/getEditTemplatePreparation")
public Result<?> getEditTemplatePreparation(@RequestParam("id") Integer id) {
- StandardTemplate byId = standardTemplateService.getById(id);
- return Result.success("OK", byId.getThing());
+ return Result.success(standardTemplateService.getStandTempThingById(id));
}
@Operation(summary = "澶嶅埗鍘熷璁板綍妯℃澘")
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java
index 3077bea..55c0845 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java
@@ -1,19 +1,18 @@
package com.ruoyi.basic.controller;
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.ruoyi.basic.service.*;
import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.basic.dto.AddStandardTreeNodeDto;
import com.ruoyi.basic.dto.CopyStandardProductListDto;
-import com.ruoyi.basic.dto.FactoryDto;
import com.ruoyi.basic.dto.InsSampleReceiveDto;
import com.ruoyi.basic.dto.ResetTreeDragDTO;
+import com.ruoyi.basic.dto.StandardLibraryTreeNodeDto;
+import com.ruoyi.basic.dto.UpdateStandardTreeNodeDto;
+import com.ruoyi.basic.dto.StandardTreeTemplateBindingDto;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StandardProductListSupplierAsk;
-import com.ruoyi.basic.pojo.StandardTree;
-import com.ruoyi.basic.service.StandardMethodListService;
-import com.ruoyi.basic.service.StandardProductListService;
-import com.ruoyi.basic.service.StandardProductListSupplierAskService;
-import com.ruoyi.basic.service.StandardTreeService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
@@ -31,7 +30,7 @@
private StandardTreeService standardTreeService;
- private StandardMethodListService standardMethodListService;
+ private StandardMethodService standardMethodService;
private StandardProductListService standardProductListService;
@@ -51,57 +50,37 @@
@Operation(summary = "娣诲姞鏍囧噯鏍�")
@PostMapping("/addStandardTree")
- public Result addStandardTree(@RequestBody StandardTree standardTree) {
- return Result.success(standardTreeService.addStandardTree(standardTree));
- }
-
- @Operation(summary = "缁欐爣鍑嗘爲娣诲姞妫�楠屾爣鍑�")
- @PostMapping("/addStandardMethodList")
- public Result addStandardMethodList(String tree, Integer standardId) {
- return Result.success(standardMethodListService.addStandardMethodList(standardId, tree));
+ public Result addStandardTree(@RequestBody AddStandardTreeNodeDto dto) {
+ return Result.success(standardTreeService.addStandardTree(dto));
}
@Operation(summary = "鏍规嵁鏍囧噯鏍戣繘琛屾爣鍑嗘煡璇�")
- @PostMapping("/selectsStandardMethodByFLSSM")
+ @GetMapping("/selectsStandardMethodByFLSSM")
public Result selectsStandardMethodByFLSSM(String tree) {
- return Result.success(standardMethodListService.selectsStandardMethodByFLSSM(tree));
+ if (tree == null || tree.trim().isEmpty()) {
+ return Result.fail("鏍囧噯鏍戝弬鏁颁笉鑳戒负绌�");
+ }
+ return Result.success(standardMethodService.selectsStandardMethodByFLSSM(tree));
}
@Operation(summary = "淇敼鏍囧噯搴撲腑鐨勫唴瀹�")
@PostMapping("/upStandardProductList")
- public Result upStandardProductList(String str) {
+ public Result upStandardProductList(@RequestBody Map<String, String> map) {
+ String str = map.get("str");
StandardProductList list = JSON.parseObject(str, StandardProductList.class);
return Result.success(standardProductListService.upStandardProductList(list));
}
@Operation(summary = "淇敼鏍囧噯搴撳尯闂�")
@PostMapping("/updateSection")
- public Result updateSection(String str) {
+ public Result updateSection(@RequestBody Map<String, String> map) {
+ String str = map.get("str");
StandardProductList list = JSON.parseObject(str, StandardProductList.class);
return Result.success(standardProductListService.updateSection(list));
}
- @Operation(summary = "鍒犻櫎鏍囧噯鏍戜笅鐨勬楠屾爣鍑�")
- @PostMapping("/delStandardMethodByFLSSM")
- public Result delStandardMethodByFLSSM(Integer id) {
- return Result.success(standardMethodListService.delStandardMethodByFLSSM(id));
- }
-
- @Operation(summary = "鍒犻櫎鏍囧噯鏍戜笅鐨勬楠岄」鐩�")
- @PostMapping("/delStandardProductByIds")
- public Result delStandardProductByIds(String ids) {
- JSONArray lists = JSON.parseArray(ids);
- return Result.success(standardProductListService.delStandardProduct(lists));
- }
-
- @Operation(summary = "鏂板鏍囧噯鏍戜笅鐨勬楠岄」鐩�")
- @PostMapping("/addStandardProduct")
- public Result addStandardProduct(String ids, String tree) {
- return Result.success(standardTreeService.addStandardProduct(ids, tree));
- }
-
@Operation(summary = "鍒犻櫎鏍囧噯鏍戠殑灞傜骇")
- @PostMapping("/delStandardTree")
+ @DeleteMapping("/delStandardTree")
public Result delStandardTree(String tree) {
return Result.success(standardTreeService.delStandardTree(tree));
}
@@ -113,19 +92,19 @@
}
@Operation(summary = "閫氳繃妫�楠屾爣鍑嗘煡璇㈡楠岄」鐩�")
- @PostMapping("/selectStandardProductListByMethodId")
- public Result selectStandardProductListByMethodId(Integer id, String tree, Integer page) {
- return Result.success(standardProductListService.selectStandardProductListByMethodId(id, tree, page));
+ @GetMapping("/selectStandardProductListByMethodId")
+ public Result selectStandardProductListByMethodId(Integer id, String tree, Integer page, String keyword) {
+ return Result.success(standardProductListService.selectStandardProductListByMethodId(id, tree, page, keyword));
}
- @Operation(summary = "鎵归噺缂栬緫鏌ヨ妫�楠岄」鐩�")
- @PostMapping("/selectStandardProductByMethodId")
+ @Operation(summary = "鎵归噺鏌ヨ妫�楠岄」鐩�")
+ @GetMapping("/selectStandardProductByMethodId")
public Result selectStandardProductByMethodId(Integer id, String tree, Integer page, String laboratory, String item, String items) {
return Result.success(standardProductListService.selectStandardProductByMethodId(id, tree, page, laboratory, item, items));
}
- @Operation(summary = "鎵归噺缂栬緫鏌ヨ鎵�鏈夋楠岄」鐩拰妫�楠屽瓙椤规灇涓�")
- @PostMapping("/selectStandardProductEnumByMethodId")
+ @Operation(summary = "鎵归噺鏌ヨ鎵�鏈夋楠岄」鐩拰妫�楠屽瓙椤规灇涓�")
+ @GetMapping("/selectStandardProductEnumByMethodId")
public Result selectStandardProductEnumByMethodId(Integer id, String tree, String item) {
return Result.success(standardProductListService.selectStandardProductEnumByMethodId(id, tree, item));
}
@@ -133,7 +112,7 @@
@Operation(summary = "鑾峰彇鏍囧噯鏍戜笅鏍囧噯鏂规硶鏋氫妇")
@GetMapping("/selectStandardMethodEnum")
public Result selectStandardMethodEnum() {
- return Result.success(standardMethodListService.selectStandardMethodEnum());
+ return Result.success(standardMethodService.selectStandardMethodEnum());
}
@Operation(summary = "鑾峰彇浜у搧鏋舵瀯")
@@ -148,43 +127,6 @@
return Result.success(standardTreeService.upStandardProducts(product));
}
- @PostMapping("/getStandTreeBySampleType")
- @Operation(summary = "浠呰幏鍙栧厜绾ょ殑鍨嬪彿")
- public Result<?> getStandTreeBySampleType(String laboratory, String sampleType) {
- return Result.success(standardTreeService.getStandTreeBySampleType(laboratory, sampleType));
- }
-
- @Operation(summary = "瀵煎叆鏍囧噯搴�")
- @PostMapping("/inExcelOfTree/{isEquipment}")
- public Result inExcelOfTree(@RequestParam("file") MultipartFile file, @PathVariable("isEquipment") Boolean isEquipment) {
- if (!isEquipment) {
- standardTreeService.inExcelOfTree(file);
- } else {
- standardTreeService.importWorkstationExcel(file);
- }
- return Result.success();
- }
-
- @Operation(summary = "閲嶇疆鏍囧噯搴撳崟浠�")
- @PostMapping("/resetTreeOfPrice")
- public Result resetTreeOfPrice(String tree, Integer standardId) {
- standardTreeService.resetTreeOfPrice(tree, standardId);
- return Result.success();
- }
-
- @Operation(summary = "閲嶇疆鏍囧噯搴撳伐鏃剁郴鏁�")
- @PostMapping("/resetTreeOfHour")
- public Result resetTreeOfHour(String tree, Integer standardId) {
- standardTreeService.resetTreeOfHour(tree, standardId);
- return Result.success();
- }
-
- @Operation(summary = "閲嶇疆鏍囧噯搴撹姹傛弿杩板拰瑕佹眰鍊�")
- @PostMapping("/resetTreeOfAsk")
- public Result resetTreeOfAsk(String tree, Integer standardId) {
- standardTreeService.resetTreeOfAsk(tree, standardId);
- return Result.success();
- }
@Operation(summary = "鏍囧噯搴撴嫋鎷�")
@PostMapping("/resetTreeDrag")
@@ -203,7 +145,7 @@
@Operation(summary = "鏍囧噯鏍戞帓搴�")
@PostMapping("/updateTreeSort")
- public Result updateTreeSort(@RequestBody List<FactoryDto> list) {
+ public Result updateTreeSort(@RequestBody List<StandardLibraryTreeNodeDto> list) {
return Result.success(standardTreeService.updateTreeSort(list));
}
@@ -211,27 +153,29 @@
@Operation(summary = "鏍规嵁浜у搧id鏌ヨ鍘傚瑕佹眰鍊肩粦瀹�")
@PostMapping("/selectSupplierAsk")
- public Result selectSupplierAsk(StandardProductListSupplierAsk supplierAsk) throws Exception {
+ public Result selectSupplierAsk(@RequestBody StandardProductListSupplierAsk supplierAsk) throws Exception {
return Result.success(standardProductListSupplierAskService.selectByProductId(supplierAsk));
}
@Operation(summary = "鏂板鍘傚瑕佹眰鍊肩粦瀹�")
@PostMapping("/addProductSupplierAsk")
- public Result addProductSupplierAsk(String str) {
+ public Result addProductSupplierAsk(@RequestBody Map<String, String> map) {
+ String str = map.get("str");
StandardProductListSupplierAsk supplierAsk = JSON.parseObject(str, StandardProductListSupplierAsk.class);
return Result.success(standardProductListSupplierAskService.addProductSupplierAsk(supplierAsk));
}
@Operation(summary = "鏇存柊鍘傚瑕佹眰鍊肩粦瀹�")
@PostMapping("/updateProductSupplierAsk")
- public Result updateProductSupplierAsk(String str) {
+ public Result updateProductSupplierAsk(@RequestBody Map<String, String> map) {
+ String str = map.get("str");
StandardProductListSupplierAsk supplierAsk = JSON.parseObject(str, StandardProductListSupplierAsk.class);
standardProductListSupplierAskService.updateProductSupplierAsk(supplierAsk);
return Result.success();
}
@Operation(summary = "鍒犻櫎鍘傚瑕佹眰鍊肩粦瀹�")
- @PostMapping("/deleteProductSupplierAsk")
+ @DeleteMapping("/deleteProductSupplierAsk")
public Result deleteProductSupplierAsk(Integer supplierAskId) {
standardProductListSupplierAskService.removeById(supplierAskId);
return Result.success();
@@ -239,8 +183,20 @@
@Operation(summary = "淇敼鏍囧噯鏍�")
@PostMapping("/updateStandardTree")
- public Result updateStandardTree(@RequestBody StandardTree standardTree) {
- return Result.success(standardTreeService.updateStandardTree(standardTree));
+ public Result updateStandardTree(@RequestBody UpdateStandardTreeNodeDto dto) {
+ return Result.success(standardTreeService.updateStandardTree(dto));
+ }
+
+ @Operation(summary = "鏌ヨ鏍囧噯缁戝畾鐨勫師濮嬭褰曟ā鏉�")
+ @GetMapping("/selectTemplateBindings")
+ public Result selectTemplateBindings(Integer standardTreeId) {
+ return Result.success(standardTreeService.selectTemplateBindings(standardTreeId));
+ }
+
+ @Operation(summary = "淇濆瓨鏍囧噯缁戝畾鐨勫師濮嬭褰曟ā鏉�")
+ @PostMapping("/saveTemplateBindings")
+ public Result saveTemplateBindings(@RequestBody StandardTreeTemplateBindingDto dto) {
+ return Result.success(standardTreeService.saveTemplateBindings(dto));
}
@Operation(summary = "妫�楠岄」瑕佹眰鍊煎鍒跺姣�")
diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/StructureTestObjectPartController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/StructureTestObjectPartController.java
index 682520a..d3b3cca 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/controller/StructureTestObjectPartController.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/controller/StructureTestObjectPartController.java
@@ -8,10 +8,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
/**
@@ -29,7 +26,7 @@
private StructureTestObjectPartService structureTestObjectPartService;
@Operation(summary = "鏍规嵁妫�楠屽璞d鏌ヨ闆朵欢")
- @PostMapping("/selectByTestObjectId")
+ @GetMapping("/selectByTestObjectId")
public Result selectByTestObjectId(Page page,StructureTestObjectPart structureTestObjectPart){
return Result.success(structureTestObjectPartService.selectByTestObjectId(page,structureTestObjectPart));
}
@@ -49,7 +46,7 @@
}
@Operation(summary = "鍒犻櫎妫�楠屽璞¢浂浠�")
- @PostMapping("/deleteTestObjectPart")
+ @DeleteMapping("/deleteTestObjectPart")
public Result deleteTestObjectPart(Integer id) {
structureTestObjectPartService.removeById(id);
return Result.success();
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/AddStandardTreeNodeDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/AddStandardTreeNodeDto.java
new file mode 100644
index 0000000..aa184f8
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/AddStandardTreeNodeDto.java
@@ -0,0 +1,17 @@
+package com.ruoyi.basic.dto;
+
+import lombok.Data;
+
+/**
+ * 鏂板鏍囧噯鏍戣妭鐐硅姹�
+ */
+@Data
+public class AddStandardTreeNodeDto {
+
+ /**
+ * 鐖惰妭鐐硅矾寰勶細涓虹┖琛ㄧず鏂板琛屼笟锛涗负鍗曚釜琛屼笟鍚嶇О琛ㄧず鍦ㄨ琛屼笟涓嬫柊澧炴爣鍑�
+ */
+ private String parentTree;
+
+ private String name;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityCheckDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityCheckDto.java
index 4ea371a..d4d28d8 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityCheckDto.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityCheckDto.java
@@ -14,7 +14,7 @@
* @Date 2024/8/28
*/
@Data
-public class IfsInventoryQuantityCheckDto implements Serializable {
+public class IfsInventoryQuantityCheckDto implements Serializable {
private Integer id;
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityDto.java
index 0f4fe30..3461631 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityDto.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityDto.java
@@ -79,4 +79,7 @@
@Schema(description = "妫�楠屼汉")
private String userName;
+
+ @Schema(description = "閿�鍞鍗曞垎绫�")
+ private String orderType;
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantitySupplierDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantitySupplierDto.java
index ad4aabc..635587f 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantitySupplierDto.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantitySupplierDto.java
@@ -40,6 +40,9 @@
@Schema(description = "鏍峰搧缂栧彿")
private String sampleCode;
+ @Schema(description = "閿�鍞鍗曞垎绫诲悕绉�")
+ private String orderTypeName;
+
// 杩涘巶
@Schema(description = "杩涘巶璁㈠崟id")
private Integer enterOrderId;
@@ -53,6 +56,9 @@
@Schema(description = "鎵嬪姩涓婁紶鎶ュ憡鍦板潃")
private String enterUrlS;
+ @Schema(description = "杩涘巶鎶ュ憡瀹℃壒鐘舵��(1:鎵瑰噯閫氳繃锛�0锛氭壒鍑嗕笉閫氳繃)")
+ private Integer enterRatifyStatus;
+
// 瀛e害
@Schema(description = "瀛e害璁㈠崟id")
private Integer quarterOrderId;
@@ -65,6 +71,9 @@
@Schema(description = "鎵嬪姩涓婁紶鎶ュ憡鍦板潃")
private String quarterUrlS;
+
+ @Schema(description = "瀛e害妫�楠屾姤鍛婂鎵圭姸鎬�(1:鎵瑰噯閫氳繃锛�0锛氭壒鍑嗕笉閫氳繃)")
+ private Integer quarterRatifyStatus;
private Integer orderState;
@@ -121,4 +130,7 @@
@Schema(description = "鍏嶆")
private Integer isExemption;
+
+ @Schema(description = "鍘熸潗鏂檌d(瀵煎嚭鐢�)")
+ private String ids;
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/InventoryDetailDTO.java b/basic-server/src/main/java/com/ruoyi/basic/dto/InventoryDetailDTO.java
new file mode 100644
index 0000000..2a09409
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/InventoryDetailDTO.java
@@ -0,0 +1,52 @@
+package com.ruoyi.basic.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class InventoryDetailDTO {
+ // 鏉ヨ嚜 ifs_inventory_quantity
+ @Schema(description = "ifs_inventory_quantityID")
+ private Integer id;
+
+ @Schema(description = "闆朵欢鎻忚堪")
+ private String partDesc;
+
+ @Schema(description = "SN鍙�")
+ private String lotBatchNo;
+
+ @Schema(description = "闆朵欢鍙�")
+ private String partNo;
+
+ // 鏉ヨ嚜 ifs_part_props_record
+
+ @Schema(description = "缁濈紭棰滆壊")
+ private String insulationColor;
+
+ @Schema(description = "鎶ゅ棰滆壊")
+ private String outerColor;
+
+ @Schema(description = "杞藉叿缂栧彿")
+ private String drumNo;
+
+ @Schema(description = "璧峰绫虫爣")
+ private String startMeterMark;
+
+ @Schema(description = "鎴绫虫爣")
+ private String endMeterMark;
+
+ // 鏉ヨ嚜 ins_order
+
+ @Schema(description = "鍏ュ簱鏃堕棿")
+ private Date updateTime;
+
+ @Schema(description = "妫�娴嬬粨璁�")
+ private Integer insState;
+
+ // 閫昏緫璁$畻瀛楁锛氭楠屼汉 (COALESCE 鍚庣殑缁撴灉)
+
+ @Schema(description = "妫�娴嬩汉鍛�")
+ private String inspectorName;
+}
\ No newline at end of file
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/SampleDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/SampleDto.java
index 18fc086..db15b16 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/dto/SampleDto.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/SampleDto.java
@@ -1,5 +1,6 @@
package com.ruoyi.basic.dto;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@@ -13,11 +14,13 @@
private String value;
+ @Schema(description = "闆朵欢鍙�")
private String partNo;
- // 鏍峰搧鑻辨枃
+ @Schema(description = "鏍峰搧鑻辨枃")
private String sampleEn;
+ @Schema(description = "浜у搧")
private List<ModelDto> children;
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/StandardLibraryTreeNodeDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/StandardLibraryTreeNodeDto.java
new file mode 100644
index 0000000..6b95316
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/StandardLibraryTreeNodeDto.java
@@ -0,0 +1,30 @@
+package com.ruoyi.basic.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 鏍囧噯搴撳浐瀹氫袱绾ф爲鑺傜偣锛堣涓� -> 鏍囧噯锛�
+ */
+@Data
+public class StandardLibraryTreeNodeDto {
+
+ private Integer id;
+
+ private String label;
+
+ private String value;
+
+ private String code;
+
+ private String sampleEn;
+
+ private Integer standardMethodId;
+
+ private String standardCode;
+
+ private String standardName;
+
+ private List<StandardLibraryTreeNodeDto> children;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/StandardLibraryTreeRowDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/StandardLibraryTreeRowDto.java
new file mode 100644
index 0000000..c1739b3
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/StandardLibraryTreeRowDto.java
@@ -0,0 +1,30 @@
+package com.ruoyi.basic.dto;
+
+import lombok.Data;
+
+/**
+ * 鏍囧噯搴撲袱绾ф爲鏌ヨ鐨勬墎骞宠缁撴灉锛堣涓� + 鏍囧噯锛�
+ */
+@Data
+public class StandardLibraryTreeRowDto {
+
+ private Integer industryId;
+
+ private String industryName;
+
+ private Integer industrySort;
+
+ private Integer standardId;
+
+ private Integer standardMethodId;
+
+ private String standardCode;
+
+ private String standardName;
+
+ private String standardNameEn;
+
+ private String standardLabel;
+
+ private Integer standardSort;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/StandardTreeTemplateBindingDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/StandardTreeTemplateBindingDto.java
new file mode 100644
index 0000000..ec0a020
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/StandardTreeTemplateBindingDto.java
@@ -0,0 +1,11 @@
+package com.ruoyi.basic.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class StandardTreeTemplateBindingDto {
+ private Integer standardTreeId;
+ private List<TemplateBindingItemDto> templates;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/StandardTreeTemplateBindingVo.java b/basic-server/src/main/java/com/ruoyi/basic/dto/StandardTreeTemplateBindingVo.java
new file mode 100644
index 0000000..d4a2cc2
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/StandardTreeTemplateBindingVo.java
@@ -0,0 +1,23 @@
+package com.ruoyi.basic.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class StandardTreeTemplateBindingVo {
+ @Schema(description = "妯℃澘ID")
+ private Integer templateId;
+ @Schema(description = "妯℃澘鍚嶇О")
+ private String name;
+ @Schema(description = "妫�楠岄」鐩�")
+ private String number;
+ @Schema(description = "澶囨敞")
+ private String remark;
+ @Schema(description = "鎺掑簭")
+ private Integer sort;
+ @Schema(description = "璁惧ID闆嗗悎")
+ private List<Integer> deviceIds = new ArrayList<>();
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/TemplateBindingItemDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/TemplateBindingItemDto.java
new file mode 100644
index 0000000..9d116c4
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/TemplateBindingItemDto.java
@@ -0,0 +1,17 @@
+package com.ruoyi.basic.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class TemplateBindingItemDto {
+ @Schema(description = "妯℃澘ID")
+ private Integer templateId;
+ @Schema(description = "鎺掑簭")
+ private Integer sort;
+ @Schema(description = "璁惧ID闆嗗悎")
+ private List<Integer> deviceIds = new ArrayList<>();
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/TemplateInspectionItemDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/TemplateInspectionItemDto.java
new file mode 100644
index 0000000..cb43b8f
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/TemplateInspectionItemDto.java
@@ -0,0 +1,12 @@
+package com.ruoyi.basic.dto;
+
+import lombok.Data;
+
+/** 鍘熷璁板綍妯℃澘涓爣璁颁负鈥滄楠岄」鈥濈殑涓�琛屻�� */
+@Data
+public class TemplateInspectionItemDto {
+ private Integer templateId;
+ private Integer templateSort;
+ private Integer templateRowIndex;
+ private String inspectionItem;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/dto/UpdateStandardTreeNodeDto.java b/basic-server/src/main/java/com/ruoyi/basic/dto/UpdateStandardTreeNodeDto.java
new file mode 100644
index 0000000..d1d9da6
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/dto/UpdateStandardTreeNodeDto.java
@@ -0,0 +1,19 @@
+package com.ruoyi.basic.dto;
+
+import lombok.Data;
+
+/**
+ * 淇敼鏍囧噯鏍戣妭鐐硅姹�
+ */
+@Data
+public class UpdateStandardTreeNodeDto {
+
+ /**
+ * 鐖惰妭鐐硅矾寰勶細涓虹┖琛ㄧず淇敼琛屼笟锛涗负琛屼笟鍚嶇О琛ㄧず淇敼璇ヨ涓氫笅鐨勬爣鍑�
+ */
+ private String parentTree;
+
+ private String oldLabel;
+
+ private String name;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/CertificationMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/CertificationMapper.java
index 2d50f3d..460068b 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/CertificationMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/CertificationMapper.java
@@ -10,5 +10,5 @@
public interface CertificationMapper extends BaseMapper<Certification> {
//鏌ヨ璧勮川鏄庣粏鍒楄〃
- IPage<Certification> getCertificationDetail(Page page, @Param("ew") QueryWrapper<Certification> ew);
+ IPage<Certification> getCertificationDetail(Page page, @Param("param") Certification certification);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/IfsInventoryQuantityMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/IfsInventoryQuantityMapper.java
index 1963bb9..1eae395 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/IfsInventoryQuantityMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/IfsInventoryQuantityMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.basic.dto.IfsInventoryQuantityDto;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -24,7 +25,7 @@
* @param ifsInventoryId
* @return
*/
- int selectReportCountById(@Param("ifsInventoryId") Integer ifsInventoryId);
+ int selectReportCountById(@Param("ifsInventoryId") Long ifsInventoryId);
/**
@@ -39,4 +40,10 @@
@Param("supplierName") String supplierName,
@Param("startOfNextQuarter") LocalDateTime startOfNextQuarter,
@Param("endOfQuarter") LocalDateTime endOfQuarter);
+
+ List<IfsInventoryQuantityVO> selectSplitOrderList(@Param("partNo")String partNo,
+ @Param("lineNo")String lineNo,
+ @Param("releaseNo")String releaseNo,
+ @Param("receiptNo")Integer receiptNo,
+ @Param("orderNo")String orderNo);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/SealMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/SealMapper.java
index 9b96fc9..32d3819 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/SealMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/SealMapper.java
@@ -12,6 +12,6 @@
public interface SealMapper extends BaseMapper<Seal> {
IPage<Seal>selectSeal(Page page, @Param("ew") QueryWrapper<Seal> ew);
- List<Laboratory> selectLaboratory (Integer labId);
+ List<Laboratory> selectLaboratory (@Param("labId") Integer labId);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodAttachmentMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodAttachmentMapper.java
new file mode 100644
index 0000000..7acf48d
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodAttachmentMapper.java
@@ -0,0 +1,7 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.StandardMethodAttachment;
+
+public interface StandardMethodAttachmentMapper extends BaseMapper<StandardMethodAttachment> {
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodIndustryMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodIndustryMapper.java
new file mode 100644
index 0000000..3bfa2c9
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodIndustryMapper.java
@@ -0,0 +1,7 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.StandardMethodIndustry;
+
+public interface StandardMethodIndustryMapper extends BaseMapper<StandardMethodIndustry> {
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodListMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodListMapper.java
deleted file mode 100644
index a5e337b..0000000
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodListMapper.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.ruoyi.basic.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.ruoyi.basic.pojo.StandardMethodList;
-import com.ruoyi.basic.pojo.StandardProductList;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
-
-/**
-* @author Administrator
-* @description 閽堝琛ㄣ�恠tandard_method_list(鏍囧噯鏍戜笅鐨勬爣鍑嗗垪琛�)銆戠殑鏁版嵁搴撴搷浣淢apper
-* @createDate 2024-03-04 13:44:04
-* @Entity com.ruoyi.basic.pojo.StandardMethodList
-*/
-public interface StandardMethodListMapper extends BaseMapper<StandardMethodList> {
-
- Map<String, String> selectStandardMethodById(Integer id);
-
- String selectUserById(Integer id);
-
- List<StandardMethodList> selectStandardMethodLists(String tree);
-
- List<StandardMethodList> selectStandardMethodListsByNull(String tree);
-
- List<StandardMethodList> selectStandardMethodLists3(String tree);
-
- List<StandardMethodList> selectStandardMethodLists2(@Param("data1") String data1, @Param("data2") String data2, @Param("data3") String data3, @Param("data4") String data4, @Param("data5") String data5);
-
- List<StandardProductList> selectParameterList(String code);
-
- List<StandardMethodList> selectListEnum();
-
- Integer getStandardMethodId(String code);
-}
-
-
-
-
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java
index fb88032..e693de6 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java
@@ -3,9 +3,12 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.pojo.StandardMethodList;
import com.ruoyi.framework.mybatis_config.MyBaseMapper;
import com.ruoyi.basic.pojo.StandardMethod;
import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* @author Administrator
@@ -17,7 +20,20 @@
IPage<StandardMethod> selectStandardMethodList(Page page, @Param("ew") QueryWrapper<StandardMethod> ew);
- StandardMethod selectStandMethodById(Integer id);
+ StandardMethod selectStandMethodById(@Param("id") Integer id);
+
+
+ List<StandardMethodList> selectStandardMethodLists(@Param("tree") String tree);
+
+ List<StandardMethodList> selectStandardMethodListsByNull(@Param("tree") String tree);
+
+ List<StandardMethodList> selectStandardMethodLists3(@Param("tree") String tree);
+
+ List<StandardMethodList> selectStandardMethodListsByIndustry(@Param("industry") String industry);
+
+ List<StandardMethodList> selectListEnum();
+
+ Integer getStandardMethodId(@Param("code") String code);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java
index f25f673..05c0fdf 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java
@@ -62,6 +62,12 @@
@Param("endIndex") Integer endIndex,
@Param("methodId") Integer methodId,
@Param("tree") String tree);
+
+ /**
+ * 鎵归噺娣诲姞鏍囧噯
+ * @param productLists
+ */
+ void saveBatchProductLists(@Param("productLists") List<StandardProductList> productLists);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTemplateMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTemplateMapper.java
index feb76f2..5c2bd2b 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTemplateMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTemplateMapper.java
@@ -17,14 +17,22 @@
IPage<StandardTemplate> selectStandardTemplatePageList(Page page, @Param("ew") QueryWrapper<StandardTemplate> ew);
- StandardTemplate getStandTempIdByName(String name);
+ StandardTemplate getStandTempIdByName(@Param("name") String name);
/**
* 鏌ヨ鍘嬬缉鍚庣殑鏁版嵁
* @param templateId
* @return
*/
- String selectCompressThing(Integer templateId);
+ String selectCompressThing(@Param("templateId") Integer templateId);
+
+ /**
+ * 缁戝畾璇ユā鏉挎楠岄」鍙傛暟缁熻
+ *
+ * @param templateId
+ * @return
+ */
+ int countBindTemplateItemParameter(@Param("templateId") Integer templateId);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java
index 4deb5df..77ac5e8 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java
@@ -6,12 +6,14 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.*;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
-import com.ruoyi.basic.pojo.StandardMethodList;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StandardTree;
+import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
+import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
+import java.util.Set;
/**
* @author Administrator
@@ -19,27 +21,56 @@
* @createDate 2024-03-01 15:06:44
* @Entity com.ruoyi.basic.pojo.StandardTree
*/
+@Mapper
public interface StandardTreeMapper extends BaseMapper<StandardTree> {
- List<FactoryDto> selectStandardTreeList();
+ List<StandardLibraryTreeRowDto> selectStandardLibraryTree();
List<StandardTree> selectStandardTreeList2(String sampleType);
+
+ /**
+ * 琛屼笟鏀瑰悕锛氱骇鑱旀洿鏂版爣鍑嗗簱閰嶇疆涓殑琛屼笟鍚嶇О锛屽苟閲嶅缓涓ょ骇瑙勮寖璺緞
+ */
+ int updateProductListIndustry(@Param("oldName") String oldName, @Param("newName") String newName);
+
+ /**
+ * 鏍囧噯鏀瑰悕锛氱骇鑱旀洿鏂版爣鍑嗗簱閰嶇疆涓殑鏍囧噯鍚嶇О锛屽苟閲嶅缓涓ょ骇瑙勮寖璺緞
+ */
+ int updateProductListStandard(@Param("industry") String industry, @Param("oldName") String oldName, @Param("newName") String newName);
+
+ /**
+ * 琛屼笟鏀瑰悕锛氱骇鑱旀洿鏂版湭瀹屾垚璁㈠崟鐨勮涓氬悕绉�
+ */
+ int updateInsOrderIndustry(@Param("oldName") String oldName, @Param("newName") String newName);
+
+ int updateInsSampleIndustry(@Param("oldName") String oldName, @Param("newName") String newName);
+
+ int updateInsProductIndustry(@Param("oldName") String oldName, @Param("newName") String newName);
+
+ /**
+ * 鏍囧噯鏀瑰悕锛氱骇鑱旀洿鏂版湭瀹屾垚璁㈠崟鐨勬爣鍑嗗悕绉�
+ */
+ int updateInsOrderStandard(@Param("industry") String industry, @Param("oldName") String oldName, @Param("newName") String newName);
+
+ int updateInsSampleStandard(@Param("industry") String industry, @Param("oldName") String oldName, @Param("newName") String newName);
+
+ int updateInsProductStandard(@Param("industry") String industry, @Param("oldName") String oldName, @Param("newName") String newName);
StandardProductList selectStandardProductById(Integer id);
List<StandardProductList> getStandardProductListBySample(String sampleType);
- List<StandardMethodList> getStandardMethodListBySample(String sampleType);
+ List<StandardProductList> selectStandardProductListByTree(@Param("tree") String tree, @Param("sample") String sample, @Param("model") String model, @Param("trees") String trees, @Param("laboratory") String laboratory);
- List<StandardProductList> selectStandardProductListByTree(String tree, String sample, String model, String trees, String laboratory);
+ List<StandardProductList> selectStandardProductListByTree2(@Param("tree") String tree, @Param("sample") String sample, @Param("model") String model, @Param("trees") String trees, @Param("laboratory") String laboratory);
- List<StandardProductList> selectStandardProductListByTree2(String tree, String sample, String model, String trees, String laboratory);
+ /**
+ * 鎸夎涓氭煡璇㈠熀纭�妫�楠岄」锛岀敓鎴愪袱绾ф爣鍑嗛厤缃紙sample=鏍囧噯銆乵odel=NULL銆乼ree=瑙勮寖璺緞锛�
+ */
+ List<StandardProductList> selectStandardProductListByIndustry(@Param("industry") String industry, @Param("standard") String standard, @Param("tree") String tree);
List<SampleTypeDto> getStandardTree2();
-
- List<SampleDto> getStandardTree3(String sampleType);
-
String getLaboratory(String str);
@@ -51,8 +82,8 @@
List<FactoryDto> selectStandardTreeListByPartNo(@Param("partNo") String partNo);
- IPage<IfsInventoryQuantity> selectIfsPage(IPage<IfsInventoryQuantity> page,
- @Param("ew") QueryWrapper<IfsInventoryQuantity> ew);
+ IPage<IfsInventoryQuantityVO> selectIfsPage(IPage<IfsInventoryQuantity> page,
+ @Param("ew") QueryWrapper<IfsInventoryQuantity> ew);
IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page,
@Param("ew") QueryWrapper<IfsInventoryQuantityDto> ew);
@@ -85,6 +116,27 @@
*/
IPage<IfsInventoryQuantitySupplierDto> getIfsByQuarter(Page<IfsInventoryQuantitySupplierDto> page, @Param("ew") QueryWrapper<IfsInventoryQuantitySupplierDto> ew, @Param("beginDeclareDate") String beginDeclareDate, @Param("endDeclareDate")String endDeclareDate);
+ /**
+ * 鎵归噺鏌ヨ鏍�
+ * @param sampleTypeValues
+ * @return
+ */
+ List<SampleDto> getStandardTree3Batch(@Param("sampleTypeValues") Set<String> sampleTypeValues);
+
+ /**
+ * 鏌ヨ鏍�
+ * @param sampleType
+ * @return
+ */
+ List<SampleDto> getStandardTree3(@Param("sampleType") String sampleType);
+
+ /**
+ * 鏍规嵁鍘熸潗鏂檌d鍒楄〃鏌ヨ鍘熸潗鏂欎俊鎭�
+ * @param ifsIds
+ * @return
+ */
+ List<IfsInventoryQuantitySupplierDto> getIfsByIds(@Param("ifsIds") List<String> ifsIds);
+
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeTemplateBindingMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeTemplateBindingMapper.java
new file mode 100644
index 0000000..366cd3b
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeTemplateBindingMapper.java
@@ -0,0 +1,8 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.StandardTreeTemplateBinding;
+
+/** 鏍囧噯妯℃澘缁戝畾 Mapper銆� */
+public interface StandardTreeTemplateBindingMapper extends BaseMapper<StandardTreeTemplateBinding> {
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeTemplateDeviceMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeTemplateDeviceMapper.java
new file mode 100644
index 0000000..030f40d
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeTemplateDeviceMapper.java
@@ -0,0 +1,13 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.StandardTreeTemplateDevice;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/** 鏍囧噯妯℃澘榛樿璁惧 Mapper銆� */
+public interface StandardTreeTemplateDeviceMapper extends BaseMapper<StandardTreeTemplateDevice> {
+
+ List<Integer> selectExistingDeviceIds(@Param("deviceIds") List<Integer> deviceIds);
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java
index 654741a..017c66a 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java
@@ -25,6 +25,12 @@
List<TestItemDto> getItemTree();
- int removeNoSample(@Param("sample") String sample);
+
+ /**
+ * 鏌ヨ璁惧淇℃伅
+ * @param managementNumberList
+ * @return
+ */
+ List<Integer> selectDeviceIdsByNumber(@Param("managementNumberList") List<String> managementNumberList);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/Certification.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/Certification.java
index 5fc2380..6b675c4 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/Certification.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/Certification.java
@@ -69,4 +69,8 @@
@Schema(description = "璧勮川闄勪欢鍦板潃")
private String fileUrl;
+
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/IfsInventoryQuantity.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/IfsInventoryQuantity.java
index d00c3ae..2558329 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/IfsInventoryQuantity.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/IfsInventoryQuantity.java
@@ -18,7 +18,7 @@
@ExcelIgnoreUnannotated
public class IfsInventoryQuantity implements Serializable {
@TableId(type = IdType.AUTO)
- private Integer id;
+ private Long id;
@Schema(description = "鍩�")
@@ -36,6 +36,12 @@
@Schema(description = "鎺ユ敹鍙�")
private Integer receiptNo;
+
+ @Schema(description = "璁㈠崟绫诲瀷(01raw:鍘熸潗鏂欙紝02wg:澶栬喘鎴愬搧)")
+ private String orderType;
+
+ @Schema(description = "鐗╂枡灞炴�э紝鐢ㄤ簬鍖哄垎閾溿�侀摑瀵间綋绛夐浂浠�")
+ private String materialProp;
@ExcelProperty(index = 3, value = "闆朵欢鍙�")
@Schema(description = "闆朵欢鍙�")
@@ -207,4 +213,7 @@
// 鏄惁鏄繃鏈熸潗鏂�: 0鍚�, 1:鏄�"
@Schema(description = "鐗╂枡绫诲瀷")
private Integer isExpire;
+
+ @Schema(description = "鏄惁涓烘媶鍒嗚鍗�(1:鏄紝0:鍚�)")
+ private Integer isSplitOrder;
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/Laboratory.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/Laboratory.java
index 64db2e1..7c58356 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/Laboratory.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/Laboratory.java
@@ -39,11 +39,15 @@
@Schema(description = "鍦板潃")
private String address;
+ @Schema(description = "琛屼笟鎺掑簭")
+ private Integer sort;
+
@Schema(description = "鍒涘缓浜�")
@TableField(fill = FieldFill.INSERT)
private Integer createUser;
@Schema(description = "鍒涘缓浜�")
+ @TableField(select = false,exist = false)
private String createUserName;
@Schema(description = "淇敼浜篿d")
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethod.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethod.java
index 02f67de..ebb426b 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethod.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethod.java
@@ -7,6 +7,7 @@
import java.io.Serializable;
import java.time.LocalDateTime;
+import java.util.List;
/**
* 鏍囧噯鏂规硶
@@ -26,6 +27,18 @@
@Schema(description = "妫�楠屽璞�")
private String structureTestObjectId;
+ /** 鏍囧噯搴撲竴绾ц涓欼D锛堜粎鎺ュ彛浜や簰锛屼笉钀絪tandard_method琛級 */
+ @TableField(exist = false)
+ private List<Integer> industryIds;
+
+ /** 宸茬粦瀹氳涓氬悕绉帮紙鍒楄〃灞曠ず锛� */
+ @TableField(exist = false)
+ private String industryNames;
+
+ /** 闄勪欢鏁伴噺锛堝垪琛ㄥ睍绀猴級 */
+ @TableField(exist = false)
+ private Integer attachmentCount;
+
/**
* 鏍囧噯缂栧彿
*/
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodAttachment.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodAttachment.java
new file mode 100644
index 0000000..8dd9007
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodAttachment.java
@@ -0,0 +1,24 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import java.time.LocalDateTime;
+
+@Data
+@TableName("standard_method_attachment")
+public class StandardMethodAttachment {
+ @TableId(type = IdType.AUTO)
+ private Long id;
+ private Integer standardMethodId;
+ private String fileName;
+ private String fileUrl;
+ private Integer sort;
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodIndustry.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodIndustry.java
new file mode 100644
index 0000000..3ef8ebf
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodIndustry.java
@@ -0,0 +1,22 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import java.time.LocalDateTime;
+
+@Data
+@TableName("standard_method_industry")
+public class StandardMethodIndustry {
+ @TableId(type = IdType.AUTO)
+ private Long id;
+ private Integer standardMethodId;
+ private Integer industryId;
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java
index 62b1f6e..a18e4c3 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java
@@ -12,7 +12,6 @@
* 鏍囧噯鏍戜笅鐨勬爣鍑嗗垪琛�
* @TableName standard_method_list
*/
-@TableName(value ="standard_method_list")
@Data
public class StandardMethodList implements Serializable {
/**
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductList.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductList.java
index 405358a..9e68bbf 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductList.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductList.java
@@ -2,8 +2,8 @@
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
-import tools.jackson.databind.annotation.JsonSerialize;
-import tools.jackson.databind.ser.std.ToStringSerializer;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -153,7 +153,7 @@
@Schema(description = "鍨嬪彿")
private String model;
- @Schema(description = "鍨嬪彿")
+ @Schema(description = "妯℃澘id")
private Integer templateId;
@Schema(description = "")
@@ -187,6 +187,7 @@
private String tree;
+ @Schema(description = "妫�楠岄」id")
private Integer structureItemParameterId;
@Schema(description = "妫�楠岄」鍒嗙被")
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductListSupplierAsk.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductListSupplierAsk.java
index f9a171f..a8cebdf 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductListSupplierAsk.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductListSupplierAsk.java
@@ -2,8 +2,8 @@
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
-import tools.jackson.databind.annotation.JsonSerialize;
-import tools.jackson.databind.ser.std.ToStringSerializer;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTemplate.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTemplate.java
index 14d8c42..64d0c17 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTemplate.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTemplate.java
@@ -6,6 +6,7 @@
import lombok.Data;
import java.io.Serializable;
+import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@@ -73,4 +74,10 @@
*/
@Schema(description = "妯℃澘缂栧彿")
private String number;
+
+ /**
+ * 浠锋牸(鍏�)
+ */
+ @Schema(description = "浠锋牸(鍏�)")
+ private BigDecimal price;
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTree.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTree.java
index 3f17e10..b09e9ab 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTree.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTree.java
@@ -62,6 +62,14 @@
@Length(max= 255,message="缂栫爜闀垮害涓嶈兘瓒呰繃255")
private String model;
/**
+ * 鏍囧噯鎺掑簭
+ */
+ @Schema(description = "鏍囧噯鎺掑簭")
+ private Integer sort;
+
+ /** 鏍囧噯缁存姢ID锛涜鑼冨寲浜岀骇鏍囧噯浣跨敤 */
+ private Integer standardMethodId;
+ /**
*
*/
@Schema(description = "")
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTreeTemplateBinding.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTreeTemplateBinding.java
new file mode 100644
index 0000000..f653b69
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTreeTemplateBinding.java
@@ -0,0 +1,37 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/** 鏍囧噯锛堜簩绾ц妭鐐癸級涓庡師濮嬭褰曟ā鏉跨殑缁戝畾鍏崇郴銆� */
+@Data
+@TableName("standard_tree_template_binding")
+public class StandardTreeTemplateBinding {
+
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private Integer standardTreeId;
+
+ private Integer templateId;
+
+ private Integer sort;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTreeTemplateDevice.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTreeTemplateDevice.java
new file mode 100644
index 0000000..d734955
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTreeTemplateDevice.java
@@ -0,0 +1,39 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/** 鏍囧噯涓嬪師濮嬭褰曟ā鏉夸笌榛樿璁惧鐨勭粦瀹氬叧绯汇�� */
+@Data
+@TableName("standard_tree_template_device")
+public class StandardTreeTemplateDevice {
+
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private Integer standardTreeId;
+
+ private Integer templateId;
+
+ private Integer deviceId;
+
+ private Integer sort;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StructureItemParameter.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StructureItemParameter.java
index ca462dd..4846e3c 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/pojo/StructureItemParameter.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StructureItemParameter.java
@@ -117,5 +117,11 @@
@Schema(description = "鏀惰垂鏍囧噯(鍏�/娆�)")
private String rates;
+ @Schema(description = "璁惧id")
+ private String deviceIds;
+
+ @Schema(description = "鎶芥绫诲瀷, 1:鏈堝害, 2:瀛e害, 3:骞村害")
+ private String spotCheckType;
+
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java b/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java
deleted file mode 100644
index 14ee117..0000000
--- a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.basic.pojo.StandardMethodList;
-
-import java.util.List;
-import java.util.Map;
-
-/**
-* @author Administrator
-* @description 閽堝琛ㄣ�恠tandard_method_list(鏍囧噯鏍戜笅鐨勬爣鍑嗗垪琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice
-* @createDate 2024-03-04 13:44:04
-*/
-public interface StandardMethodListService extends IService<StandardMethodList> {
-
- int addStandardMethodList(Integer standardId, String tree);
-
- Map<String, List<?>> selectsStandardMethodByFLSSM(String tree);
-
- Map<String, List<?>> selectsStandardMethodByFLSSM2(String tree);
-
- int delStandardMethodByFLSSM(Integer id);
-
- List<StandardMethodList> selectStandardMethodEnum();
-
- Integer getStandardMethodId(String code);
-
-}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java b/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java
index d9b3432..d0cde18 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java
@@ -4,10 +4,14 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StandardMethod;
+import com.ruoyi.basic.pojo.StandardMethodList;
+import com.ruoyi.basic.pojo.StandardMethodAttachment;
+import com.ruoyi.basic.pojo.Laboratory;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
+import java.util.Map;
/**
* @author Administrator
@@ -20,11 +24,22 @@
List<StandardMethod> selectStandardMethods();
- int addStandardMethod(StandardMethod standardMethod);
+ Integer addStandardMethod(StandardMethod standardMethod);
int delStandardMethod(Integer id);
int upStandardMethod(StandardMethod standardMethod);
- void inputExcel(MultipartFile file) throws IOException;
+ Map<String, List<?>> selectsStandardMethodByFLSSM(String tree);
+
+ List<StandardMethodList> selectStandardMethodEnum();
+
+ List<StandardMethodAttachment> selectAttachments(Integer standardMethodId);
+
+ StandardMethodAttachment uploadAttachment(Integer standardMethodId, MultipartFile file);
+
+ boolean deleteAttachment(Long id);
+
+ List<Laboratory> selectIndustryOptions();
+
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService.java b/basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService.java
index 326ecbb..a750f5b 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService.java
@@ -1,6 +1,6 @@
package com.ruoyi.basic.service;
-import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.dto.CopyStandardProductListDto;
@@ -20,11 +20,18 @@
int upStandardProductList(StandardProductList list);
- int delStandardProduct(JSONArray list);
-
List<StandardProductList> selectStandardProductList(InsSampleReceiveDto insSample);
- Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page);
+ /**
+ * 鏍规嵁妫�楠屾爣鍑嗗拰鏍囧噯鏍戣妭鐐圭敓鎴愭楠岄」鐩紝骞跺悓姝ヨ鑺傜偣涓嬪凡淇濆瓨鐨勯」鐩厤缃��
+ *
+ * <p>璇ユ柟娉曚細鍒犻櫎鐩爣鑺傜偣锛堟垨鍏跺瓙鑺傜偣锛夌殑鏃ц褰曞悗閲嶆柊鎵归噺淇濆瓨锛屽洜姝ゅ苟闈炲彧璇绘煡璇€��</p>
+ *
+ * @param id 妫�楠屾爣鍑� ID
+ * @param tree 鏍囧噯鏍戣矾寰勶紝浣跨敤 {@code " - "} 鍒嗛殧灞傜骇
+ * @return {@code productList} 涓虹敓鎴愬悗鐨勬楠岄」鐩垪琛紝{@code total} 涓哄垪琛ㄦ暟閲�
+ */
+ Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page, String keyword);
IPage<StandardProductList> selectStandardProductByMethodId(Integer id, String tree, Integer page, String laboratory, String item, String items);
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService2.java b/basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService2.java
deleted file mode 100644
index 4f54fe6..0000000
--- a/basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService2.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.basic.pojo.StandardProductList;
-
-/**
-* @author Administrator
-* @description 閽堝琛ㄣ�恠tandard_product_list(鏍囧噯鏍戜笅鐨勬楠岄」鐩�)銆戠殑鏁版嵁搴撴搷浣淪ervice
-* @createDate 2024-03-05 10:33:29
-*/
-public interface StandardProductListService2 extends IService<StandardProductList> {
-
-}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java b/basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java
index 39d08e7..aca97aa 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java
@@ -1,8 +1,13 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.basic.dto.FactoryDto;
+import com.ruoyi.basic.dto.AddStandardTreeNodeDto;
import com.ruoyi.basic.dto.SampleTypeDto;
+import com.ruoyi.basic.dto.StandardLibraryTreeNodeDto;
+import com.ruoyi.basic.dto.UpdateStandardTreeNodeDto;
+import com.ruoyi.basic.dto.StandardTreeTemplateBindingDto;
+import com.ruoyi.basic.dto.StandardTreeTemplateBindingVo;
+import com.ruoyi.basic.dto.TemplateInspectionItemDto;
import com.ruoyi.basic.pojo.StandardTree;
import org.springframework.web.multipart.MultipartFile;
@@ -16,37 +21,29 @@
*/
public interface StandardTreeService extends IService<StandardTree> {
- List<FactoryDto> selectStandardTreeList();
+ List<StandardLibraryTreeNodeDto> selectStandardTreeList();
- int addStandardTree(StandardTree standardTree);
+ int addStandardTree(AddStandardTreeNodeDto dto);
int delStandardTree(String tree);
-
- int addStandardProduct(String ids, String tree);
List<SampleTypeDto> getStandardTree2();
int upStandardProducts(Map<String, Object> product);
- List<StandardTree> getStandTreeBySampleType(String laboratory, String sampleType);
-
- void inExcelOfTree(MultipartFile file);
-
- void resetTreeOfPrice(String tree, Integer standardId);
-
- void resetTreeOfHour(String tree, Integer standardId);
-
- void resetTreeOfAsk(String tree, Integer standardId);
-
- void importWorkstationExcel(MultipartFile file);
-
/**
- * 鏍囧噯鏁版帓搴�
+ * 鏍囧噯鏍戞帓搴�
* @param list
* @return
*/
- boolean updateTreeSort(List<FactoryDto> list);
+ boolean updateTreeSort(List<StandardLibraryTreeNodeDto> list);
- int updateStandardTree(StandardTree standardTree);
+ int updateStandardTree(UpdateStandardTreeNodeDto dto);
+
+ List<StandardTreeTemplateBindingVo> selectTemplateBindings(Integer standardTreeId);
+
+ boolean saveTemplateBindings(StandardTreeTemplateBindingDto dto);
+
+ List<TemplateInspectionItemDto> selectTemplateInspectionItems(Integer standardTreeId);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StructureItemParameterService.java b/basic-server/src/main/java/com/ruoyi/basic/service/StructureItemParameterService.java
index a697619..d22d250 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/StructureItemParameterService.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/StructureItemParameterService.java
@@ -2,7 +2,15 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StructureItemParameter;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
public interface StructureItemParameterService extends IService<StructureItemParameter> {
- void removeNoSample(String sample);
+
+ /**
+ * 瀵煎叆妫�楠岄」鐩�
+ * @param file
+ */
+ void importEquipData(MultipartFile file) throws IOException;
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/CapacityScopeServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/CapacityScopeServiceImpl.java
index f63a161..4b436aa 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/CapacityScopeServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/CapacityScopeServiceImpl.java
@@ -33,8 +33,6 @@
@AllArgsConstructor
public class CapacityScopeServiceImpl extends ServiceImpl<StructureItemParameterMapper, StructureItemParameter> implements CapacityScopeService {
- private LaboratoryMapper laboratoryMapper;
-
private StructureItemParameterMapper structureItemParameterMapper;
private StructureTestObjectMapper structureTestObjectMapper;
@@ -102,12 +100,14 @@
List<Product> products = productMapper.selectList(Wrappers.<Product>lambdaQuery()
.eq(Product::getObjectId, id));
List<Integer> productIds = products.stream().map(Product::getId).collect(Collectors.toList());
- productPartMapper.delete(Wrappers.<ProductPart>lambdaQuery()
- .in(ProductPart::getProductId, productIds));
+ if (CollectionUtils.isNotEmpty(productIds)) {
+ productPartMapper.delete(Wrappers.<ProductPart>lambdaQuery()
+ .in(ProductPart::getProductId, productIds));
- // 鍒犻櫎浜у搧缁存姢
- productMapper.delete(Wrappers.<Product>lambdaQuery()
- .in(Product::getId, productIds));
+ // 鍒犻櫎浜у搧缁存姢
+ productMapper.delete(Wrappers.<Product>lambdaQuery()
+ .in(Product::getId, productIds));
+ }
return structureTestObjectMapper.deleteById(id);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/CertificationServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/CertificationServiceImpl.java
index 11a6e61..43eb9d2 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/CertificationServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/CertificationServiceImpl.java
@@ -12,7 +12,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.Arrays;
import java.util.List;
+import java.util.stream.Collectors;
@Service
@AllArgsConstructor
@@ -26,7 +28,7 @@
//鏌ヨ璧勮川鏄庣粏鍒楄〃
@Override
public IPage<Certification> getCertificationDetail(Page page, Certification certification) {
- return certificationMapper.getCertificationDetail(page, QueryWrappers.queryWrappers(certification));
+ return certificationMapper.getCertificationDetail(page, certification);
}
//娣诲姞璧勮川鏄庣粏鍒楄〃
@@ -38,7 +40,7 @@
//鍒犻櫎璧勮川鏄庣粏鍒楄〃
@Override
public int delCertificationDetail(String ids) {
- List<Integer> list = JSON.parseArray(ids,Integer.class);
+ List<Integer> list = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList());
return certificationMapper.deleteBatchIds(list);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/LaboratoryServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/LaboratoryServiceImpl.java
index a91a3c5..1a57787 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/LaboratoryServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/LaboratoryServiceImpl.java
@@ -1,14 +1,19 @@
package com.ruoyi.basic.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.mapper.StructureTestObjectMapper;
+import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.LaboratoryMapper;
import com.ruoyi.basic.pojo.Laboratory;
import com.ruoyi.basic.service.LaboratoryService;
import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -23,6 +28,9 @@
private LaboratoryMapper laboratoryMapper;
+ @Autowired
+ private StructureTestObjectMapper structureTestObjectMapper;
+
@Override
public IPage<Laboratory> selectItemParameter(Page page, Laboratory itemParameter) {
return laboratoryMapper.selectItemParameter(page, QueryWrappers.queryWrappers(itemParameter));
@@ -35,6 +43,13 @@
@Override
public int delParameter(Integer id) {
+ // 鍒ゆ柇鏄惁缁戝畾瀵硅薄
+ QueryWrapper<StructureTestObject> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("laboratory_id",id);
+ List<StructureTestObject> structureTestObjectList = structureTestObjectMapper.selectList(queryWrapper);
+ if(!CollectionUtils.isEmpty(structureTestObjectList)){
+ throw new RuntimeException("宸茬粦瀹氬璞★紝绂佹鍒犻櫎");
+ }
return laboratoryMapper.deleteById(id);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductSupplierDensityServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductSupplierDensityServiceImpl.java
index 54a92ab..fc5f09e 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductSupplierDensityServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductSupplierDensityServiceImpl.java
@@ -32,15 +32,6 @@
if (supplierDensity.getProductId() == null) {
throw new BaseException("缂哄皯浜у搧瀵硅薄id");
}
- // 鏌ヨ鏀瑰巶瀹舵槸鍚︾粦瀹氳繃
-// Long count = baseMapper.selectCount(Wrappers.<ProductSupplierDensity>lambdaQuery()
-// .eq(ProductSupplierDensity::getProductId, supplierDensity.getProductId())
-// .eq(ProductSupplierDensity::getModel, supplierDensity)
-// .eq(ProductSupplierDensity::getSupplierName, supplierDensity.getSupplierName()));
-// if (count > 0){
-// throw new BaseException("璇ヤ骇鍝佸凡缁戝畾杩囪鍘傚");
-// }
-
baseMapper.insert(supplierDensity);
}
@@ -49,15 +40,6 @@
if (supplierDensity.getProductId() == null) {
throw new BaseException("缂哄皯浜у搧瀵硅薄id");
}
- // 鏌ヨ鏀瑰巶瀹舵槸鍚︾粦瀹氳繃
-// Long count = baseMapper.selectCount(Wrappers.<ProductSupplierDensity>lambdaQuery()
-// .ne(ProductSupplierDensity::getId, supplierDensity.getId())
-// .eq(ProductSupplierDensity::getProductId, supplierDensity.getProductId())
-// .eq(ProductSupplierDensity::getModel, supplierDensity)
-// .eq(ProductSupplierDensity::getSupplierName, supplierDensity.getSupplierName()));
-// if (count > 0){
-// throw new BaseException("璇ヤ骇鍝佸凡缁戝畾杩囪鍘傚");
-// }
baseMapper.updateById(supplierDensity);
}
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java
deleted file mode 100644
index 5ab1ed5..0000000
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.mapper.StandardMethodListMapper;
-import com.ruoyi.basic.mapper.StandardProductListMapper;
-import com.ruoyi.basic.pojo.StandardMethodList;
-import com.ruoyi.basic.pojo.StandardProductList;
-import com.ruoyi.basic.service.StandardMethodListService;
-import lombok.AllArgsConstructor;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
-* @author Administrator
-* @description 閽堝琛ㄣ�恠tandard_method_list(鏍囧噯鏍戜笅鐨勬爣鍑嗗垪琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
-* @createDate 2024-03-04 13:44:04
-*/
-@Service
-@AllArgsConstructor
-public class StandardMethodListServiceImpl extends ServiceImpl<StandardMethodListMapper, StandardMethodList>
- implements StandardMethodListService{
-
- private StandardMethodListMapper standardMethodListMapper;
-
- private StandardProductListMapper standardProductListMapper;
-
- @Override
- public int addStandardMethodList(Integer standardId, String tree) {
- String[] trees = tree.split(" - ");
- Map<String, String> map = standardMethodListMapper.selectStandardMethodById(standardId);
- StandardMethodList list = new StandardMethodList();
- list.setCode(map.get("code"));
- list.setName(map.get("name"));
- list.setRemark(map.get("remark"));
- list.setFactory(trees[0]);
- try {
- list.setLaboratory(trees[1]);
- }catch (Exception e){}
- try {
- list.setSampleType(trees[2]);
- }catch (Exception e){}
- try {
- list.setSample(trees[3]);
- }catch (Exception e){}
- try {
- list.setModel(trees[4]);
- }catch (Exception e){}
- standardMethodListMapper.insert(list);
- List<StandardProductList> standardProductLists = standardMethodListMapper.selectParameterList(list.getCode());
- for (StandardProductList standardProductList : standardProductLists) {
- standardProductList.setStandardMethodListId(list.getId());
- standardProductList.setFactory(trees[0]);
- try {
- standardProductList.setLaboratory(trees[1]);
- }catch (Exception e){}
- try {
- standardProductList.setSampleType(trees[2]);
- }catch (Exception e){}
- try {
- standardProductList.setSample(trees[3]);
- }catch (Exception e){}
- try {
- standardProductList.setModel(trees[4]);
- }catch (Exception e){}
- standardProductListMapper.insert(standardProductList);
- }
- return 1;
- }
-
- @Override
- public Map<String, List<?>> selectsStandardMethodByFLSSM(String tree) {
- String[] trees = tree.split(" - ");
- Map<String, List<?>> map = new HashMap<>();
- String str = "";
- List<StandardMethodList> standardMethodLists = new ArrayList<>();
- switch (trees.length){
- case 5:
- str += "\"" + trees[2] + "\",\"" + trees[3] + "\",\"" + trees[4] + "\"";
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\",\"" + trees[3] + "\""));
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\""));
- break;
- case 4:
- str += "\"" + trees[2] + "\",\"" + trees[3] + "\"";
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\""));
- break;
- case 3:
- str += "\"" + trees[2] + "\"";
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists3(str));
- break;
- default:
- map.put("standardMethodList", null);
- return map;
- }
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodListsByNull(str));
- map.put("standardMethodList", standardMethodLists);
- return map;
- }
-
- @Override
- public Map<String, List<?>> selectsStandardMethodByFLSSM2(String tree) {
- String[] trees = tree.split(" - ");
- List<StandardMethodList> standardMethodLists = null;
- switch (trees.length){
- case 5:
- standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],trees[4]);
- break;
- case 4:
- standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],null);
- break;
- case 3:
- standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],null,null);
- break;
- case 2:
- standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],null,null,null);
- break;
- case 1:
- standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],null,null,null,null);
- break;
- }
- Map<String, List<?>> map = new HashMap<>();
- map.put("standardMethodList", standardMethodLists);
- return map;
- }
-
- @Override
- public int delStandardMethodByFLSSM(Integer id) {
- standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id));
- return standardMethodListMapper.deleteById(id);
- }
- @Override
- public List<StandardMethodList> selectStandardMethodEnum() {
- return standardMethodListMapper.selectListEnum();
- }
-
- @Override
- public Integer getStandardMethodId(String code) {
- return baseMapper.getStandardMethodId(code);
- }
-}
-
-
-
-
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java
index 44566bd..f14bb35 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java
@@ -7,22 +7,39 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.pojo.StandardMethodList;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.StandardMethodMapper;
import com.ruoyi.basic.mapper.StandardProductListMapper;
import com.ruoyi.basic.mapper.StructureItemParameterMapper;
+import com.ruoyi.basic.mapper.StandardMethodIndustryMapper;
+import com.ruoyi.basic.mapper.StandardMethodAttachmentMapper;
+import com.ruoyi.basic.mapper.LaboratoryMapper;
+import com.ruoyi.basic.mapper.StandardTreeMapper;
+import com.ruoyi.basic.mapper.StandardTreeTemplateBindingMapper;
import com.ruoyi.basic.pojo.StandardMethod;
+import com.ruoyi.basic.pojo.StandardMethodIndustry;
+import com.ruoyi.basic.pojo.StandardMethodAttachment;
+import com.ruoyi.basic.pojo.Laboratory;
+import com.ruoyi.basic.pojo.StandardTree;
+import com.ruoyi.basic.pojo.StandardTreeTemplateBinding;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.service.StandardMethodService;
import com.ruoyi.basic.service.StandardProductListService;
import com.ruoyi.basic.service.StructureItemParameterService;
-import lombok.AllArgsConstructor;
+import com.ruoyi.basic.utils.StandardTreePath;
+import com.ruoyi.basic.utils.StandardTreePathParser;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
+import com.ruoyi.common.exception.base.BaseException;
+import java.io.File;
import java.io.IOException;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
@@ -32,22 +49,63 @@
* @createDate 2024-03-03 19:21:41
*/
@Service
-@AllArgsConstructor
public class StandardMethodServiceImpl extends ServiceImpl<StandardMethodMapper, StandardMethod>
implements StandardMethodService {
private StandardMethodMapper standardMethodMapper;
- StandardProductListMapper standardProductListMapper;
- StandardProductListService standardProductListService;
+ private StandardProductListMapper standardProductListMapper;
+ private StandardProductListService standardProductListService;
- StructureItemParameterMapper structureItemParameterMapper;
- StructureItemParameterService structureItemParameterService;
+ private StructureItemParameterMapper structureItemParameterMapper;
+ private StructureItemParameterService structureItemParameterService;
+
+ private StandardMethodIndustryMapper standardMethodIndustryMapper;
+ private StandardMethodAttachmentMapper standardMethodAttachmentMapper;
+ private LaboratoryMapper laboratoryMapper;
+ private StandardTreeMapper standardTreeMapper;
+ private StandardTreeTemplateBindingMapper standardTreeTemplateBindingMapper;
+
+ @Value("${file.path}")
+ private String filePath;
+
+ @Value("${wordUrl}")
+ private String wordUrl;
+
+ /**
+ * 涓氬姟渚濊禆鐢辨瀯閫犲櫒娉ㄥ叆锛涙枃浠惰矾寰勭敱 @Value 浠庨厤缃鍙栵紝涓嶈兘鍙備笌 Lombok 鐨勫叏鍙傛瀯閫犲櫒锛�
+ * 鍚﹀垯 Spring 浼氭妸 String 璇涓洪渶瑕佹敞鍏ョ殑 Bean銆�
+ */
+ public StandardMethodServiceImpl(StandardMethodMapper standardMethodMapper,
+ StandardProductListMapper standardProductListMapper,
+ StandardProductListService standardProductListService,
+ StructureItemParameterMapper structureItemParameterMapper,
+ StructureItemParameterService structureItemParameterService,
+ StandardMethodIndustryMapper standardMethodIndustryMapper,
+ StandardMethodAttachmentMapper standardMethodAttachmentMapper,
+ LaboratoryMapper laboratoryMapper,
+ StandardTreeMapper standardTreeMapper,
+ StandardTreeTemplateBindingMapper standardTreeTemplateBindingMapper) {
+ this.standardMethodMapper = standardMethodMapper;
+ this.standardProductListMapper = standardProductListMapper;
+ this.standardProductListService = standardProductListService;
+ this.structureItemParameterMapper = structureItemParameterMapper;
+ this.structureItemParameterService = structureItemParameterService;
+ this.standardMethodIndustryMapper = standardMethodIndustryMapper;
+ this.standardMethodAttachmentMapper = standardMethodAttachmentMapper;
+ this.laboratoryMapper = laboratoryMapper;
+ this.standardTreeMapper = standardTreeMapper;
+ this.standardTreeTemplateBindingMapper = standardTreeTemplateBindingMapper;
+ }
@Override
public IPage<StandardMethod> selectStandardMethodList(Page page, StandardMethod standardMethod) {
- return standardMethodMapper.selectStandardMethodList(page, QueryWrappers.queryWrappers(standardMethod));
+ IPage<StandardMethod> result = standardMethodMapper.selectStandardMethodList(page, QueryWrappers.queryWrappers(standardMethod));
+ for (StandardMethod method : result.getRecords()) {
+ method.setIndustryIds(selectIndustryIds(method.getId()));
+ }
+ return result;
}
@Override
@@ -56,25 +114,169 @@
}
@Override
- public int addStandardMethod(StandardMethod standardMethod) {
- int insert = standardMethodMapper.insert(standardMethod);
- return insert;
+ @Transactional(rollbackFor = Exception.class)
+ public Integer addStandardMethod(StandardMethod standardMethod) {
+ standardMethod.setStructureTestObjectId(null);
+ standardMethodMapper.insert(standardMethod);
+ syncIndustries(standardMethod, Collections.<Integer>emptySet());
+ return standardMethod.getId();
}
@Override
+ @Transactional(rollbackFor = Exception.class)
public int delStandardMethod(Integer id) {
- int i = standardMethodMapper.deleteById(id);
- return i;
+ StandardMethod method = standardMethodMapper.selectById(id);
+ if (method == null) {
+ throw new BaseException("鏍囧噯涓嶅瓨鍦�");
+ }
+ for (Integer industryId : selectIndustryIds(id)) {
+ removeIndustryTree(method, industryId);
+ }
+ standardMethodIndustryMapper.delete(Wrappers.<StandardMethodIndustry>lambdaQuery()
+ .eq(StandardMethodIndustry::getStandardMethodId, id));
+ standardMethodAttachmentMapper.delete(Wrappers.<StandardMethodAttachment>lambdaQuery()
+ .eq(StandardMethodAttachment::getStandardMethodId, id));
+ return standardMethodMapper.deleteById(id);
}
@Override
+ @Transactional(rollbackFor = Exception.class)
public int upStandardMethod(StandardMethod standardMethod) {
StandardMethod oldStandardMethod = standardMethodMapper.selectById(standardMethod.getId());
+ if (oldStandardMethod == null) {
+ throw new BaseException("鏍囧噯涓嶅瓨鍦�");
+ }
if (!oldStandardMethod.getCode().equals(standardMethod.getCode())) {
CompletableFuture.supplyAsync(() -> replaceMethod(oldStandardMethod.getCode(), standardMethod.getCode()));
}
int i = standardMethodMapper.updateById(standardMethod);
+ syncIndustries(standardMethod, new LinkedHashSet<>(selectIndustryIds(oldStandardMethod.getId())));
return i;
+ }
+
+ private List<Integer> selectIndustryIds(Integer methodId) {
+ List<StandardMethodIndustry> list = standardMethodIndustryMapper.selectList(
+ Wrappers.<StandardMethodIndustry>lambdaQuery()
+ .eq(StandardMethodIndustry::getStandardMethodId, methodId));
+ List<Integer> ids = new ArrayList<>();
+ for (StandardMethodIndustry item : list) {
+ ids.add(item.getIndustryId());
+ }
+ return ids;
+ }
+
+ private void syncIndustries(StandardMethod method, Set<Integer> oldIds) {
+ Set<Integer> newIds = method.getIndustryIds() == null ? new LinkedHashSet<Integer>()
+ : new LinkedHashSet<>(method.getIndustryIds());
+ for (Integer industryId : newIds) {
+ if (industryId == null || laboratoryMapper.selectById(industryId) == null) {
+ throw new BaseException("琛屼笟涓嶅瓨鍦�");
+ }
+ }
+ for (Integer oldId : oldIds) {
+ if (!newIds.contains(oldId)) {
+ removeIndustryTree(method, oldId);
+ standardMethodIndustryMapper.delete(Wrappers.<StandardMethodIndustry>lambdaQuery()
+ .eq(StandardMethodIndustry::getStandardMethodId, method.getId())
+ .eq(StandardMethodIndustry::getIndustryId, oldId));
+ }
+ }
+ for (Integer industryId : newIds) {
+ Laboratory lab = laboratoryMapper.selectById(industryId);
+ Long count = standardMethodIndustryMapper.selectCount(Wrappers.<StandardMethodIndustry>lambdaQuery()
+ .eq(StandardMethodIndustry::getStandardMethodId, method.getId())
+ .eq(StandardMethodIndustry::getIndustryId, industryId));
+ if (count == 0) {
+ StandardMethodIndustry relation = new StandardMethodIndustry();
+ relation.setStandardMethodId(method.getId());
+ relation.setIndustryId(industryId);
+ standardMethodIndustryMapper.insert(relation);
+ }
+ StandardTree tree = standardTreeMapper.selectOne(Wrappers.<StandardTree>lambdaQuery()
+ .eq(StandardTree::getLaboratory, lab.getLaboratoryName())
+ .eq(StandardTree::getStandardMethodId, method.getId())
+ .isNull(StandardTree::getSampleType).isNull(StandardTree::getModel));
+ if (tree == null) {
+ tree = new StandardTree();
+ tree.setLaboratory(lab.getLaboratoryName());
+ tree.setSample(buildLabel(method));
+ tree.setStandardMethodId(method.getId());
+ tree.setSort(0);
+ standardTreeMapper.insert(tree);
+ } else if (!buildLabel(method).equals(tree.getSample())) {
+ StandardTree update = new StandardTree();
+ update.setId(tree.getId());
+ update.setSample(buildLabel(method));
+ standardTreeMapper.updateById(update);
+ }
+ }
+ }
+
+ private void removeIndustryTree(StandardMethod method, Integer industryId) {
+ Laboratory lab = laboratoryMapper.selectById(industryId);
+ if (lab == null) return;
+ StandardTree tree = standardTreeMapper.selectOne(Wrappers.<StandardTree>lambdaQuery()
+ .eq(StandardTree::getLaboratory, lab.getLaboratoryName())
+ .eq(StandardTree::getStandardMethodId, method.getId())
+ .isNull(StandardTree::getSampleType).isNull(StandardTree::getModel));
+ if (tree != null) {
+ standardTreeTemplateBindingMapper.delete(Wrappers.<StandardTreeTemplateBinding>lambdaQuery()
+ .eq(StandardTreeTemplateBinding::getStandardTreeId, tree.getId()));
+ standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaQuery()
+ .eq(StandardProductList::getLaboratory, lab.getLaboratoryName())
+ .eq(StandardProductList::getSample, tree.getSample())
+ .isNull(StandardProductList::getSampleType).isNull(StandardProductList::getModel));
+ standardTreeMapper.deleteById(tree.getId());
+ }
+ }
+
+ private String buildLabel(StandardMethod method) {
+ return method.getCode().trim();
+ }
+
+ @Override
+ public List<StandardMethodAttachment> selectAttachments(Integer standardMethodId) {
+ return standardMethodAttachmentMapper.selectList(Wrappers.<StandardMethodAttachment>lambdaQuery()
+ .eq(StandardMethodAttachment::getStandardMethodId, standardMethodId)
+ .orderByAsc(StandardMethodAttachment::getSort, StandardMethodAttachment::getId));
+ }
+
+ @Override
+ public StandardMethodAttachment uploadAttachment(Integer standardMethodId, MultipartFile file) {
+ if (standardMethodMapper.selectById(standardMethodId) == null) throw new BaseException("鏍囧噯涓嶅瓨鍦�");
+ if (file == null || file.isEmpty() || file.getSize() > 200L * 1024 * 1024)
+ throw new BaseException("闄勪欢涓嶈兘涓虹┖涓斾笉鑳借秴杩�200MB");
+ String originalName = file.getOriginalFilename();
+ if (originalName == null || !originalName.matches("(?i).+\\.(jpg|jpeg|png|gif|doc|docx|xls|xlsx|ppt|pptx|pdf|zip|rar)$"))
+ throw new BaseException("涓嶆敮鎸佺殑闄勪欢鏍煎紡");
+ try {
+ boolean image = originalName.matches("(?i).+\\.(jpg|jpeg|png|gif)$");
+ File directory = new File(image ? filePath : wordUrl);
+ if (!directory.exists()) directory.mkdirs();
+ String fileUrl = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmssSSS")) + "-" + originalName;
+ file.transferTo(new File(directory, fileUrl));
+ StandardMethodAttachment attachment = new StandardMethodAttachment();
+ attachment.setStandardMethodId(standardMethodId);
+ attachment.setFileName(originalName);
+ attachment.setFileUrl(fileUrl);
+ attachment.setSort(selectAttachments(standardMethodId).size());
+ standardMethodAttachmentMapper.insert(attachment);
+ return attachment;
+ } catch (IOException e) {
+ throw new BaseException("闄勪欢涓婁紶澶辫触");
+ }
+ }
+
+ @Override
+ public boolean deleteAttachment(Long id) {
+ return standardMethodAttachmentMapper.deleteById(id) > 0;
+ }
+
+ @Override
+ public List<Laboratory> selectIndustryOptions() {
+ return laboratoryMapper.selectList(Wrappers.<Laboratory>lambdaQuery()
+ .select(Laboratory::getId, Laboratory::getLaboratoryName, Laboratory::getSort)
+ .orderByAsc(Laboratory::getSort, Laboratory::getId));
}
//缂栬緫method鍚庡叏閮ㄦ浛鎹�
@@ -128,26 +330,6 @@
return "鏇挎崲瀹屾瘯!";
}
- @Transactional(rollbackFor = Exception.class)
- @Override
- public void inputExcel(MultipartFile file) throws IOException {
- // 瀛樺偍妫�娴嬪璞ist
- List<Object> structureTestObjectIdList = new ArrayList<>();
- List<StandardMethod> result = new ArrayList<>();
- ExcelUtil.readBySax(file.getInputStream(), 0, (i, l, list) -> {
- // 鍘婚櫎绗竴琛岃〃澶�
- if (l == 0) {
- return;
- }
- // 瀛樺偍鍞竴妫�娴嬪璞�
- if (!structureTestObjectIdList.contains(list.get(2))) {
- structureTestObjectIdList.add(list.get(2));
- }
- StandardMethod standardMethod = formatData(list);
- result.add(standardMethod);
- });
- addStructureTest(structureTestObjectIdList, result);
- }
// 鏍煎紡鍖栨暟鎹�
public StandardMethod formatData(List<Object> list) {
@@ -185,76 +367,30 @@
return standardMethod;
}
- // 鏂板鏁版嵁
- public void addStructureTest(List<Object> structureTestObjectIdList, List<StandardMethod> standardMethodList) {
- List<StandardMethod> updateList = new ArrayList<>();
- List<Integer> deleteListId = new ArrayList<>();
- List<StandardMethod> addList = new ArrayList<>();
- if (!structureTestObjectIdList.isEmpty()) {
- // 寰幆excel閲岄潰鐨勫垎缁�
- structureTestObjectIdList.forEach(j -> {
- // 浠xcel涓殑缁勫悕鏌ヨ鏁版嵁搴撲腑鐨勫垎缁�
- List<StandardMethod> standardMethods = baseMapper.selectList(Wrappers.<StandardMethod>lambdaQuery()
- .like(StandardMethod::getStructureTestObjectId, "\"" + j + "\""));
- // 灏嗙粨鏋滃惊鐜尮閰�
- for (int i = 0; i < standardMethods.size(); i++) {
- boolean isExistence = false;
- for (int i1 = 0; i1 < standardMethodList.size(); i1++) {
- // 鏇存柊
- if (standardMethods.get(i).getStructureTestObjectId().equals(standardMethodList.get(i1).getStructureTestObjectId())
- && standardMethods.get(i).getCode().equals(standardMethodList.get(i1).getCode())
- && standardMethods.get(i).getField().equals(standardMethodList.get(i1).getField())) {
- // 缁檈xcel鏁版嵁璧嬪�糹d鍋氭洿鏂�
- standardMethodList.get(i1).setId(standardMethods.get(i).getId());
- // 鏇存柊
- updateList.add(standardMethodList.get(i1));
- isExistence = true;
- break;
- }
- }
- // 鍒犻櫎
- if (!isExistence) {
- deleteListId.add(standardMethods.get(i).getId());
- }
- }
- for (int i = 0; i < standardMethodList.size(); i++) {
- if (standardMethodList.get(i).getStructureTestObjectId().contains("\"" + j + "\"")) {
- boolean isExistence = false;
- for (int i1 = 0; i1 < standardMethods.size(); i1++) {
- if (standardMethods.get(i1).getStructureTestObjectId().equals(standardMethodList.get(i).getStructureTestObjectId())
- && standardMethods.get(i1).getCode().equals(standardMethodList.get(i).getCode())
- && standardMethods.get(i1).getField().equals(standardMethodList.get(i).getField())) {
- isExistence = true;
- break;
- }
- }
- // 鏂板
- if (!isExistence) {
- addList.add(standardMethodList.get(i));
- }
- }
- }
- });
+ @Override
+ public Map<String, List<?>> selectsStandardMethodByFLSSM(String tree) {
+ if (tree == null || tree.trim().isEmpty()) {
+ return Collections.emptyMap();
}
- if (!addList.isEmpty()) {
- // 鏂板
- baseMapper.insertBatchSomeColumn(addList);
+ StandardTreePath path = StandardTreePathParser.parse(tree);
+ String industry = path.getIndustry();
+ List<StandardMethodList> standardMethodLists = new ArrayList<>(standardMethodMapper.selectStandardMethodListsByIndustry(industry));
+ // 鎸� ID 鍘婚噸锛屼繚鎸佺ǔ瀹氭帓搴�
+ Map<Integer, StandardMethodList> byId = new LinkedHashMap<>();
+ for (StandardMethodList m : standardMethodLists) {
+ byId.putIfAbsent(m.getId(), m);
}
-
- if (!deleteListId.isEmpty()) {
- // 鍒犻櫎
- baseMapper.deleteBatchIds(deleteListId);
- }
-
- if (!updateList.isEmpty()) {
- // 鏇存柊
- updateList.forEach(i -> {
- baseMapper.updateById(i);
- });
- }
+ Map<String, List<?>> map = new HashMap<>();
+ map.put("standardMethodList", new ArrayList<>(byId.values()));
+ return map;
}
-}
+ @Override
+ public List<StandardMethodList> selectStandardMethodEnum() {
+ return standardMethodMapper.selectListEnum();
+ }
+
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListService2Impl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListService2Impl.java
deleted file mode 100644
index eae1bc2..0000000
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListService2Impl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.mapper.StandardProductListMapper;
-import com.ruoyi.basic.pojo.StandardProductList;
-import com.ruoyi.basic.service.StandardProductListService2;
-import org.springframework.stereotype.Service;
-
-@Service
-public class StandardProductListService2Impl extends ServiceImpl<StandardProductListMapper, StandardProductList>
- implements StandardProductListService2 {
-}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
index 3049df0..356fe9a 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
@@ -1,7 +1,6 @@
package com.ruoyi.basic.service.impl;
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,7 +9,6 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.basic.dto.CopyStandardProductListDto;
import com.ruoyi.basic.dto.InsSampleReceiveDto;
-import com.ruoyi.basic.dto.ProductDto;
import com.ruoyi.basic.dto.ResetTreeDragDTO;
import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
import com.ruoyi.basic.mapper.StandardProductListMapper;
@@ -18,9 +16,9 @@
import com.ruoyi.basic.mapper.StandardTreeMapper;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StandardProductListSupplierAsk;
-import com.ruoyi.basic.pojo.StandardTree;
import com.ruoyi.basic.service.StandardProductListService;
-import com.ruoyi.basic.service.StandardProductListService2;
+import com.ruoyi.basic.utils.StandardTreePath;
+import com.ruoyi.basic.utils.StandardTreePathParser;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -45,8 +43,6 @@
private StandardTreeMapper standardTreeMapper;
- private StandardProductListService2 standardProductListService2;
-
private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
private StandardProductListSupplierAskMapper standardProductListSupplierAskMapper;
@@ -57,20 +53,39 @@
return standardProductListMapper.updateById(list);
}
- @Override
- public int delStandardProduct(JSONArray list) {
- return standardProductListMapper.deleteBatchIds(list);
- }
@Override
public List<StandardProductList> selectStandardProductList(InsSampleReceiveDto insSample) {
- // 鏄惁娌℃湁浜у搧
+ if (insSample == null || insSample.getStandardMethodListId() == null) {
+ throw new BaseException("妫�楠屾爣鍑嗕笉鑳戒负绌�");
+ }
+ // 鏂扮枂鏂拌仛涓ょ骇鏍戜紭鍏堟寜鈥滆涓� + 鏍囧噯鈥濊鑼冭矾寰勬煡璇紱鏃犳硶瑙f瀽鏃朵繚鐣欏巻鍙蹭簲绾ч�昏緫銆�
+ boolean twoLevelOrder = false;
boolean isNoSample = false;
-// String[] models = insSample.getModel().split("-(?=[^-]*$)");//鎷嗗垎鏈�鍚庝竴涓��-銆�
String model = insSample.getModel();
String modelNum = insSample.getModelNum();
- List<StandardProductList> list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, model, insSample.getIsCableTag());
- if (list.size() == 0) {
+ List<StandardProductList> list = Collections.emptyList();
+ if (StringUtils.isNotBlank(insSample.getFactory())) {
+ try {
+ StandardTreePath path = StandardTreePathParser.parse(insSample.getFactory());
+ if (path.getStandard() != null) {
+ String canonicalTree = StandardTreePathParser.canonical(path.getIndustry(), path.getStandard());
+ list = standardProductListMapper.selectDetail2(
+ insSample.getStandardMethodListId(), 1, canonicalTree, insSample.getIsCableTag());
+ insSample.setLaboratory(path.getIndustry());
+ insSample.setSampleType(null);
+ insSample.setSample(path.getStandard());
+ insSample.setModel(null);
+ twoLevelOrder = true;
+ }
+ } catch (BaseException ignored) {
+ // 鍘嗗彶浜旂骇璺緞缁х画璧板師鏈夊吋瀹规煡璇€��
+ }
+ }
+ if (!twoLevelOrder) {
+ list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, model, insSample.getIsCableTag());
+ }
+ if (!twoLevelOrder && list.size() == 0) {
if (Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null) {
return null;
}
@@ -92,8 +107,8 @@
}
}
}
- String[] split1 = insSample.getFactory().split(" - ");
- if (!isNoSample) {
+ if (!twoLevelOrder && !isNoSample) {
+ String[] split1 = insSample.getFactory().split(" - ");
//鍒ゆ柇闀垮害
if (split1.length > 4) {
if (ObjectUtils.isNotEmpty(split1[3])) {
@@ -103,9 +118,14 @@
}
}
}
+ final boolean currentTwoLevelOrder = twoLevelOrder;
list = list.stream().filter(a -> {
try {
if (a.getSection() != null && !Objects.equals(a.getSection(), "")) {
+ // 涓ょ骇涓嬪崟涓嶅啀杈撳叆鍨嬪彿锛屼笉鑳藉洜鏃犳硶璁$畻鍨嬪彿鍖洪棿鑰屼涪寮冩暣涓楠岄」銆�
+ if (currentTwoLevelOrder && StringUtils.isBlank(modelNum)) {
+ return true;
+ }
List<String> sections = JSON.parseArray(a.getSection(), String.class);// 鍖洪棿
List<String> cores = JSON.parseArray(a.getCores(), String.class); // 鑺暟
List<String> conductorMaterials = JSON.parseArray(a.getConductorMaterial(), String.class); // 瀵间綋鏉愯川
@@ -139,7 +159,7 @@
}
return true;
}).peek(standardProductList -> {
- // todo: 鍒ゆ柇鏄惁鏄師鏉愪笅鍗�, 闇�瑕佸晩鎶婇鑹茬粦瀹氬埌璇曟牱棰滆壊鐨勮姹傚�间笂
+ //鍒ゆ柇鏄惁鏄師鏉愪笅鍗�, 闇�瑕佸晩鎶婇鑹茬粦瀹氬埌璇曟牱棰滆壊鐨勮姹傚�间笂
if (StringUtils.isNotBlank(insSample.getPartNo())) {
// 鍒ゆ柇鏄惁鏈夎繖涓瓧娈典笖鏄枃鏈被鍨�
if (StringUtils.isNotBlank(standardProductList.getInspectionItem())
@@ -263,243 +283,151 @@
@Override
@Transactional(rollbackFor = Exception.class)
- public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page) {
- String[] trees = tree.split(" - ");
- try {
- String tree1 = trees[2];
- } catch (Exception e) {
- throw new BaseException("鎿嶄綔澶揩,绯荤粺浼犲弬閿欒!!!!");
+ public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page, String keyword) {
+ if (id == null) {
+ throw new BaseException("妫�楠屾爣鍑嗕笉鑳戒负绌�");
}
- boolean isDrag = false;
- List<StandardProductList> list = new ArrayList<>();
- if (trees.length == 3) {
- List<StandardTree> treeList = new ArrayList<>();
- StandardTree standardTree = new StandardTree();
- standardTree.setFactory(trees[0]);
- standardTree.setLaboratory(trees[1]);
- standardTree.setSampleType(trees[2]);
- List<ProductDto> pList = standardTreeMapper.selectPList(trees[2]);
- if (pList.size() == 0 || pList.get(0) == null) {
- List<StandardTree> treeList1 = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]));
- if (treeList1.size() == 0) {
- treeList.add(standardTree);
- } else {
- treeList.addAll(treeList1);
- }
- } else {
- for (ProductDto p : pList) {
- standardTree.setSample(p.getName());
- List<StandardTree> treeList1 = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, p.getName()));
- if (treeList1.size() == 0) {
- treeList.add(JSON.parseObject(JSON.toJSONString(standardTree), StandardTree.class));
- } else {
- treeList.addAll(treeList1);
- }
- }
- }
- for (StandardTree standardTree2 : treeList) {
- String tree2 = trees[0] + " - " + trees[1] + " - " + trees[2] + " - " + standardTree2.getSample() + " - " + standardTree2.getModel();
- list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
- list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + standardTree2.getSample() + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
- }
- } else if (trees.length == 4) {
- // 鍒ゆ柇绗洓灞傛槸鍚︽湁鍨嬪彿
- Long count = standardProductListMapper.selectCount(Wrappers.<StandardProductList>lambdaQuery()
- .eq(StandardProductList::getStandardMethodListId, id)
- .isNull(StandardProductList::getModel)
- .like(StandardProductList::getTree, tree));
- if (count == 0) {
- isDrag = true;
- }
-
- isDrag = true;
- List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
- if (treeList.size() == 0) {
- StandardTree standardTree = new StandardTree();
- standardTree.setFactory(trees[0]);
- standardTree.setLaboratory(trees[1]);
- standardTree.setSampleType(trees[2]);
- standardTree.setSample(trees[3]);
- treeList.add(standardTree);
- }
- for (StandardTree standardTree : treeList) {
- String str = tree + " - " + standardTree.getModel();
- list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
- list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
- }
- } else {
- isDrag = true;
- list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
- list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
+ StandardTreePath path = StandardTreePathParser.parse(tree);
+ if (path.getStandard() == null) {
+ throw new BaseException("璇烽�夋嫨鏍囧噯鑺傜偣");
}
- for (StandardProductList productList : list) {
- productList.setId(IdWorker.getId());
- }
- List<StandardProductList> standardProductLists;
-
- if (isDrag) {
- standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
- .eq(StandardProductList::getStandardMethodListId, id)
- .like(StandardProductList::getTree, tree)
- .orderByAsc(StandardProductList::getSort));
- // 鍒ゆ柇鏄惁鏈夋病鏈夊簭鍙风殑, 娌℃湁搴忓彿閲嶇疆
- boolean b = standardProductLists.stream().anyMatch(standardProductList -> standardProductList.getSort() == null);
- } else {
- standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
- .eq(StandardProductList::getStandardMethodListId, id)
- .like(StandardProductList::getTree, tree));
- }
-
- for (StandardProductList sp : standardProductLists) {
- for (StandardProductList pl : list) {
- // 鍒ゆ柇鏉′欢鏄惁鍙湁涓�涓�, 鏈変竴涓殑璇濋粯璁ょ涓�涓�
- String radiusList = pl.getRadiusList();
- if (StringUtils.isNotBlank(radiusList) && !radiusList.equals("null") && !radiusList.equals("\"\"")) {
- JSONArray jsonArray = JSON.parseArray(radiusList);
- List<String> radius = jsonArray.toJavaList(String.class);
- if (CollectionUtils.isNotEmpty(radius) && radius.size() == 1) {
- pl.setRadius(radius.get(0));
- }
- }
- if (Objects.equals(sp.getInspectionItem(), pl.getInspectionItem())
- && Objects.equals((sp.getInspectionItemSubclass() == null) ? "" : sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass() == null ? "" : pl.getInspectionItemSubclass())
-// && Objects.equals(sp.getSample(), pl.getSample())
- && Objects.equals(sp.getModel(), pl.getModel())
- && sp.getTree().indexOf(pl.getSample() == null ? "null" : pl.getSample()) > -1
- && Objects.equals(sp.getStructureItemParameterId(), pl.getStructureItemParameterId())) {
- pl.setId(sp.getId());
- // 娣诲姞鎺掑簭瀛楁
- pl.setSort(sp.getSort());
- if (sp.getState() != null && !sp.getState().equals("")) {
- pl.setState(sp.getState());
- } else {
- pl.setState(id == 0 ? 1 : 0);
- }
- if (sp.getMethodS() != null && !sp.getMethodS().equals("")) {
- pl.setMethod(sp.getMethodS());
- }
- if (sp.getRadius() != null && !sp.getRadius().equals("")) {
- pl.setRadius(sp.getRadius());
- }
- if (sp.getRates() != null && !sp.getRates().equals("")) {
- pl.setRates(sp.getRates());
- }
- if (sp.getAsk() != null && !sp.getAsk().equals("")) {
- pl.setAsk(sp.getAsk());
- }
- if (sp.getTell() != null && !sp.getTell().equals("")) {
- pl.setTell(sp.getTell());
- }
- if (sp.getPrice() != null && !sp.getPrice().equals("")) {
- pl.setPrice(sp.getPrice());
- }
- if (sp.getManHour() != null && !sp.getManHour().equals("")) {
- pl.setManHour(sp.getManHour());
- }
- if (sp.getSection() != null && !sp.getSection().equals("")) {
- pl.setSection(sp.getSection());
- }
- if (sp.getCores() != null && !sp.getCores().equals("")) {
- pl.setCores(sp.getCores());
- }
- if (sp.getConductorMaterial() != null && !sp.getConductorMaterial().equals("")) {
- pl.setConductorMaterial(sp.getConductorMaterial());
- }
- if (sp.getConductorType() != null && !sp.getConductorType().equals("")) {
- pl.setConductorType(sp.getConductorType());
- }
- if (sp.getTemplateId() != null && !sp.getTemplateId().equals("")) {
- pl.setTemplateId(sp.getTemplateId());
- }
- //鍥犱负杩樻湁涓骇鍝佸彨鑰愬紶绾垮す 鎺ョ画閲戝叿 ,杩欎袱涓」鐩殑鏁版嵁瀹屽叏涓�鏍�,鐗规畩澶勭悊
- if (sp.getTree() != null && !sp.getTree().equals("") && !pl.getTree().equals("涓ぉ绉戞妧妫�娴嬩腑蹇� - 鐢靛姏浜у搧瀹為獙瀹� - 閲戝叿 - 鑰愬紶绾垮す - null")) {
- pl.setTree(sp.getTree());
- }
- break;
- }
- }
- }
- if (page == 1) {
- Integer userId = SecurityUtils.getUserId().intValue();
-// CompletableFuture.supplyAsync(() -> {
- if (trees.length == 5) {
- standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate()
+ String canonicalTree = StandardTreePathParser.canonical(path.getIndustry(), path.getStandard());
+ List<StandardProductList> generated = standardTreeMapper.selectStandardProductListByIndustry(
+ path.getIndustry(), path.getStandard(), canonicalTree);
+ List<StandardProductList> saved = standardProductListMapper.selectList(
+ Wrappers.<StandardProductList>lambdaQuery()
.eq(StandardProductList::getStandardMethodListId, id)
- .eq(StandardProductList::getTree, tree));
- } else {
- standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate()
- .eq(StandardProductList::getStandardMethodListId, id)
- .like(StandardProductList::getTree, tree));
- }
+ .eq(StandardProductList::getTree, canonicalTree)
+ .orderByAsc(StandardProductList::getSort));
- boolean success = false;
- int retryCount = 0;
- while (!success && retryCount < 100) {
- try {
- standardProductListService2.saveBatch(list.stream().map(a -> {
- a.setFactory(trees[0]);
- a.setLaboratory(trees[1]);
- a.setSampleType(trees[2]);
- a.setCreateUser(userId);
- a.setUpdateUser(userId);
- a.setStandardMethodListId(id);
- return a;
- }).collect(Collectors.toList()));
- ;
- success = true;
- } catch (Exception e) {
- // 澶勭悊閲嶅 ID 鐨勮褰曪紝閲嶆柊鐢熸垚 ID 骞剁户缁皾璇曟彃鍏�
- for (StandardProductList productList : list) {
- productList.setId(IdWorker.getId());
- }
- }
+ Map<Integer, StandardProductList> savedByParameterId = new HashMap<>();
+ for (StandardProductList item : saved) {
+ if (item.getStructureItemParameterId() != null) {
+ savedByParameterId.put(item.getStructureItemParameterId(), item);
}
- if (!success) {
- throw new RuntimeException("鎻掑叆澶辫触");
- }
-
}
- Map<String, Object> map = new HashMap<>();
- Collections.sort(list, (o1, o2) -> {
- String field1 = o1.getManHourGroup();
- String field2 = o2.getManHourGroup();
-
- boolean isEmpty1 = field1 == null || field1.isEmpty();
- boolean isEmpty2 = field2 == null || field2.isEmpty();
-
- if (isEmpty1 && isEmpty2) {
- return 0;
- } else if (isEmpty1) {
- return 1;
- } else if (isEmpty2) {
- return -1;
+ Integer userId = SecurityUtils.getUserId().intValue();
+ for (StandardProductList item : generated) {
+ applySingleRadiusDefault(item);
+ StandardProductList old = savedByParameterId.get(item.getStructureItemParameterId());
+ if (old != null && sameInspectionItem(old, item)) {
+ mergeSavedConfiguration(old, item);
} else {
- int num1 = extractNumber(field1);
- int num2 = extractNumber(field2);
- return Integer.compare(num1, num2);
+ item.setId(IdWorker.getId());
+ item.setState(id == 0 ? 1 : 0);
}
+ item.setFactory(null);
+ item.setLaboratory(path.getIndustry());
+ item.setSampleType(null);
+ item.setSample(path.getStandard());
+ item.setModel(null);
+ item.setTree(canonicalTree);
+ item.setCreateUser(userId);
+ item.setUpdateUser(userId);
+ item.setStandardMethodListId(id);
+ }
+
+ standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaQuery()
+ .eq(StandardProductList::getStandardMethodListId, id)
+ .eq(StandardProductList::getTree, canonicalTree));
+ if (CollectionUtils.isNotEmpty(generated)) {
+ baseMapper.saveBatchProductLists(generated);
+ }
+
+ generated.sort((left, right) -> {
+ int leftSort = left.getSort() == null ? Integer.MAX_VALUE : left.getSort();
+ int rightSort = right.getSort() == null ? Integer.MAX_VALUE : right.getSort();
+ if (leftSort != rightSort) {
+ return Integer.compare(leftSort, rightSort);
+ }
+ return compareManHourGroup(left.getManHourGroup(), right.getManHourGroup());
});
- // 鎸夌収绱㈠紩鎺掑簭
- if (isDrag) {
- list.sort((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort())
- - (o2.getSort() == null ? 0 : o2.getSort()));
- }
- try {
- map.put("productList", list.subList((page - 1) * 300, page * 300));
- } catch (IndexOutOfBoundsException e) {
- map.put("productList", list.subList((page - 1) * 300, list.size()));
- }
- map.put("total", list.size());
+
+ String search = keyword == null ? "" : keyword.trim().toLowerCase(Locale.ROOT);
+ List<StandardProductList> filtered = generated.stream()
+ .filter(item -> search.isEmpty()
+ || containsIgnoreCase(item.getInspectionItem(), search)
+ || containsIgnoreCase(item.getInspectionItemSubclass(), search))
+ .collect(Collectors.toList());
+ int total = filtered.size();
+ int currentPage = page == null || page < 1 ? 1 : page;
+ int fromIndex = Math.min((currentPage - 1) * 100, total);
+ int toIndex = Math.min(fromIndex + 100, total);
+
+ Map<String, Object> map = new HashMap<>();
+ map.put("productList", new ArrayList<>(filtered.subList(fromIndex, toIndex)));
+ map.put("total", total);
return map;
}
- private int extractNumber(String s) {
- // 浠庡瓧绗︿覆涓彁鍙栨暟瀛楃殑閫昏緫锛岃繖閲屽亣璁惧瓧娈电殑鏍煎紡鏄� "text<number>"
- String number = s;
- if (!s.matches("\\d+")) {
- number = s.replaceAll("\\D", "");
+ private boolean sameInspectionItem(StandardProductList left, StandardProductList right) {
+ return Objects.equals(left.getInspectionItem(), right.getInspectionItem())
+ && Objects.equals(defaultString(left.getInspectionItemSubclass()), defaultString(right.getInspectionItemSubclass()));
+ }
+
+ private void applySingleRadiusDefault(StandardProductList item) {
+ String radiusList = item.getRadiusList();
+ if (StringUtils.isBlank(radiusList) || "null".equals(radiusList) || "\"\"".equals(radiusList)) {
+ return;
}
- return Integer.parseInt(number);
+ try {
+ List<String> values = JSON.parseArray(radiusList, String.class);
+ if (values != null && values.size() == 1) {
+ item.setRadius(values.get(0));
+ }
+ } catch (Exception ignored) {
+ // 鍘嗗彶鑴忔暟鎹笉褰卞搷妫�楠岄」鍒楄〃鐢熸垚銆�
+ }
+ }
+
+ private void mergeSavedConfiguration(StandardProductList old, StandardProductList target) {
+ target.setId(old.getId());
+ target.setSort(old.getSort());
+ target.setState(old.getState() == null ? 0 : old.getState());
+ if (StringUtils.isNotBlank(old.getMethodS())) {
+ target.setMethodS(old.getMethodS());
+ target.setMethod(old.getMethodS());
+ }
+ if (StringUtils.isNotBlank(old.getRadius())) target.setRadius(old.getRadius());
+ if (StringUtils.isNotBlank(old.getRates())) target.setRates(old.getRates());
+ if (StringUtils.isNotBlank(old.getAsk())) target.setAsk(old.getAsk());
+ if (StringUtils.isNotBlank(old.getTell())) target.setTell(old.getTell());
+ if (StringUtils.isNotBlank(old.getPrice())) target.setPrice(old.getPrice());
+ if (StringUtils.isNotBlank(old.getManHour())) target.setManHour(old.getManHour());
+ if (StringUtils.isNotBlank(old.getSection())) target.setSection(old.getSection());
+ if (StringUtils.isNotBlank(old.getCores())) target.setCores(old.getCores());
+ if (StringUtils.isNotBlank(old.getConductorMaterial())) target.setConductorMaterial(old.getConductorMaterial());
+ if (StringUtils.isNotBlank(old.getConductorType())) target.setConductorType(old.getConductorType());
+ if (old.getTemplateId() != null) target.setTemplateId(old.getTemplateId());
+ }
+
+ private int compareManHourGroup(String left, String right) {
+ boolean leftEmpty = StringUtils.isBlank(left);
+ boolean rightEmpty = StringUtils.isBlank(right);
+ if (leftEmpty && rightEmpty) return 0;
+ if (leftEmpty) return 1;
+ if (rightEmpty) return -1;
+ return Integer.compare(extractNumber(left), extractNumber(right));
+ }
+
+ private boolean containsIgnoreCase(String value, String search) {
+ return value != null && value.toLowerCase(Locale.ROOT).contains(search);
+ }
+
+ private String defaultString(String value) {
+ return value == null ? "" : value;
+ }
+
+ private int extractNumber(String s) {
+ String number = s == null ? "" : s.replaceAll("\\D", "");
+ if (number.isEmpty()) {
+ return Integer.MAX_VALUE;
+ }
+ try {
+ return Integer.parseInt(number);
+ } catch (NumberFormatException ignored) {
+ return Integer.MAX_VALUE;
+ }
}
@Override
@@ -583,7 +511,7 @@
@Override
public void resetTreeDragBatch(List<StandardProductList> standardProductLists) {
- standardProductListService2.updateBatchById(standardProductLists);
+ this.updateBatchById(standardProductLists);
}
/**
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java
index f1f3ba4..fcf020a 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java
@@ -6,11 +6,14 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.numgen.NumberGenerator;
-import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.StandardTemplateMapper;
+import com.ruoyi.basic.mapper.StandardTreeTemplateBindingMapper;
import com.ruoyi.basic.pojo.StandardTemplate;
+import com.ruoyi.basic.pojo.StandardTreeTemplateBinding;
import com.ruoyi.basic.service.StandardTemplateService;
+import com.ruoyi.common.numgen.NumberGenerator;
+import com.ruoyi.common.utils.GZipUtil;
+import com.ruoyi.common.utils.QueryWrappers;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
@@ -29,6 +32,8 @@
private StandardTemplateMapper standardTemplateMapper;
+ private StandardTreeTemplateBindingMapper standardTreeTemplateBindingMapper;
+
private final NumberGenerator<StandardTemplate> numberGenerator;
@@ -45,12 +50,25 @@
StandardTemplate::getNumber);
standardTemplate.setNumber(giveCode);
}
+ if (standardTemplate.getPrice() == null) {
+ standardTemplate.setPrice(java.math.BigDecimal.ZERO);
+ }
+ if (StringUtils.isNotBlank(standardTemplate.getThing())) {
+ standardTemplate.setThing(GZipUtil.compress(standardTemplate.getThing()));
+ } else {
+ standardTemplate.setThing(null);
+ }
return standardTemplateMapper.insert(standardTemplate);
}
@Override
public int upStandardTemplate(StandardTemplate standardTemplate) {
- if(standardTemplate.getThing().equals("")){
+ if (standardTemplate.getPrice() == null) {
+ standardTemplate.setPrice(java.math.BigDecimal.ZERO);
+ }
+ if (StringUtils.isNotBlank(standardTemplate.getThing())) {
+ standardTemplate.setThing(GZipUtil.compress(standardTemplate.getThing()));
+ } else {
standardTemplate.setThing(null);
}
return standardTemplateMapper.updateById(standardTemplate);
@@ -58,12 +76,23 @@
@Override
public int delStandardTemplate(Integer id) {
+ // 鍒ゆ柇鏄惁琚粦瀹�
+ int count = standardTemplateMapper.countBindTemplateItemParameter(id);
+ if (count > 0) {
+ throw new RuntimeException("璇ユā鏉垮凡缁戝畾妫�楠岄」鐩弬鏁帮紝绂佹鍒犻櫎");
+ }
+ Long bindingCount = standardTreeTemplateBindingMapper.selectCount(Wrappers.<StandardTreeTemplateBinding>lambdaQuery()
+ .eq(StandardTreeTemplateBinding::getTemplateId, id));
+ if (bindingCount > 0) {
+ throw new RuntimeException("璇ユā鏉垮凡缁戝畾鏍囧噯搴擄紝绂佹鍒犻櫎");
+ }
return standardTemplateMapper.deleteById(id);
}
@Override
public List<StandardTemplate> getStandardTemplate() {
- return standardTemplateMapper.selectList(Wrappers.<StandardTemplate>lambdaQuery().select(StandardTemplate::getId,StandardTemplate::getName));
+ return standardTemplateMapper.selectList(Wrappers.<StandardTemplate>lambdaQuery()
+ .select(StandardTemplate::getId, StandardTemplate::getName, StandardTemplate::getNumber, StandardTemplate::getRemark));
}
@Override
@@ -74,19 +103,8 @@
if(standardTemplate==null){
return null;
}else{
- return standardTemplate.getThing();
+ return GZipUtil.uncompress(standardTemplate.getThing());
}
- // 鏌ヨ鍘嬬缉鍚庣殑鏁版嵁
-// String thing = standardTemplateMapper.selectCompressThing(templateId);
-// if (StringUtils.isNotBlank(thing)) {
-// try {
-// return DecompressMySQLData.decompress(java.util.Base64.getDecoder().decode(thing));
-// } catch (Exception e) {
-// throw new RuntimeException(e);
-// }
-// } else {
-// return null;
-// }
}
@Override
@@ -116,6 +134,9 @@
// 鏌ヨ鏃фā鏉�
StandardTemplate standardTemplate = baseMapper.selectById(newTemplate.getId());
newTemplate.setThing(standardTemplate.getThing());
+ if (newTemplate.getPrice() == null) {
+ newTemplate.setPrice(java.math.BigDecimal.ZERO);
+ }
if (StringUtils.isBlank(newTemplate.getNumber())) {
String giveCode = numberGenerator.generateNumberWithPrefix(5,
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
index ba06e2b..8b5ae45 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
@@ -1,38 +1,53 @@
package com.ruoyi.basic.service.impl;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.poi.excel.ExcelUtil;
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.exception.base.BaseException;
-import com.ruoyi.basic.dto.FactoryDto;
-import com.ruoyi.basic.dto.LaboratoryDto;
+import com.ruoyi.basic.dto.AddStandardTreeNodeDto;
import com.ruoyi.basic.dto.SampleTypeDto;
+import com.ruoyi.basic.dto.StandardLibraryTreeNodeDto;
+import com.ruoyi.basic.dto.StandardLibraryTreeRowDto;
+import com.ruoyi.basic.dto.UpdateStandardTreeNodeDto;
+import com.ruoyi.basic.dto.StandardTreeTemplateBindingDto;
+import com.ruoyi.basic.dto.StandardTreeTemplateBindingVo;
+import com.ruoyi.basic.dto.TemplateBindingItemDto;
+import com.ruoyi.basic.dto.TemplateInspectionItemDto;
+import com.ruoyi.basic.mapper.LaboratoryMapper;
import com.ruoyi.basic.mapper.StandardProductListMapper;
import com.ruoyi.basic.mapper.StandardTreeMapper;
+import com.ruoyi.basic.mapper.StandardTreeTemplateBindingMapper;
+import com.ruoyi.basic.mapper.StandardTreeTemplateDeviceMapper;
+import com.ruoyi.basic.mapper.StructureItemParameterMapper;
+import com.ruoyi.basic.mapper.StructureTestObjectMapper;
+import com.ruoyi.basic.pojo.Laboratory;
import com.ruoyi.basic.pojo.StandardProductList;
-import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.pojo.StandardTree;
+import com.ruoyi.basic.pojo.StandardTemplate;
+import com.ruoyi.basic.pojo.StandardTreeTemplateBinding;
+import com.ruoyi.basic.pojo.StandardTreeTemplateDevice;
+import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.pojo.StructureTestObject;
-import com.ruoyi.basic.service.*;
+import com.ruoyi.basic.service.StandardTreeService;
+import com.ruoyi.basic.service.StandardTemplateService;
+import com.ruoyi.basic.utils.StandardTreePath;
+import com.ruoyi.basic.utils.StandardTreePathParser;
+import com.ruoyi.basic.utils.StandardTemplateInspectionItemParser;
+import com.ruoyi.common.exception.base.BaseException;
import lombok.AllArgsConstructor;
-import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.multipart.MultipartFile;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
+import java.util.Objects;
+import java.util.HashSet;
+import java.util.Comparator;
+import java.util.Set;
+import java.util.stream.Collectors;
/**
* @author Administrator
@@ -47,110 +62,161 @@
private StandardTreeMapper standardTreeMapper;
- private StandardMethodListService standardMethodListService;
-
private StandardProductListMapper standardProductListMapper;
- private StandardProductListService standardProductListService;
+ private StructureItemParameterMapper structureItemParameterMapper;
+
+ private StructureTestObjectMapper structureTestObjectMapper;
+
+ private LaboratoryMapper laboratoryMapper;
+
+ private StandardTreeTemplateBindingMapper standardTreeTemplateBindingMapper;
+
+ private StandardTreeTemplateDeviceMapper standardTreeTemplateDeviceMapper;
private StandardTemplateService standardTemplateService;
- private StructureTestObjectService structureTestObjectService;
-
@Override
- public List<FactoryDto> selectStandardTreeList() {
- List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeList();
- for (FactoryDto factoryDto : factoryDtos) {
- for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
- laboratoryDto.getChildren().sort((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort())
- - (o2.getSort() == null ? 0 : o2.getSort()));
- for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
-// if (sampleTypeDto.getChildren().size() == 0) {
- sampleTypeDto.getChildren().addAll(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
-// }
- }
+ public List<StandardLibraryTreeNodeDto> selectStandardTreeList() {
+ List<StandardLibraryTreeRowDto> rows = standardTreeMapper.selectStandardLibraryTree();
+ List<StandardLibraryTreeNodeDto> industries = new ArrayList<>();
+ Map<Integer, StandardLibraryTreeNodeDto> industryMap = new LinkedHashMap<>();
+ for (StandardLibraryTreeRowDto row : rows) {
+ StandardLibraryTreeNodeDto industry = industryMap.get(row.getIndustryId());
+ if (industry == null) {
+ industry = new StandardLibraryTreeNodeDto();
+ industry.setId(row.getIndustryId());
+ industry.setLabel(row.getIndustryName());
+ industry.setValue(row.getIndustryName());
+ industry.setCode("[1]");
+ industry.setChildren(new ArrayList<>());
+ industryMap.put(row.getIndustryId(), industry);
+ industries.add(industry);
+ }
+ if (row.getStandardId() != null) {
+ StandardLibraryTreeNodeDto standard = new StandardLibraryTreeNodeDto();
+ standard.setId(row.getStandardId());
+ standard.setLabel(row.getStandardCode());
+ standard.setValue(row.getStandardLabel());
+ standard.setCode("[2]");
+ standard.setSampleEn(row.getStandardNameEn());
+ standard.setStandardMethodId(row.getStandardMethodId());
+ standard.setStandardCode(row.getStandardCode());
+ standard.setStandardName(row.getStandardName());
+ standard.setChildren(null);
+ industry.getChildren().add(standard);
}
}
- return factoryDtos;
+ return industries;
}
-
@Override
@Transactional(rollbackFor = Exception.class)
- public int addStandardTree(StandardTree standardTree) {
- LambdaQueryWrapper<StandardTree> wrapper = Wrappers.<StandardTree>lambdaQuery()
- .eq(StandardTree::getFactory, standardTree.getFactory())
- .eq(StandardTree::getLaboratory, standardTree.getLaboratory())
- .eq(StandardTree::getSampleType, standardTree.getSampleType())
- .eq(StandardTree::getSample, standardTree.getSample())
- .eq(StandardTree::getModel, standardTree.getModel());
- if (StringUtils.isNotBlank(standardTree.getSample())) {
- wrapper.eq(StandardTree::getSample, standardTree.getSample());
+ public int addStandardTree(AddStandardTreeNodeDto dto) {
+ if (dto == null) {
+ throw new BaseException("鏍囧噯鏍戣矾寰勬牸寮忛敊璇�");
}
-
- StandardTree tree = standardTreeMapper.selectOne(wrapper);
- if (tree != null) {
- throw new BaseException("璇ュ瀷鍙峰凡瀛樺湪");
+ String name = StandardTreePathParser.normalizeNodeName(dto.getName());
+ if (StringUtils.isBlank(dto.getParentTree())) {
+ // 鏂板琛屼笟鑺傜偣
+ Long count = laboratoryMapper.selectCount(Wrappers.<Laboratory>lambdaQuery()
+ .eq(Laboratory::getLaboratoryName, name));
+ if (count > 0) {
+ throw new BaseException("琛屼笟鍚嶇О宸插瓨鍦�");
+ }
+ Laboratory laboratory = new Laboratory();
+ laboratory.setLaboratoryName(name);
+ laboratory.setSort(0);
+ return laboratoryMapper.insert(laboratory);
}
- return standardTreeMapper.insert(standardTree);
+ throw new BaseException("浜岀骇鏍囧噯璇峰湪鈥滄爣鍑嗙淮鎶も�濅腑閫氳繃琛屼笟缁戝畾杩涜缁存姢");
+ /*
+ // 鍦ㄨ涓氫笅鏂板鏍囧噯鑺傜偣
+ StandardTreePath path = StandardTreePathParser.parse(dto.getParentTree());
+ if (path.getStandard() != null) {
+ throw new BaseException("鏍囧噯鑺傜偣涓嬩笉鑳界户缁柊澧�");
+ }
+ String industry = path.getIndustry();
+ Long labCount = laboratoryMapper.selectCount(Wrappers.<Laboratory>lambdaQuery()
+ .eq(Laboratory::getLaboratoryName, industry));
+ if (labCount == 0) {
+ throw new BaseException("琛屼笟涓嶅瓨鍦�");
+ }
+ Long stdCount = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
+ .eq(StandardTree::getLaboratory, industry)
+ .eq(StandardTree::getSample, name)
+ .isNull(StandardTree::getSampleType)
+ .isNull(StandardTree::getModel));
+ if (stdCount > 0) {
+ throw new BaseException("璇ヨ涓氫笅鏍囧噯鍚嶇О宸插瓨鍦�");
+ }
+ StandardTree tree = new StandardTree();
+ tree.setLaboratory(industry);
+ tree.setSample(name);
+ tree.setFactory(null);
+ tree.setSampleType(null);
+ tree.setModel(null);
+ tree.setSort(0);
+ return standardTreeMapper.insert(tree);
+ */
}
@Override
@Transactional(rollbackFor = Exception.class)
public int delStandardTree(String tree) {
- String[] trees = tree.split(" - ");
- switch (trees.length) {
- case 5:
- if (trees[3].equals("null")) {
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).isNull(StandardTree::getSample).eq(StandardTree::getModel, trees[4]));
- } else {
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4]));
- }
- break;
- /*case 4:
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
- break;
- case 3:
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]));
- break;
- case 2:
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]));
- break;
- case 1:
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]));
- break;*/
+ StandardTreePath path = StandardTreePathParser.parse(tree);
+ String industry = path.getIndustry();
+ String standard = path.getStandard();
+ if (standard != null) {
+ throw new BaseException("浜岀骇鏍囧噯璇峰湪鈥滄爣鍑嗙淮鎶も�濅腑閫氳繃琛屼笟缁戝畾杩涜缁存姢");
}
- return 1;
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public int addStandardProduct(String ids, String tree) {
- String[] trees = tree.split(" - ");
- JSONArray jsonArray = JSON.parseArray(ids);
- for (Object o : jsonArray) {
- StandardProductList standardProductList = standardTreeMapper.selectStandardProductById(Integer.parseInt("" + o));
- standardProductList.setFactory(trees[0]);
- try {
- standardProductList.setLaboratory(trees[1]);
- } catch (Exception e) {
+ if (standard == null) {
+ // 鍒犻櫎琛屼笟锛氳涓氫笅浠嶆湁鏍囧噯鏃舵嫆缁濆垹闄�
+ Long count = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
+ .eq(StandardTree::getLaboratory, industry)
+ .isNull(StandardTree::getSampleType)
+ .isNull(StandardTree::getModel));
+ if (count > 0) {
+ throw new BaseException("璇ヨ涓氫笅浠嶆湁鏍囧噯锛岃鍏堝垹闄ゆ爣鍑�");
}
- try {
- standardProductList.setSampleType(trees[2]);
- } catch (Exception e) {
+ Laboratory laboratory = laboratoryMapper.selectOne(Wrappers.<Laboratory>lambdaQuery()
+ .eq(Laboratory::getLaboratoryName, industry));
+ if (laboratory == null) {
+ throw new BaseException("琛屼笟涓嶅瓨鍦�");
}
- try {
- standardProductList.setSample(trees[3]);
- } catch (Exception e) {
+ Long objectCount = structureTestObjectMapper.selectCount(Wrappers.<StructureTestObject>lambdaQuery()
+ .eq(StructureTestObject::getLaboratoryId, laboratory.getId()));
+ if (objectCount > 0) {
+ throw new BaseException("璇ヨ涓氬凡缁戝畾妫�娴嬪璞★紝绂佹鍒犻櫎");
}
- try {
- standardProductList.setModel(trees[4]);
- } catch (Exception e) {
+ int deleted = laboratoryMapper.delete(Wrappers.<Laboratory>lambdaQuery()
+ .eq(Laboratory::getLaboratoryName, industry));
+ if (deleted == 0) {
+ throw new BaseException("琛屼笟涓嶅瓨鍦�");
}
- standardProductListMapper.insert(standardProductList);
+ return deleted;
}
+ // 鍒犻櫎鏍囧噯鍙婂叾鏍囧噯搴撻厤缃紙涓嶅彲杈撅紝淇濈暀鍘嗗彶瀹炵幇璇存槑锛�
+ StandardTree standardTree = standardTreeMapper.selectOne(Wrappers.<StandardTree>lambdaQuery()
+ .eq(StandardTree::getLaboratory, industry)
+ .eq(StandardTree::getSample, standard)
+ .isNull(StandardTree::getSampleType)
+ .isNull(StandardTree::getModel));
+ if (standardTree == null) {
+ throw new BaseException("鏍囧噯涓嶅瓨鍦�");
+ }
+ standardTreeTemplateBindingMapper.delete(Wrappers.<StandardTreeTemplateBinding>lambdaQuery()
+ .eq(StandardTreeTemplateBinding::getStandardTreeId, standardTree.getId()));
+ standardTreeTemplateDeviceMapper.delete(Wrappers.<StandardTreeTemplateDevice>lambdaQuery()
+ .eq(StandardTreeTemplateDevice::getStandardTreeId, standardTree.getId()));
+ standardTreeMapper.deleteById(standardTree.getId());
+ standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaQuery()
+ .eq(StandardProductList::getLaboratory, industry)
+ .eq(StandardProductList::getSample, standard)
+ .isNull(StandardProductList::getSampleType)
+ .isNull(StandardProductList::getModel));
return 1;
}
@@ -162,7 +228,7 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int upStandardProducts(Map<String, Object> product) {
- List<Integer> ids = JSON.parseArray(product.get("ids") + "", Integer.class);
+ List<Integer> ids = JSON.parseArray(product.get("ids") + "");
StandardProductList productList = JSON.parseObject(JSON.toJSONString(product.get("standardProductList")), StandardProductList.class);
if (productList.getMethodS() != null) {
standardProductListMapper.update(productList, Wrappers.<StandardProductList>lambdaUpdate().in(StandardProductList::getId, ids).like(StandardProductList::getMethod, productList.getMethodS()));
@@ -177,359 +243,262 @@
}
@Override
- public List<StandardTree> getStandTreeBySampleType(String laboratory, String sampleType) {
- return standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery()
- .eq(StandardTree::getLaboratory, laboratory)
- .eq(StandardTree::getSampleType, sampleType)
- .select(StandardTree::getModel, StandardTree::getSample));
- }
-
- /**
- * 娌冲彛妫�娴嬩腑蹇冨鍏�
- * @param file
- */
- @Override
@Transactional(rollbackFor = Exception.class)
- public void inExcelOfTree(MultipartFile file) {
- InputStream inputStream;
- try {
- inputStream = file.getInputStream();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- List<StandardProductList> lists = new ArrayList<>();
- AtomicReference<String> laboratory = new AtomicReference<>();
- ExcelUtil.readBySax(inputStream, 0, (i, l, list) -> {
- StandardProductList str = new StandardProductList();
- if (i == 0 && l == 1) {
- laboratory.set(standardTreeMapper.getLaboratory(list.get(1) + ""));
- if (laboratory.get() == null) {
- throw new BaseException("妫�楠屽璞′笉瀛樺湪锛�" + list.get(1));
- }
- }
- if (i == 0 && l >= 1) {
- Integer standardMethodId = standardMethodListService.getStandardMethodId(list.get(0) + "");
- if (standardMethodId == null) {
- throw new BaseException("鏍囧噯缂栧彿涓嶅瓨鍦細" + list.get(0));
- }
- str.setStandardMethodListId(standardMethodId);
- str.setSampleType(list.get(1) + "");
- if (list.get(2) != null) {
- String sample = baseMapper.selSample(list.get(2) + "");
- if (sample == null) {
- throw new BaseException("鏍峰搧涓嶅瓨鍦細" + list.get(2));
- }
- str.setSample(list.get(2) + "");
- } else {
- str.setSample(null);
- }
- if (list.get(3) != null) {
- str.setModel(list.get(3) + "");
- Long aLong = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
- .eq(StandardTree::getModel, str.getModel())
- .eq(StandardTree::getSampleType, list.get(1) + ""));
- if (aLong == 0) {
- StandardTree standardTree = new StandardTree();
- standardTree.setFactory("涓ぉ绉戞妧妫�娴嬩腑蹇�");
- standardTree.setLaboratory(laboratory.get());
- standardTree.setSampleType(str.getSampleType());
- standardTree.setSample(str.getSample());
- standardTree.setModel(str.getModel());
- standardTreeMapper.insert(standardTree);
- }
- } else {
- str.setModel(null);
- }
- str.setInspectionItem(list.get(4) + "");
- if (list.get(6) == null) {
- str.setInspectionItemSubclass("");
- } else {
- str.setInspectionItemSubclass(list.get(6).toString());
- }
- StandardProductList db_str;
- try {
- db_str = standardProductListMapper.getOne(str.getStandardMethodListId(), str.getInspectionItem(), str.getSample(), str.getInspectionItemSubclass(), str.getModel(), str.getInspectionItemClass());
- } catch (Exception e) {
- throw new BaseException("閲嶅鏌ヨ锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
- }
- if (ObjectUtils.isNotEmpty(db_str)) {
- str.setId(db_str.getId());
- str.setStructureItemParameterId(db_str.getStructureItemParameterId());
- }
- if (list.get(8) != null) {
- str.setMethodS(list.get(8) + "");
- }
+ public boolean updateTreeSort(List<StandardLibraryTreeNodeDto> list) {
+ List<StandardTree> trees = new ArrayList<>();
+ int industrySort = 0;
+ for (StandardLibraryTreeNodeDto industry : list) {
+ Laboratory lab = new Laboratory();
+ lab.setId(industry.getId());
+ lab.setSort(industrySort);
+ laboratoryMapper.updateById(lab);
+ industrySort++;
- if (list.get(11) == null) {
- str.setTell(null);
- } else {
- str.setTell(list.get(11).toString());
- }
-
- if (list.get(12) == null) {
- str.setAsk(null);
- } else {
- str.setAsk(list.get(12).toString());
- }
-
- if (list.get(13) == null) {
- str.setPrice(null);
- } else {
- str.setPrice((list.get(13).toString()));
- }
-
- if (list.get(14) == null) {
- str.setManHour(null);
- } else {
- str.setManHour(list.get(14).toString());
- }
-
- StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list.get(21)));
- if (standTempIdByName != null) {
- str.setTemplateId(standTempIdByName.getId());
- } else {
- throw new BaseException("妯℃澘涓嶅瓨鍦細" + list.get(21));
- }
- str.setFactory("涓ぉ绉戞妧妫�娴嬩腑蹇�");
- str.setLaboratory(laboratory.get());
- str.setState(1);
- str.setTree(str.getFactory() + " - " + str.getLaboratory() + " - " + str.getSampleType() + " - " + str.getSample() + " - " + (str.getModel() == null ? "" : str.getModel()));
- try {
- str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass()));
- } catch (Exception e) {
- str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\",\"" + str.getSample() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass()));
- }
- if (str.getStructureItemParameterId() == null) {
- throw new BaseException("妫�楠岄」鐩笉瀛樺湪锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
- }
- lists.add(str);
- }
- });
- lists.forEach(a -> {
- if (a.getId() != null) {
- standardProductListMapper.updateById(a);
- } else {
- standardProductListMapper.insert(a);
- }
- });
- }
-
- @Override
- public void importWorkstationExcel(MultipartFile file) {
- InputStream inputStream;
- try {
- inputStream = file.getInputStream();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- List<StandardProductList> lists = new ArrayList<>();
- AtomicReference<String> laboratory = new AtomicReference<>();
- ExcelUtil.readBySax(inputStream, 0, (i, l, list) -> {
- StandardProductList str = new StandardProductList();
- if (i == 0 && l == 1) {
- laboratory.set(standardTreeMapper.getLaboratory(list.get(1) + ""));
- if (laboratory.get() == null) {
- throw new BaseException("妫�楠屽璞′笉瀛樺湪锛�" + list.get(1));
- }
- }
- if (i == 0 && l >= 1) {
- Integer standardMethodId = standardMethodListService.getStandardMethodId(list.get(0) + "");
- if (standardMethodId == null) {
- throw new BaseException("鏍囧噯缂栧彿涓嶅瓨鍦細" + list.get(0));
- }
- str.setStandardMethodListId(standardMethodId);
- str.setSampleType(list.get(1) + "");
- if (list.get(2) != null) {
- String sample = baseMapper.selSample(list.get(2) + "");
- if (sample == null) {
- throw new BaseException("鏍峰搧涓嶅瓨鍦細" + list.get(2));
- }
- str.setSample(list.get(2) + "");
- } else {
- str.setSample(null);
- }
- if (list.get(3) != null) {
- str.setModel(list.get(3) + "");
- Long aLong = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
- .eq(StandardTree::getModel, str.getModel())
- .eq(StandardTree::getSampleType, list.get(1) + ""));
- if (aLong == 0) {
- StandardTree standardTree = new StandardTree();
- standardTree.setFactory("涓ぉ绉戞妧妫�娴嬩腑蹇�");
- standardTree.setLaboratory(laboratory.get());
- standardTree.setSampleType(str.getSampleType());
- standardTree.setSample(str.getSample());
- standardTree.setModel(str.getModel());
- standardTreeMapper.insert(standardTree);
- }
- } else {
- str.setModel(null);
- }
- str.setInspectionItemClass(list.get(4).toString());
- str.setInspectionItemClassEn(list.get(5).toString());
- // 寮�濮嬪姞2
- str.setInspectionItem(list.get(6) + "");
- if (list.get(8) == null) {
- str.setInspectionItemSubclass("");
- } else {
- str.setInspectionItemSubclass(list.get(8).toString());
- }
- StandardProductList db_str;
- try {
- db_str = standardProductListMapper.getOne(str.getStandardMethodListId(), str.getInspectionItem(), str.getSample(), str.getInspectionItemSubclass(), str.getModel(), str.getInspectionItemClass());
- } catch (Exception e) {
- throw new BaseException("閲嶅鏌ヨ锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
- }
- if (ObjectUtils.isNotEmpty(db_str)) {
- str.setId(db_str.getId());
- str.setStructureItemParameterId(db_str.getStructureItemParameterId());
- }
- if (list.get(10) != null) {
- str.setMethodS(list.get(10) + "");
- }
- if (list.get(13) == null) {
- str.setTell(null);
- } else {
- str.setTell(list.get(13).toString());
- }
-
- if (list.get(14) == null) {
- str.setAsk(null);
- } else {
- str.setAsk(list.get(14).toString());
- }
-
- if (list.get(15) == null) {
- str.setPrice(null);
- } else {
- str.setPrice((list.get(15).toString()));
- }
-
- if (list.get(16) == null) {
- str.setManHour(null);
- } else {
- str.setManHour(list.get(16).toString());
- }
-
- StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list.get(23)));
- if (standTempIdByName != null) {
- str.setTemplateId(standTempIdByName.getId());
- } else {
- throw new BaseException("妯℃澘涓嶅瓨鍦細" + list.get(23));
- }
- str.setFactory("涓ぉ绉戞妧妫�娴嬩腑蹇�");
- str.setLaboratory(laboratory.get());
- str.setState(1);
- str.setTree(str.getFactory() + " - " + str.getLaboratory() + " - " + str.getSampleType() + " - " + str.getSample() + " - " + (str.getModel() == null ? "" : str.getModel()));
- try {
- str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass()));
- } catch (Exception e) {
- str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\",\"" + str.getSample() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass()));
- }
- if (str.getStructureItemParameterId() == null) {
- throw new BaseException("妫�楠岄」鐩笉瀛樺湪锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
- }
- lists.add(str);
- }
- });
- lists.forEach(a -> {
- if (a.getId() != null) {
- standardProductListMapper.updateById(a);
- } else {
- standardProductListMapper.insert(a);
- }
- });
- }
-
- @Override
- public boolean updateTreeSort(List<FactoryDto> list) {
- List<StructureTestObject> testObjects = new ArrayList<>();
- for (FactoryDto factoryDto : list) {
- for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
- List<SampleTypeDto> children = laboratoryDto.getChildren();
- int sort = 0;
- // 寰幆绗笁灞�
- for (SampleTypeDto child : children) {
- StructureTestObject structureTestObject = new StructureTestObject();
- structureTestObject.setSort(sort);
- structureTestObject.setId(child.getSampleTypeId());
- testObjects.add(structureTestObject);
- sort++;
+ List<StandardLibraryTreeNodeDto> children = industry.getChildren();
+ if (children != null) {
+ int standardSort = 0;
+ for (StandardLibraryTreeNodeDto standard : children) {
+ StandardTree tree = new StandardTree();
+ tree.setId(standard.getId());
+ tree.setSort(standardSort);
+ trees.add(tree);
+ standardSort++;
}
}
}
- structureTestObjectService.updateBatchById(testObjects);
-
+ if (!trees.isEmpty()) {
+ this.updateBatchById(trees);
+ }
return true;
}
/**
- * 淇敼鏍囧噯鏁�
- * @param standardTree
- * @return
+ * 淇敼鏍囧噯鏍戣妭鐐瑰悕
*/
@Override
- public int updateStandardTree(StandardTree standardTree) {
- // 淇敼鍚嶇О鍖归厤鐨勬爣鍑嗘爲涓嬬殑妫�楠岄」鐩�
- // 鏌ヨ鎵�鏈夊璞�+鍚嶇О鐨勬爲
+ @Transactional(rollbackFor = Exception.class)
+ public int updateStandardTree(UpdateStandardTreeNodeDto dto) {
+ if (dto == null) {
+ throw new BaseException("鏍囧噯鏍戣矾寰勬牸寮忛敊璇�");
+ }
+ String name = StandardTreePathParser.normalizeNodeName(dto.getName());
+ String oldLabel = StandardTreePathParser.normalizeNodeName(dto.getOldLabel());
+ if (StringUtils.isBlank(dto.getParentTree())) {
+ return updateIndustry(oldLabel, name);
+ }
+ throw new BaseException("浜岀骇鏍囧噯璇峰湪鈥滄爣鍑嗙淮鎶も�濅腑閫氳繃琛屼笟缁戝畾杩涜缁存姢");
+ }
- List<StandardProductList> standardProductLists = standardProductListService.list(Wrappers.<StandardProductList>lambdaUpdate()
- .eq(StandardProductList::getSample, standardTree.getSample())
- .eq(StandardProductList::getSampleType, standardTree.getSampleType())
- .eq(StandardProductList::getModel, standardTree.getOldModel()));
- if (CollectionUtils.isNotEmpty(standardProductLists)) {
- for (StandardProductList standardProductList : standardProductLists) {
- // 淇敼鏍峰搧鍚嶇О
- standardProductList.setModel(standardTree.getModel());
- // 淇敼鏍戝悕绉�
- // 闇�瑕佹埅鍙栫鍥涚骇, 閬垮厤涓夊洓绾у悕绉颁竴鏍蜂慨鏀归敊璇�
- String[] trees = standardProductList.getTree().split(" - ");
- trees[4] = standardTree.getModel();
- List<String> list = CollUtil.newArrayList(trees);
- String newName = CollUtil.join(list, " - ");
- standardProductList.setTree(newName);
+ private int updateIndustry(String oldName, String newName) {
+ if (Objects.equals(oldName, newName)) {
+ return ensureIndustryExists(oldName);
+ }
+ Long count = laboratoryMapper.selectCount(Wrappers.<Laboratory>lambdaQuery()
+ .eq(Laboratory::getLaboratoryName, newName));
+ if (count > 0) {
+ throw new BaseException("琛屼笟鍚嶇О宸插瓨鍦�");
+ }
+ Laboratory old = laboratoryMapper.selectOne(Wrappers.<Laboratory>lambdaQuery()
+ .eq(Laboratory::getLaboratoryName, oldName));
+ if (old == null) {
+ throw new BaseException("琛屼笟涓嶅瓨鍦�");
+ }
+ Laboratory update = new Laboratory();
+ update.setId(old.getId());
+ update.setLaboratoryName(newName);
+ if (laboratoryMapper.updateById(update) == 0) {
+ throw new BaseException("琛屼笟涓嶅瓨鍦�");
+ }
+ // 绾ц仈鏍囧噯鏍戣鑼冨寲璁板綍
+ standardTreeMapper.update(null, Wrappers.<StandardTree>lambdaUpdate()
+ .eq(StandardTree::getLaboratory, oldName)
+ .isNull(StandardTree::getSampleType)
+ .isNull(StandardTree::getModel)
+ .set(StandardTree::getLaboratory, newName));
+ // 绾ц仈鏍囧噯搴撻厤缃�
+ standardTreeMapper.updateProductListIndustry(oldName, newName);
+ // 绾ц仈鍩虹妫�楠岄」
+ structureItemParameterMapper.update(null, Wrappers.<StructureItemParameter>lambdaUpdate()
+ .eq(StructureItemParameter::getLaboratory, oldName)
+ .set(StructureItemParameter::getLaboratory, newName));
+ // 绾ц仈鏈畬鎴愯鍗�
+ standardTreeMapper.updateInsOrderIndustry(oldName, newName);
+ standardTreeMapper.updateInsSampleIndustry(oldName, newName);
+ standardTreeMapper.updateInsProductIndustry(oldName, newName);
+ return 1;
+ }
+
+ private int updateStandard(String industry, String oldName, String newName) {
+ if (Objects.equals(oldName, newName)) {
+ return ensureStandardExists(industry, oldName);
+ }
+ Long count = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
+ .eq(StandardTree::getLaboratory, industry)
+ .eq(StandardTree::getSample, newName)
+ .isNull(StandardTree::getSampleType)
+ .isNull(StandardTree::getModel));
+ if (count > 0) {
+ throw new BaseException("璇ヨ涓氫笅鏍囧噯鍚嶇О宸插瓨鍦�");
+ }
+ StandardTree old = standardTreeMapper.selectOne(Wrappers.<StandardTree>lambdaQuery()
+ .eq(StandardTree::getLaboratory, industry)
+ .eq(StandardTree::getSample, oldName)
+ .isNull(StandardTree::getSampleType)
+ .isNull(StandardTree::getModel));
+ if (old == null) {
+ throw new BaseException("鏍囧噯涓嶅瓨鍦�");
+ }
+ StandardTree update = new StandardTree();
+ update.setId(old.getId());
+ update.setSample(newName);
+ if (standardTreeMapper.updateById(update) == 0) {
+ throw new BaseException("鏍囧噯涓嶅瓨鍦�");
+ }
+ // 绾ц仈鏍囧噯搴撻厤缃�
+ standardTreeMapper.updateProductListStandard(industry, oldName, newName);
+ // 绾ц仈鏈畬鎴愯鍗�
+ standardTreeMapper.updateInsOrderStandard(industry, oldName, newName);
+ standardTreeMapper.updateInsSampleStandard(industry, oldName, newName);
+ standardTreeMapper.updateInsProductStandard(industry, oldName, newName);
+ return 1;
+ }
+
+ private int ensureIndustryExists(String industry) {
+ Long count = laboratoryMapper.selectCount(Wrappers.<Laboratory>lambdaQuery()
+ .eq(Laboratory::getLaboratoryName, industry));
+ if (count == 0) {
+ throw new BaseException("琛屼笟涓嶅瓨鍦�");
+ }
+ return 1;
+ }
+
+ private int ensureStandardExists(String industry, String standard) {
+ Long count = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
+ .eq(StandardTree::getLaboratory, industry)
+ .eq(StandardTree::getSample, standard)
+ .isNull(StandardTree::getSampleType)
+ .isNull(StandardTree::getModel));
+ if (count == 0) {
+ throw new BaseException("鏍囧噯涓嶅瓨鍦�");
+ }
+ return 1;
+ }
+
+ @Override
+ public List<StandardTreeTemplateBindingVo> selectTemplateBindings(Integer standardTreeId) {
+ ensureTwoLevelStandard(standardTreeId);
+ List<StandardTreeTemplateBinding> bindings = standardTreeTemplateBindingMapper.selectList(
+ Wrappers.<StandardTreeTemplateBinding>lambdaQuery()
+ .eq(StandardTreeTemplateBinding::getStandardTreeId, standardTreeId)
+ .orderByAsc(StandardTreeTemplateBinding::getSort, StandardTreeTemplateBinding::getId));
+ Map<Integer, List<Integer>> deviceIdsByTemplate = standardTreeTemplateDeviceMapper.selectList(
+ Wrappers.<StandardTreeTemplateDevice>lambdaQuery()
+ .eq(StandardTreeTemplateDevice::getStandardTreeId, standardTreeId)
+ .orderByAsc(StandardTreeTemplateDevice::getSort,
+ StandardTreeTemplateDevice::getId))
+ .stream().collect(Collectors.groupingBy(
+ StandardTreeTemplateDevice::getTemplateId,
+ LinkedHashMap::new,
+ Collectors.mapping(StandardTreeTemplateDevice::getDeviceId, Collectors.toList())));
+ List<StandardTreeTemplateBindingVo> result = new ArrayList<>();
+ for (StandardTreeTemplateBinding binding : bindings) {
+ StandardTemplate template = standardTemplateService.getById(binding.getTemplateId());
+ if (template == null) {
+ continue;
}
- standardProductListService.updateBatchById(standardProductLists);
+ StandardTreeTemplateBindingVo vo = new StandardTreeTemplateBindingVo();
+ vo.setTemplateId(template.getId());
+ vo.setName(template.getName());
+ vo.setNumber(template.getNumber());
+ vo.setRemark(template.getRemark());
+ vo.setSort(binding.getSort());
+ vo.setDeviceIds(deviceIdsByTemplate.getOrDefault(template.getId(), new ArrayList<>()));
+ result.add(vo);
}
+ return result;
+ }
- // 淇敼鏍囧噯鏁版楠岄」鐩�
- LambdaUpdateWrapper<StandardTree> wrapper = Wrappers.<StandardTree>lambdaUpdate()
- .eq(StandardTree::getFactory, standardTree.getFactory())
- .eq(StandardTree::getLaboratory, standardTree.getLaboratory())
- .eq(StandardTree::getSampleType, standardTree.getSampleType())
- .eq(StandardTree::getModel, standardTree.getOldModel())
- .set(StandardTree::getModel, standardTree.getModel());
- if (StringUtils.isNotBlank(standardTree.getSample())) {
- wrapper.eq(StandardTree::getSample, standardTree.getSample());
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean saveTemplateBindings(StandardTreeTemplateBindingDto dto) {
+ if (dto == null || dto.getStandardTreeId() == null) {
+ throw new BaseException("鏍囧噯涓嶈兘涓虹┖");
}
- return standardTreeMapper.update(null, wrapper);
+ ensureTwoLevelStandard(dto.getStandardTreeId());
+ List<TemplateBindingItemDto> templates = dto.getTemplates() == null ? new ArrayList<>() : dto.getTemplates();
+ Set<Integer> templateIds = new HashSet<>();
+ Set<Integer> allDeviceIds = new HashSet<>();
+ List<StandardTreeTemplateBinding> bindings = new ArrayList<>();
+ int index = 0;
+ for (TemplateBindingItemDto item : templates) {
+ if (item == null || item.getTemplateId() == null || !templateIds.add(item.getTemplateId())) {
+ throw new BaseException("鍘熷璁板綍妯℃澘涓嶈兘閲嶅缁戝畾");
+ }
+ StandardTemplate template = standardTemplateService.getById(item.getTemplateId());
+ if (template == null) {
+ throw new BaseException("鍘熷璁板綍妯℃澘涓嶅瓨鍦�");
+ }
+ StandardTreeTemplateBinding binding = new StandardTreeTemplateBinding();
+ binding.setStandardTreeId(dto.getStandardTreeId());
+ binding.setTemplateId(item.getTemplateId());
+ binding.setSort(item.getSort() == null ? index : item.getSort());
+ bindings.add(binding);
+ if (item.getDeviceIds() != null) {
+ allDeviceIds.addAll(item.getDeviceIds().stream()
+ .filter(Objects::nonNull).collect(Collectors.toSet()));
+ }
+ index++;
+ }
+ if (!allDeviceIds.isEmpty()) {
+ List<Integer> requestedDeviceIds = new ArrayList<>(allDeviceIds);
+ if (standardTreeTemplateDeviceMapper.selectExistingDeviceIds(requestedDeviceIds).size()
+ != requestedDeviceIds.size()) {
+ throw new BaseException("鎵�閫夎澶囦笉瀛樺湪锛岃鍒锋柊璁惧鍒楄〃鍚庨噸璇�");
+ }
+ }
+ standardTreeTemplateDeviceMapper.delete(Wrappers.<StandardTreeTemplateDevice>lambdaQuery()
+ .eq(StandardTreeTemplateDevice::getStandardTreeId, dto.getStandardTreeId()));
+ standardTreeTemplateBindingMapper.delete(Wrappers.<StandardTreeTemplateBinding>lambdaQuery()
+ .eq(StandardTreeTemplateBinding::getStandardTreeId, dto.getStandardTreeId()));
+ for (int bindingIndex = 0; bindingIndex < bindings.size(); bindingIndex++) {
+ StandardTreeTemplateBinding binding = bindings.get(bindingIndex);
+ standardTreeTemplateBindingMapper.insert(binding);
+ TemplateBindingItemDto item = templates.get(bindingIndex);
+ List<Integer> deviceIds = item.getDeviceIds() == null ? new ArrayList<>()
+ : item.getDeviceIds().stream().filter(Objects::nonNull).distinct()
+ .collect(Collectors.toList());
+ for (int deviceIndex = 0; deviceIndex < deviceIds.size(); deviceIndex++) {
+ StandardTreeTemplateDevice relation = new StandardTreeTemplateDevice();
+ relation.setStandardTreeId(dto.getStandardTreeId());
+ relation.setTemplateId(item.getTemplateId());
+ relation.setDeviceId(deviceIds.get(deviceIndex));
+ relation.setSort(deviceIndex);
+ standardTreeTemplateDeviceMapper.insert(relation);
+ }
+ }
+ return true;
}
@Override
- public void resetTreeOfPrice(String tree, Integer standardId) {
- standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId).set(StandardProductList::getPrice, null));
+ public List<TemplateInspectionItemDto> selectTemplateInspectionItems(Integer standardTreeId) {
+ List<StandardTreeTemplateBindingVo> bindings = selectTemplateBindings(standardTreeId);
+ List<TemplateInspectionItemDto> result = new ArrayList<>();
+ for (StandardTreeTemplateBindingVo binding : bindings) {
+ List<TemplateInspectionItemDto> items = StandardTemplateInspectionItemParser.parse(binding.getTemplateId(),
+ binding.getSort(), standardTemplateService.getStandTempThingById(binding.getTemplateId()));
+ result.addAll(items);
+ }
+ result.sort(Comparator.comparing(TemplateInspectionItemDto::getTemplateSort)
+ .thenComparing(TemplateInspectionItemDto::getTemplateRowIndex));
+ return result;
}
- @Override
- public void resetTreeOfHour(String tree, Integer standardId) {
- standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId).set(StandardProductList::getManHour, null));
+ private StandardTree ensureTwoLevelStandard(Integer standardTreeId) {
+ StandardTree standardTree = this.getById(standardTreeId);
+ if (standardTree == null || StringUtils.isBlank(standardTree.getSample())
+ || standardTree.getSampleType() != null || standardTree.getModel() != null) {
+ throw new BaseException("璇烽�夋嫨鏍囧噯搴撲簩绾ф爣鍑�");
+ }
+ return standardTree;
}
-
- @Override
- public void resetTreeOfAsk(String tree, Integer standardId) {
- standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId)
- .set(StandardProductList::getAsk, null)
- .set(StandardProductList::getTell, null)
- .set(StandardProductList::getSection, null)
- .set(StandardProductList::getCores, null)
- .set(StandardProductList::getConductorMaterial, null)
- .set(StandardProductList::getConductorType, null)
- .set(StandardProductList::getPrice, null)
- .set(StandardProductList::getManHour, null));
- }
-
}
-
-
-
-
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureItemParameterServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureItemParameterServiceImpl.java
index 594f5e7..8d5b465 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureItemParameterServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureItemParameterServiceImpl.java
@@ -1,14 +1,34 @@
package com.ruoyi.basic.service.impl;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.poi.excel.ExcelUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.StructureItemParameterMapper;
+import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.pojo.StructureItemParameter;
+import com.ruoyi.basic.service.StandardTemplateService;
import com.ruoyi.basic.service.StructureItemParameterService;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.system.service.ISysDictTypeService;
import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
import jakarta.annotation.Resource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
@Service
@AllArgsConstructor
@@ -16,9 +36,261 @@
@Resource
private StructureItemParameterMapper structureItemParameterMapper;
+ @Resource
+ private ISysDictTypeService dictTypeService;
+ @Resource
+ private StandardTemplateService standardTemplateService;
+ /**
+ *
+ * @param file
+ */
@Override
- public void removeNoSample(String sample) {
- structureItemParameterMapper.removeNoSample("\""+sample+"\"");
+ public void importEquipData(MultipartFile file) throws IOException {
+ InputStream inputStream = file.getInputStream();
+ List<StructureItemParameter> lists = new ArrayList<>();
+ AtomicReference<String> sample = new AtomicReference<>();
+ ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> {
+ if (l == 1) {
+ sample.set(list1.get(1) + "");
+ }
+ if (l >= 1) {
+ StructureItemParameter str = new StructureItemParameter();
+ // 娴嬭瘯瀵硅薄
+ if (list1.get(1) == null) {
+ str.setSample(null);
+ } else {
+ String brand = (String) list1.get(1);
+ StringBuilder builder = new StringBuilder();
+ builder.append("[");
+ // 浜у搧
+ if (ObjectUtil.isNotEmpty(list1.get(2))) {
+ String production = (String) list1.get(2);
+ if (!production.contains("锛�")) {
+ builder.append(String.format("[\"%s\",\"%s\"]", brand, production));
+ } else {
+ Arrays.stream(production.split("锛�")).forEach(item -> {
+ builder.append(String.format("[\"%s\",\"%s\"],", brand, item));
+ });
+ builder.deleteCharAt(builder.length() - 1);
+ }
+ } else {
+ builder.append("[");
+ builder.append(String.format("\"%s\"", brand));
+ builder.append("]");
+ }
+ builder.append("]");
+ str.setSample(builder.toString());
+ }
+ // 妫�楠岄」
+ str.setInspectionItem(list1.get(4).toString().trim());
+ // 妫�楠岄」鑻辨枃
+ if (list1.get(5) != null) {
+ str.setInspectionItemEn(list1.get(5).toString());
+ }
+ // 妫�楠屽瓙椤�
+ if (list1.get(6) == null) {
+ str.setInspectionItemSubclass(null);
+ } else {
+ str.setInspectionItemSubclass(list1.get(6).toString().trim());
+ }
+ // 妫�楠屽瓙椤硅嫳鏂�
+ if (list1.get(7) == null) {
+ str.setInspectionItemSubclassEn(null);
+ } else {
+ str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString()));
+ }
+ // 妫�楠岄」鍒嗙被
+ if (list1.get(22) != null && list1.get(22) != "") {
+ str.setInspectionItemClass(list1.get(22).toString().trim());
+ } else {
+ str.setInspectionItemClass(null);
+ }
+ // 妫�楠岄」鍒嗙被鑻辨枃
+ if (list1.get(23) != null && list1.get(23) != "") {
+ str.setInspectionItemClassEn(list1.get(23) + "");
+ } else {
+ str.setInspectionItemClassEn(null);
+ }
+
+ LambdaQueryWrapper<StructureItemParameter> wrapper = Wrappers.lambdaQuery(StructureItemParameter.class)
+ .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
+ .eq(StructureItemParameter::getSample, str.getSample())
+
+ .last("limit 1");
+ // 鍒ゆ柇鏄惁鏈夋楠岄」绫诲瀷
+ if (ObjectUtils.isNotEmpty(str.getInspectionItemClass())) {
+ wrapper.eq(StructureItemParameter::getInspectionItemClass, str.getInspectionItemClass());
+ }
+
+ // 鍒ゆ柇鏄惁鏈夋楠屽瓙椤�
+ if (ObjectUtils.isNotEmpty(str.getInspectionItemSubclass())) {
+ wrapper.eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass());
+ }
+ StructureItemParameter db_str = this.getOne(wrapper);
+ if (ObjectUtils.isNotEmpty(db_str)) {
+ str.setId(db_str.getId());
+ }
+ // 鏂规硶鍚嶇О
+ if (list1.get(8) == null) {
+ str.setMethod(null);
+ } else {
+ StringBuffer buffer = new StringBuffer();
+ String input = list1.get(8).toString();
+ buffer.append("[");
+ String[] values = input.split("锛�");
+ for (String value : values) {
+ buffer.append("\"").append(value.trim()).append("\",");
+ }
+ buffer.deleteCharAt(buffer.length() - 1);
+ buffer.append("]");
+ str.setMethod(buffer.toString());
+ }
+ // 璇曢獙瀹�
+ if (list1.get(9) == null) {
+ str.setSonLaboratory(null);
+ } else {
+ str.setSonLaboratory(list1.get(9).toString());
+ }
+ // 璁¢噺鍗曚綅
+ if (list1.get(10) == null) {
+ str.setUnit(null);
+ } else {
+ str.setUnit(list1.get(10).toString());
+ }
+ // 瑕佹眰鍊�
+ if (list1.get(11) == null) {
+ str.setAskTell(null);
+ } else {
+ str.setAskTell(list1.get(11).toString());
+ }
+ // 瑕佹眰鎻忚堪
+ if (list1.get(12) == null) {
+ str.setAsk(null);
+ } else {
+ str.setAsk(list1.get(12).toString());
+ }
+ // 鍗曚环
+ if (list1.get(13) == null) {
+ str.setPrice(null);
+ } else {
+ str.setPrice(list1.get(13) + "");
+ }
+ // 宸ユ椂绯绘暟
+ if (list1.get(14) == null) {
+ str.setManHour(null);
+ } else {
+ str.setManHour(Double.valueOf(list1.get(14).toString()));
+ }
+ // 宸ユ椂鍒嗙粍
+ if (list1.get(15) == null) {
+ str.setManHourGroup(null);
+ } else {
+ str.setManHourGroup(list1.get(15).toString());
+ }
+ // 棰勮瀹屾垚鏃堕棿
+ if (list1.get(16) == null) {
+ str.setManDay(null);
+ } else {
+ str.setManDay(Integer.valueOf(list1.get(16).toString()));
+ }
+ // 鏁版嵁绫诲瀷
+ String jy;
+ if (list1.get(17).toString().equals("闈為噰闆嗙被鍨�")) {
+ jy = "0";
+ } else {
+ jy = "1";
+ // 缁戝畾璁惧
+ if (list1.get(28) == null) {
+ str.setRates(null);
+ } else {
+ // 鏌ヨ璁惧淇℃伅
+ List<String> managementNumberList = StrUtil.split(list1.get(28).toString(), '锛�');
+ if (CollectionUtils.isNotEmpty(managementNumberList)) {
+ List<Integer> deviceIds = structureItemParameterMapper.selectDeviceIdsByNumber(managementNumberList);
+ if (CollectionUtils.isNotEmpty(deviceIds)) {
+ str.setDeviceIds(CollUtil.join(deviceIds, ","));
+ }
+ }
+ }
+
+ }
+ str.setInspectionItemType(jy);
+ // 妫�楠岄」绫诲瀷
+ String validateValueType = list1.get(18).toString();
+ if (ObjectUtils.isNotEmpty(validateValueType)) {
+ List<SysDictData> enums = dictTypeService.selectDictDataByName("妫�楠屽�肩被鍨�")
+ .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(validateValueType)).collect(Collectors.toList());
+ str.setInspectionValueType(enums.get(0).getDictValue());
+ }
+ int bsm;
+ //鐗规畩鏍囪瘑
+ if (list1.get(19).toString().equals("鍚�")) {
+ bsm = 0;
+ } else {
+ bsm = 1;
+ }
+ str.setBsm(bsm + "");
+ // 鏁板瓧瀛楀吀
+ if (list1.get(20) != null) {
+ str.setDic(list1.get(20) + "");
+ } else {
+ str.setDic(null);
+ }
+ // 鍘熷璁板綍妯℃澘
+ StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21)));
+ if (standTempIdByName != null) {
+ str.setTemplateId(standTempIdByName.getId());
+ } else {
+ str.setTemplateId(null);
+ }
+ try {
+ if (list1.get(24) != null) {
+ str.setLaboratory(list1.get(24) + "");
+ }
+ } catch (Exception e) {
+ }
+
+ // 鏉′欢
+ if (list1.get(25) == null) {
+ str.setRadiusList(null);
+ } else {
+ StringBuffer buffer = new StringBuffer();
+ String input = list1.get(25).toString();
+ buffer.append("[");
+ String[] values = input.split("锛�");
+ for (String value : values) {
+ buffer.append("\"").append(value.trim()).append("\",");
+ }
+ buffer.deleteCharAt(buffer.length() - 1);
+ buffer.append("]");
+ str.setRadiusList(buffer.toString());
+ }
+ //鏀惰垂鏍囧噯
+ if (list1.get(26) == null) {
+ str.setRates(null);
+ } else {
+ str.setRates(list1.get(26) + "");
+ }
+ // 鎶芥牱绫诲瀷
+ if (list1.get(27) != null){
+ String spotCheckType = list1.get(27).toString();
+ if (ObjectUtils.isNotEmpty(spotCheckType)) {
+ List<SysDictData> enums = dictTypeService.selectDictDataByName("鎶芥绫诲瀷")
+ .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(spotCheckType)).collect(Collectors.toList());
+ str.setSpotCheckType(enums.get(0).getDictValue());
+ }
+ }else {
+ str.setSpotCheckType(null);
+ }
+ lists.add(str);
+ }
+ });
+ try {
+ this.saveOrUpdateBatch(lists);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException("鏈嶅姟绔姤閿�");
+ }
}
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/utils/StandardTemplateInspectionItemParser.java b/basic-server/src/main/java/com/ruoyi/basic/utils/StandardTemplateInspectionItemParser.java
new file mode 100644
index 0000000..fe80870
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/utils/StandardTemplateInspectionItemParser.java
@@ -0,0 +1,108 @@
+package com.ruoyi.basic.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.basic.dto.TemplateInspectionItemDto;
+import com.ruoyi.common.exception.base.BaseException;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/** 瑙f瀽 Luckysheet 鍘熷璁板綍妯℃澘涓殑鈥滄楠岄」鈥濇爣璁般�� */
+public final class StandardTemplateInspectionItemParser {
+ private static final String INSPECTION_ITEM_MARK = "妫�楠岄」";
+
+ private StandardTemplateInspectionItemParser() {
+ }
+
+ public static List<TemplateInspectionItemDto> parse(Integer templateId, Integer templateSort, String thing) {
+ if (!StringUtils.hasText(thing)) {
+ throw new BaseException("鍘熷璁板綍妯℃澘鍐呭涓嶈兘涓虹┖");
+ }
+ JSONArray sheets;
+ try {
+ JSONObject root = JSON.parseObject(thing);
+ sheets = root == null ? null : root.getJSONArray("data");
+ if (sheets == null) {
+ sheets = JSON.parseArray(thing);
+ }
+ } catch (Exception e) {
+ throw new BaseException("鍘熷璁板綍妯℃澘鏍煎紡閿欒");
+ }
+ List<TemplateInspectionItemDto> result = new ArrayList<>();
+ Set<Integer> rows = new HashSet<>();
+ if (sheets == null) {
+ throw new BaseException("鍘熷璁板綍妯℃澘鏍煎紡閿欒");
+ }
+ for (Object sheetObject : sheets) {
+ JSONObject sheet = (JSONObject) sheetObject;
+ JSONArray cells = sheet.getJSONArray("celldata");
+ if (cells == null) {
+ continue;
+ }
+ for (Object cellObject : cells) {
+ JSONObject cell = (JSONObject) cellObject;
+ JSONObject value = cell.getJSONObject("v");
+ if (value == null || !isInspectionItem(value)) {
+ continue;
+ }
+ Integer row = cell.getInteger("r");
+ String item = getCellText(value);
+ if (row == null || !StringUtils.hasText(item)) {
+ throw new BaseException("鈥滄楠岄」鈥濇爣璁版墍鍦ㄥ崟鍏冩牸蹇呴』濉啓妫�楠岄」鍚嶇О");
+ }
+ if (!rows.add(row)) {
+ throw new BaseException("鍚屼竴妯℃澘琛屽彧鑳介厤缃竴涓�滄楠岄」鈥濇爣璁�");
+ }
+ TemplateInspectionItemDto dto = new TemplateInspectionItemDto();
+ dto.setTemplateId(templateId);
+ dto.setTemplateSort(templateSort);
+ dto.setTemplateRowIndex(row);
+ dto.setInspectionItem(item.trim());
+ result.add(dto);
+ }
+ }
+ result.sort(Comparator.comparing(TemplateInspectionItemDto::getTemplateRowIndex));
+ return result;
+ }
+
+ /**
+ * 璇诲彇 Luckysheet 鍗曞厓鏍兼枃鏈紝鍏煎鏅�氭枃鏈拰 inlineStr 瀵屾枃鏈��
+ */
+ private static String getCellText(JSONObject value) {
+ String text = value.getString("v");
+ if (StringUtils.hasText(text)) {
+ return text;
+ }
+ text = value.getString("m");
+ if (StringUtils.hasText(text)) {
+ return text;
+ }
+
+ JSONObject cellType = value.getJSONObject("ct");
+ JSONArray segments = cellType == null ? null : cellType.getJSONArray("s");
+ if (segments == null || segments.isEmpty()) {
+ return text;
+ }
+ StringBuilder richText = new StringBuilder();
+ for (Object segmentObject : segments) {
+ if (segmentObject instanceof JSONObject) {
+ String segmentText = ((JSONObject) segmentObject).getString("v");
+ if (segmentText != null) {
+ richText.append(segmentText);
+ }
+ }
+ }
+ return richText.toString();
+ }
+
+ private static boolean isInspectionItem(JSONObject value) {
+ JSONObject ps = value.getJSONObject("ps");
+ return ps != null && INSPECTION_ITEM_MARK.equals(ps.getString("value"));
+ }
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/utils/StandardTreePath.java b/basic-server/src/main/java/com/ruoyi/basic/utils/StandardTreePath.java
new file mode 100644
index 0000000..401b59d
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/utils/StandardTreePath.java
@@ -0,0 +1,18 @@
+package com.ruoyi.basic.utils;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 鏍囧噯鏍戣矾寰勮В鏋愮粨鏋�
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class StandardTreePath {
+
+ private String industry;
+
+ private String standard;
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/utils/StandardTreePathParser.java b/basic-server/src/main/java/com/ruoyi/basic/utils/StandardTreePathParser.java
new file mode 100644
index 0000000..ae186b1
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/utils/StandardTreePathParser.java
@@ -0,0 +1,78 @@
+package com.ruoyi.basic.utils;
+
+import com.ruoyi.common.exception.base.BaseException;
+
+import java.util.regex.Pattern;
+
+/**
+ * 鏍囧噯鏍戝浐瀹氫袱绾ц矾寰勮В鏋愬伐鍏枫��
+ *
+ * 鍏煎鍓嶇浼犻�掔殑涓ょ鍙跺瓙璺緞锛�
+ * 鏍囧噯搴撲晶锛氳涓� - null - 鏍囧噯
+ * 涓嬪崟渚э細琛屼笟 - - 鏍囧噯
+ * 缁熶竴瑙f瀽涓� industry = 绗竴涓湁鏁堟锛宻tandard = 鏈�鍚庝竴涓湁鏁堟銆�
+ */
+public final class StandardTreePathParser {
+
+ private static final String SEPARATOR = " - ";
+
+ private static final String NULL_MARKER = "null";
+
+ private StandardTreePathParser() {
+ }
+
+ /**
+ * 瑙f瀽璺緞涓鸿涓� + 鏍囧噯銆傛爣鍑嗗彲鑳戒负 null锛堣〃绀轰粎琛屼笟鑺傜偣锛夈��
+ */
+ public static StandardTreePath parse(String tree) {
+ if (tree == null || tree.trim().isEmpty()) {
+ throw new BaseException("鏍囧噯鏍戣矾寰勬牸寮忛敊璇�");
+ }
+ String[] parts = tree.split(Pattern.quote(SEPARATOR), -1);
+ for (int i = 0; i < parts.length; i++) {
+ parts[i] = parts[i].trim();
+ }
+ if (parts.length == 1) {
+ validateSegment(parts[0]);
+ return new StandardTreePath(parts[0], null);
+ }
+ if (parts.length == 2) {
+ validateSegment(parts[0]);
+ validateSegment(parts[1]);
+ return new StandardTreePath(parts[0], parts[1]);
+ }
+ if (parts.length == 3 && (parts[1].isEmpty() || NULL_MARKER.equals(parts[1]))) {
+ validateSegment(parts[0]);
+ validateSegment(parts[2]);
+ return new StandardTreePath(parts[0], parts[2]);
+ }
+ throw new BaseException("鏍囧噯鏍戣矾寰勬牸寮忛敊璇�");
+ }
+
+ /**
+ * 鐢熸垚瑙勮寖璺緞锛氳涓� - null - 鏍囧噯
+ */
+ public static String canonical(String industry, String standard) {
+ String normalizedIndustry = trim(industry);
+ String normalizedStandard = trim(standard);
+ validateSegment(normalizedIndustry);
+ validateSegment(normalizedStandard);
+ return normalizedIndustry + SEPARATOR + NULL_MARKER + SEPARATOR + normalizedStandard;
+ }
+
+ private static String trim(String value) {
+ return value == null ? "" : value.trim();
+ }
+
+ public static String normalizeNodeName(String value) {
+ String normalized = trim(value);
+ validateSegment(normalized);
+ return normalized;
+ }
+
+ private static void validateSegment(String value) {
+ if (value == null || value.isEmpty() || NULL_MARKER.equals(value) || value.contains(SEPARATOR)) {
+ throw new BaseException("鏍囧噯鏍戣矾寰勬牸寮忛敊璇�");
+ }
+ }
+}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/vo/IfsInventoryQuantityVO.java b/basic-server/src/main/java/com/ruoyi/basic/vo/IfsInventoryQuantityVO.java
new file mode 100644
index 0000000..66086d8
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/vo/IfsInventoryQuantityVO.java
@@ -0,0 +1,37 @@
+package com.ruoyi.basic.vo;
+
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 鍘熸潗鏂欐姤妫�vo
+ */
+@Data
+public class IfsInventoryQuantityVO extends IfsInventoryQuantity {
+
+ /**
+ * 妫�楠屽崟id
+ */
+ @Schema(description = "妫�楠屽崟id")
+ private Integer insOrderId;
+
+ /**
+ * 妫�楠岀粨鏋滐紙0锛氫笉鍚堟牸锛�1锛氬悎鏍硷級
+ */
+ @Schema(description = "妫�楠岀粨鏋滐紙0锛氫笉鍚堟牸锛�1锛氬悎鏍硷級")
+ private Integer insResult;
+
+ /**
+ * 鍚屾鐘舵�侊紙0锛氭湭鍚屾锛�1锛氬凡鍚屾锛�
+ */
+ @Schema(description = "鍚屾鐘舵�侊紙0锛氭湭鍚屾锛�1锛氬凡鍚屾锛�")
+ private Integer syncStatus;
+
+ /**
+ * 鎵规鍙锋槸鍚﹂噸澶嶆姤妫�
+ */
+ @Schema(description = "鎵规鍙锋槸鍚﹂噸澶嶆姤妫�")
+ private Boolean lotBatchNoHasRepeat;
+
+}
diff --git a/basic-server/src/main/resources/mapper/CertificationMapper.xml b/basic-server/src/main/resources/mapper/CertificationMapper.xml
index 4926d05..35154d0 100644
--- a/basic-server/src/main/resources/mapper/CertificationMapper.xml
+++ b/basic-server/src/main/resources/mapper/CertificationMapper.xml
@@ -2,18 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ruoyi.basic.mapper.CertificationMapper">
<select id="getCertificationDetail" resultType="com.ruoyi.basic.pojo.Certification">
- select b.*
- from ( select a.`name`, a.`code`,a.organization,a.explanation,a.first_issuance_date,a.latest_issuance_date,c.expire_time FROM
- (SELECT id,name,MIN(date_of_issuance) AS first_issuance_date,
- MAX(date_of_issuance) AS latest_issuance_date,
- c.`code`,c.organization,c.explanation
- FROM
- certification c
- <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
- ${ew.customSqlSegment}
- </if>
- GROUP BY
- name) a left join certification c on a.id=c.id
- ) b
+ SELECT * FROM certification
+ <where>
+ create_time IN (
+ SELECT MAX( create_time ) FROM certification WHERE create_time IS NOT NULL GROUP BY NAME )
+ <if test="param.name != null and param.name != ''">
+ AND name like concat('%',#{param.name},'%')
+ </if>
+ </where>
</select>
</mapper>
diff --git a/basic-server/src/main/resources/mapper/IfsInventoryQuantityMapper.xml b/basic-server/src/main/resources/mapper/IfsInventoryQuantityMapper.xml
index 2b615be..5495210 100644
--- a/basic-server/src/main/resources/mapper/IfsInventoryQuantityMapper.xml
+++ b/basic-server/src/main/resources/mapper/IfsInventoryQuantityMapper.xml
@@ -71,4 +71,28 @@
and iiq.supplier_name = #{supplierName}
and iiq.receiver_date between #{startOfNextQuarter} and #{endOfQuarter}
</select>
+ <select id="selectSplitOrderList" resultType="com.ruoyi.basic.vo.IfsInventoryQuantityVO">
+ select
+ iiq.*,
+ io.id AS ins_order_id,
+ io.ins_result,
+ isor.sync_status
+ from ifs_inventory_quantity iiq
+ join ifs_split_order_record isor
+ on iiq.update_batch_no = isor.lot_batch_no
+ and iiq.order_no=isor.order_no
+ and iiq.line_no=isor.line_no
+ and iiq.release_no=isor.release_no
+ and iiq.receipt_no=isor.receipt_no
+ and iiq.part_no=isor.part_no
+ left join ins_order io on iiq.id=io.ifs_inventory_id
+ where iiq.order_no=#{orderNo}
+ and iiq.part_no=#{partNo}
+ and iiq.line_no=#{lineNo}
+ and iiq.release_no=#{releaseNo}
+ and iiq.receipt_no=#{receiptNo}
+ and iiq.is_split_order=1
+ and (iiq.is_finish != 1 or isor.sync_status != 1)
+ and (io.id is null or io.is_exemption != 1)
+ </select>
</mapper>
diff --git a/basic-server/src/main/resources/mapper/SealMapper.xml b/basic-server/src/main/resources/mapper/SealMapper.xml
index 5cb3595..79e036c 100644
--- a/basic-server/src/main/resources/mapper/SealMapper.xml
+++ b/basic-server/src/main/resources/mapper/SealMapper.xml
@@ -4,8 +4,8 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.SealMapper">
<select id="selectSeal" resultType="com.ruoyi.basic.pojo.Seal">
- select l.id,s.lab_id,l.laboratory_name ,s.address, s.type as Type,s.create_time
- from seal s LEFT JOIN laboratory l on s.lab_id=l.id
+ select * from (select l.id,s.lab_id,l.laboratory_name ,s.address, s.type as Type,s.create_time
+ from seal s LEFT JOIN laboratory l on s.lab_id=l.id) a
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
diff --git a/basic-server/src/main/resources/mapper/StandardMethodListMapper.xml b/basic-server/src/main/resources/mapper/StandardMethodListMapper.xml
deleted file mode 100644
index 957fd1f..0000000
--- a/basic-server/src/main/resources/mapper/StandardMethodListMapper.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.basic.mapper.StandardMethodListMapper">
-
- <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.StandardMethodList">
- <id property="id" column="id" jdbcType="INTEGER"/>
- <result property="code" column="code" jdbcType="VARCHAR"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="remark" column="remark" jdbcType="VARCHAR"/>
- <result property="createUser" column="create_user" jdbcType="INTEGER"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- </resultMap>
-
- <select id="selectStandardMethodById" resultType="java.util.Map">
- select code, name, remark
- from standard_method
- where id = #{id}
- </select>
- <select id="selectUserById" resultType="java.lang.String">
- select name
- from user
- where id = #{id}
- </select>
- <select id="selectStandardMethodLists" resultType="com.ruoyi.basic.pojo.StandardMethodList">
- select id, code, name, remark
- from standard_method
- where is_use = 1
- and is_product = 1
- and structure_test_object_id LIKE CONCAT('%[', #{tree}, ']%')
- </select>
- <select id="selectParameterList" resultType="com.ruoyi.basic.pojo.StandardProductList">
- select inspection_item,
- inspection_item_subclass,
- laboratory,
- unit,
- price,
- man_hour,
- man_hour_group,
- inspection_item_type,
- inspection_value_type,
- checkout_number,
- section,
- method,
- man_day,
- bsm,
- template_id,
- son_laboratory
- from structure_item_parameter
- where method = #{code}
- </select>
- <select id="selectStandardMethodLists2" resultType="com.ruoyi.basic.pojo.StandardMethodList">
- select sml.id, sml.code, sml.name,sml.remark, sml.create_time, u.name create_user_name
- from standard_method_list sml
- left join user u on u.id = sml.create_user
- where factory = #{data1}
- <if test="data2 != null">
- and laboratory = #{data2}
- </if>
- <if test="data3 != null">
- and sample_type = #{data3}
- </if>
- <if test="data4 != null">
- and sample = #{data4}
- </if>
- <if test="data5 != null">
- and model = #{data5}
- </if>
- </select>
- <select id="selectStandardMethodLists3" resultType="com.ruoyi.basic.pojo.StandardMethodList">
- select id, code, name, remark
- from standard_method
- where is_use = 1
- and is_product = 1
- and structure_test_object_id LIKE CONCAT('%', #{tree}, '%')
- </select>
- <select id="selectListEnum" resultType="com.ruoyi.basic.pojo.StandardMethodList">
- select id,code,name from standard_method
- where is_product = 1
- and is_use = 1
- </select>
- <select id="selectStandardMethodListsByNull" resultType="com.ruoyi.basic.pojo.StandardMethodList">
- select id, code, name, remark
- from standard_method
- where is_use = 1
- and is_product = 1
- and (
- structure_test_object_id is null
- OR structure_test_object_id = ''
- OR structure_test_object_id = '[]'
- )
- </select>
- <select id="getStandardMethodId" resultType="java.lang.Integer">
- select id from standard_method where code = #{code}
- </select>
-</mapper>
diff --git a/basic-server/src/main/resources/mapper/StandardMethodMapper.xml b/basic-server/src/main/resources/mapper/StandardMethodMapper.xml
index 739d2d4..b48f4d0 100644
--- a/basic-server/src/main/resources/mapper/StandardMethodMapper.xml
+++ b/basic-server/src/main/resources/mapper/StandardMethodMapper.xml
@@ -21,7 +21,6 @@
sm.code,
sm.name,
sm.structure_test_object_id,
- sto.specimen_name sample_type,
sm.remark,
u1.name create_user_name,
sm.create_time,
@@ -31,11 +30,14 @@
sm.field,
sm.name_en,
sm.is_use,
- sm.qualification_id
+ sm.qualification_id,
+ COALESCE((SELECT GROUP_CONCAT(l.laboratory_name ORDER BY COALESCE(l.sort, 0), l.id SEPARATOR '銆�')
+ FROM standard_method_industry smi JOIN laboratory l ON l.id = smi.industry_id
+ WHERE smi.standard_method_id = sm.id), '') industry_names,
+ (SELECT COUNT(*) FROM standard_method_attachment sma WHERE sma.standard_method_id = sm.id) attachment_count
from standard_method sm
left join user u1 on sm.create_user = u1.id
left join user u2 on sm.update_user = u2.id
- left join structure_test_object sto on sm.structure_test_object_id = sto.id
where sm.code != '鎶�鏈姹�'
) a
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
@@ -64,4 +66,49 @@
left join structure_test_object sto on sm.structure_test_object_id = sto.id
where sm.id = #{id}
</select>
+
+ <select id="selectStandardMethodLists" resultType="com.ruoyi.basic.pojo.StandardMethodList">
+ select id, code, name, remark
+ from standard_method
+ where is_use = 1
+ and is_product = 1
+ and structure_test_object_id LIKE CONCAT('%[', #{tree}, ']%')
+ </select>
+
+ <select id="selectStandardMethodLists3" resultType="com.ruoyi.basic.pojo.StandardMethodList">
+ select id, code, name, remark
+ from standard_method
+ where is_use = 1
+ and is_product = 1
+ and structure_test_object_id LIKE CONCAT('%', #{tree}, '%')
+ </select>
+ <select id="selectStandardMethodListsByIndustry" resultType="com.ruoyi.basic.pojo.StandardMethodList">
+ select sm.id, sm.code, sm.name, sm.remark
+ from standard_method sm
+ inner join standard_method_industry smi on smi.standard_method_id = sm.id
+ inner join laboratory l on l.id = smi.industry_id
+ where sm.is_use = 1
+ and sm.is_product = 1
+ and l.laboratory_name = #{industry}
+ order by sm.id
+ </select>
+ <select id="selectListEnum" resultType="com.ruoyi.basic.pojo.StandardMethodList">
+ select id,code,name from standard_method
+ where is_product = 1
+ and is_use = 1
+ </select>
+ <select id="selectStandardMethodListsByNull" resultType="com.ruoyi.basic.pojo.StandardMethodList">
+ select id, code, name, remark
+ from standard_method
+ where is_use = 1
+ and is_product = 1
+ and (
+ structure_test_object_id is null
+ OR structure_test_object_id = ''
+ OR structure_test_object_id = '[]'
+ )
+ </select>
+ <select id="getStandardMethodId" resultType="java.lang.Integer">
+ select id from standard_method where code = #{code}
+ </select>
</mapper>
diff --git a/basic-server/src/main/resources/mapper/StandardProductListMapper.xml b/basic-server/src/main/resources/mapper/StandardProductListMapper.xml
index 52d6bfe..2f380a4 100644
--- a/basic-server/src/main/resources/mapper/StandardProductListMapper.xml
+++ b/basic-server/src/main/resources/mapper/StandardProductListMapper.xml
@@ -27,6 +27,19 @@
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
+
+ <!-- 鎵归噺娣诲姞妫�娴嬫爣鍑� -->
+ <insert id="saveBatchProductLists">
+ INSERT INTO standard_product_list (id, inspection_item, inspection_item_en, inspection_item_subclass, inspection_item_subclass_en, factory, laboratory, sample_type, sample, model, son_laboratory, unit, price, man_hour, man_hour_group, inspection_item_type, inspection_value_type, checkout_number, section, cores, method, method_s, man_day, bsm, ask, tell, standard_method_list_id, template_id, state, dic, tree, structure_item_parameter_id, inspection_item_class, inspection_item_class_en, radius, radius_list, rates, sort, conductor_material, conductor_type)
+ VALUES
+ <foreach item="item" collection="productLists" open="(" separator="),(" close=")">
+ #{item.id}, #{item.inspectionItem}, #{item.inspectionItemEn}, #{item.inspectionItemSubclass}, #{item.inspectionItemSubclassEn}, #{item.factory}, #{item.laboratory}, #{item.sampleType}, #{item.sample}, #{item.model}, #{item.sonLaboratory}, #{item.unit}, #{item.price}, #{item.manHour}, #{item.manHourGroup}, #{item.inspectionItemType}, #{item.inspectionValueType}, #{item.checkoutNumber}, #{item.section}, #{item.cores}, #{item.method}, #{item.methodS}, #{item.manDay}, #{item.bsm}, #{item.ask}, #{item.tell}, #{item.standardMethodListId}, #{item.templateId}, #{item.state}, #{item.dic}, #{item.tree}, #{item.structureItemParameterId},
+ #{item.inspectionItemClass}, #{item.inspectionItemClassEn}, #{item.radius}, #{item.radiusList}, #{item.rates}, #{item.sort}, #{item.conductorMaterial}, #{item.conductorType}
+ </foreach>
+
+ </insert>
+
+
<update id="updateSection">
UPDATE standard_product_list
SET price=#{productList.price},
diff --git a/basic-server/src/main/resources/mapper/StandardTemplateMapper.xml b/basic-server/src/main/resources/mapper/StandardTemplateMapper.xml
index 34a8b0e..a3d74b0 100644
--- a/basic-server/src/main/resources/mapper/StandardTemplateMapper.xml
+++ b/basic-server/src/main/resources/mapper/StandardTemplateMapper.xml
@@ -17,7 +17,7 @@
<select id="selectStandardTemplatePageList" resultType="com.ruoyi.basic.pojo.StandardTemplate">
select * from (
- select st.id, st.name,st.number, st.remark, u2.name create_user_name, u3.name update_user_name, st.create_time, st.update_time
+ select st.id, st.name,st.number, st.price, st.remark, u2.name create_user_name, u3.name update_user_name, st.create_time, st.update_time
from standard_template st
left join user u2 on u2.id = st.create_user
left join user u3 on u3.id = st.update_user
@@ -36,5 +36,9 @@
WHERE id = #{templateId}
</select>
+ <select id="countBindTemplateItemParameter">
+ SELECT COUNT(*) FROM structure_item_parameter WHERE template_id = #{templateId}
+ </select>
+
</mapper>
diff --git a/basic-server/src/main/resources/mapper/StandardTreeMapper.xml b/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
index 74ded82..f13da93 100644
--- a/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
+++ b/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -10,6 +10,8 @@
<result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
<result property="sample" column="sample" jdbcType="VARCHAR"/>
<result property="model" column="model" jdbcType="VARCHAR"/>
+ <result property="sort" column="sort" jdbcType="INTEGER"/>
+ <result property="standardMethodId" column="standard_method_id" jdbcType="INTEGER"/>
<result property="createUser" column="create_user" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUser" column="update_user" jdbcType="INTEGER"/>
@@ -89,24 +91,106 @@
rates
</sql>
- <select id="selectStandardTreeList" resultMap="FactoryDto">
- select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory,
- l.laboratory_name laboratory,
- sto.specimen_name sample_type,
- p.name sample,
- st.model,
- sto.code,
- sto.id sample_type_id,
- sto.sort,
- sto.specimen_name_en sample_type_en,
- p.name_en sample_en
- from laboratory l
- left join structure_test_object sto on sto.laboratory_id = l.id
- left join product p on p.object_id = sto.id
- left join standard_tree st on st.sample_type = sto.specimen_name
- and st.sample = p.name
- order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL(st.id), st.id
+ <select id="selectStandardLibraryTree" resultType="com.ruoyi.basic.dto.StandardLibraryTreeRowDto">
+ SELECT l.id AS industry_id,
+ l.laboratory_name AS industry_name,
+ l.sort AS industry_sort,
+ st.id AS standard_id,
+ sm.id AS standard_method_id,
+ sm.code AS standard_code,
+ sm.name AS standard_name,
+ sm.name_en AS standard_name_en,
+ CONCAT(sm.code, ' - ', sm.name) AS standard_label,
+ st.sort AS standard_sort
+ FROM laboratory l
+ LEFT JOIN standard_tree st
+ ON st.laboratory = l.laboratory_name
+ AND st.sample_type IS NULL
+ AND st.model IS NULL
+ AND st.standard_method_id IS NOT NULL
+ AND EXISTS (SELECT 1 FROM standard_method sm0
+ WHERE sm0.id = st.standard_method_id
+ AND sm0.is_product = 1 AND sm0.is_use = 1)
+ LEFT JOIN standard_method sm ON sm.id = st.standard_method_id
+ ORDER BY COALESCE(l.sort, 0), l.id,
+ COALESCE(st.sort, 0), st.id
</select>
+
+ <update id="updateProductListIndustry">
+ UPDATE standard_product_list
+ SET laboratory = #{newName},
+ tree = CASE WHEN sample_type IS NULL AND model IS NULL AND sample IS NOT NULL
+ THEN CONCAT(#{newName}, ' - null - ', sample)
+ ELSE tree END
+ WHERE laboratory = #{oldName}
+ </update>
+
+ <update id="updateProductListStandard">
+ UPDATE standard_product_list
+ SET sample = #{newName},
+ tree = CONCAT(#{industry}, ' - null - ', #{newName})
+ WHERE laboratory = #{industry}
+ AND sample = #{oldName}
+ AND sample_type IS NULL
+ AND model IS NULL
+ </update>
+
+ <update id="updateInsOrderIndustry">
+ UPDATE ins_order
+ SET laboratory = #{newName}
+ WHERE laboratory = #{oldName}
+ AND (state IS NULL OR state NOT IN (3, -1))
+ AND (ins_state IS NULL OR ins_state != 5)
+ </update>
+
+ <update id="updateInsSampleIndustry">
+ UPDATE ins_sample s
+ JOIN ins_order o ON o.id = s.ins_order_id
+ SET s.laboratory = #{newName}
+ WHERE s.laboratory = #{oldName}
+ AND (o.state IS NULL OR o.state NOT IN (3, -1))
+ AND (o.ins_state IS NULL OR o.ins_state != 5)
+ </update>
+
+ <update id="updateInsProductIndustry">
+ UPDATE ins_product p
+ JOIN ins_sample s ON s.id = p.ins_sample_id
+ JOIN ins_order o ON o.id = s.ins_order_id
+ SET p.laboratory = #{newName}
+ WHERE p.laboratory = #{oldName}
+ AND (o.state IS NULL OR o.state NOT IN (3, -1))
+ AND (o.ins_state IS NULL OR o.ins_state != 5)
+ </update>
+
+ <update id="updateInsOrderStandard">
+ UPDATE ins_order
+ SET sample = #{newName}
+ WHERE laboratory = #{industry}
+ AND sample = #{oldName}
+ AND (state IS NULL OR state NOT IN (3, -1))
+ AND (ins_state IS NULL OR ins_state != 5)
+ </update>
+
+ <update id="updateInsSampleStandard">
+ UPDATE ins_sample s
+ JOIN ins_order o ON o.id = s.ins_order_id
+ SET s.sample = #{newName}
+ WHERE s.laboratory = #{industry}
+ AND s.sample = #{oldName}
+ AND (o.state IS NULL OR o.state NOT IN (3, -1))
+ AND (o.ins_state IS NULL OR o.ins_state != 5)
+ </update>
+
+ <update id="updateInsProductStandard">
+ UPDATE ins_product p
+ JOIN ins_sample s ON s.id = p.ins_sample_id
+ JOIN ins_order o ON o.id = s.ins_order_id
+ SET p.sample = #{newName}
+ WHERE p.laboratory = #{industry}
+ AND p.sample = #{oldName}
+ AND (o.state IS NULL OR o.state NOT IN (3, -1))
+ AND (o.ins_state IS NULL OR o.ins_state != 5)
+ </update>
<select id="selectStandardProductById" resultType="com.ruoyi.basic.pojo.StandardProductList">
select inspection_item,
@@ -154,17 +238,9 @@
or sp.sample = ''
or sp.sample = '[]'
</select>
- <select id="getStandardMethodListBySample" resultType="com.ruoyi.basic.pojo.StandardMethodList">
- select sm.code,sm.name,sm.remark from standard_method sm
- left join structure_test_object sto on sm.structure_test_object_id = sto.id
- where is_use = 1
- and is_product = 1
- <if test="sampleType != null">
- and sto.specimen_name = #{sampleType}
- </if>
- </select>
+
<select id="selectStandardTreeList2" resultType="com.ruoyi.basic.pojo.StandardTree">
- select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory,
+ select '' factory,
l.laboratory_name laboratory,
sto.specimen_name sample_type,
p.name sample
@@ -202,6 +278,44 @@
order by inspection_item_class, inspection_item, id asc
</select>
+ <select id="selectStandardProductListByIndustry" resultType="com.ruoyi.basic.pojo.StandardProductList">
+ select inspection_item,
+ inspection_item_en,
+ inspection_item_subclass,
+ inspection_item_subclass_en,
+ inspection_item_class,
+ inspection_item_class_en,
+ method,
+ son_laboratory,
+ unit,
+ ask_tell as tell,
+ ask,
+ price,
+ man_hour,
+ man_hour_group,
+ man_day,
+ inspection_item_type,
+ inspection_value_type,
+ bsm,
+ template_id,
+ laboratory,
+ checkout_number,
+ section,
+ dic,
+ 0 as state,
+ null as model,
+ #{standard} as sample,
+ #{tree} as tree,
+ id as structure_item_parameter_id,
+ radius_list,
+ rates
+ from structure_item_parameter
+ where (laboratory is null
+ or laboratory = ''
+ or laboratory = #{industry})
+ order by inspection_item_class, inspection_item, id asc
+ </select>
+
<select id="getStandardTree2" resultMap="SampleTypeDto">
select sto.specimen_name sample_type,
p.name sample,
@@ -210,14 +324,6 @@
left join product p on p.object_id = sto.id
left join standard_tree st on st.sample_type = sto.specimen_name
and st.sample = p.name
- </select>
-
- <select id="getStandardTree3" resultType="com.ruoyi.basic.dto.SampleDto">
- select model label,
- model value
- from standard_tree
- where sample_type = #{sampleType}
- and sample is null
</select>
<select id="getLaboratory" resultType="java.lang.String">
@@ -253,7 +359,7 @@
where name = #{name}
</select>
<select id="selectStandardTreeListByPartNo" resultMap="FactoryDto">
- select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory,
+ select '' factory,
l.laboratory_name laboratory,
sto.specimen_name sample_type,
p.name sample,
@@ -296,10 +402,12 @@
ir1.id enter_report_id,
ir1.url enter_url,
ir1.url_s enter_url_s,
+ ir1.is_ratify enter_ratify_status,
io2.id quarter_order_id,
ir2.id quarter_report_id,
ir2.url quarter_url,
ir2.url_s quarter_url_s,
+ ir2.is_ratify quarter_ratify_status,
group_concat(distinct isa.sample_code, ' ') sample_code,
group_concat(distinct isa.sample, ' ') sample_name,
group_concat(distinct isa.model, ' ') sample_model,
@@ -330,13 +438,15 @@
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
+ order by send_time desc
</select>
- <select id="selectIfsPage" resultType="com.ruoyi.basic.pojo.IfsInventoryQuantity">
+ <select id="selectIfsPage" resultType="com.ruoyi.basic.vo.IfsInventoryQuantityVO">
SELECT * from ifs_inventory_quantity ifs
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
+ ORDER BY declare_date DESC
</select>
<select id="selectIfsInventoryQuantity" resultType="com.ruoyi.basic.dto.IfsInventoryQuantityCheckDto">
SELECT * from ifs_inventory_quantity ifs
@@ -348,19 +458,20 @@
select * from (<include refid="getIfsOrder"/>
<where>
<if test="beginDeclareDate != null and beginDeclareDate != '' and endDeclareDate != null and endDeclareDate != ''">
- send_time between #{beginDeclareDate} and #{endDeclareDate}
+ declare_date between #{beginDeclareDate} and #{endDeclareDate}
</if>
</where>
) a
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
+ order by send_time desc
</select>
<select id="getIfsByOverList" resultType="com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto">
select * from (<include refid="getIfsOrder"/>
<where>
<if test="beginDeclareDate != null and beginDeclareDate != '' and endDeclareDate != null and endDeclareDate != ''">
- send_time between #{beginDeclareDate} and #{endDeclareDate}
+ declare_date between #{beginDeclareDate} and #{endDeclareDate}
</if>
</where>
) a
@@ -373,7 +484,7 @@
<where>
and (quarter_order_id is not null)
<if test="beginDeclareDate != null and beginDeclareDate != '' and endDeclareDate != null and endDeclareDate != ''">
- and send_time between #{beginDeclareDate} and #{endDeclareDate}
+ and declare_date between #{beginDeclareDate} and #{endDeclareDate}
</if>
</where>
) a
@@ -381,4 +492,34 @@
${ew.customSqlSegment}
</if>
</select>
+
+ <select id="getStandardTree3Batch" resultType="com.ruoyi.basic.dto.SampleDto">
+ select model label,
+ model value
+ from standard_tree
+ where sample is null
+ <if test="sampleTypeValues != null and sampleTypeValues.size() > 0">
+ and sample_type in
+ <foreach item="item" collection="sampleTypeValues" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </if>
+ </select>
+
+ <select id="getStandardTree3" resultType="com.ruoyi.basic.dto.SampleDto">
+ select model label,
+ model value
+ from standard_tree
+ where sample_type = #{sampleType}
+ and sample is null
+ </select>
+
+ <!-- 鏍规嵁鍘熸潗鏂檌d鍒楄〃鏌ヨ鍘熸潗鏂欎俊鎭� -->
+ <select id="getIfsByIds" resultType="com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto">
+ <include refid="getIfsOrder"/>
+ where id in
+ <foreach item="id" collection="ifsIds" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </select>
</mapper>
diff --git a/basic-server/src/main/resources/mapper/StandardTreeTemplateDeviceMapper.xml b/basic-server/src/main/resources/mapper/StandardTreeTemplateDeviceMapper.xml
new file mode 100644
index 0000000..894e3f0
--- /dev/null
+++ b/basic-server/src/main/resources/mapper/StandardTreeTemplateDeviceMapper.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.basic.mapper.StandardTreeTemplateDeviceMapper">
+ <select id="selectExistingDeviceIds" resultType="java.lang.Integer">
+ select id from device where id in
+ <foreach collection='deviceIds' item='deviceId' open='(' separator=',' close=')'>
+ #{deviceId}
+ </foreach>
+ </select>
+</mapper>
diff --git a/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml b/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
index fd67dfc..c18b8e7 100644
--- a/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
+++ b/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -3,11 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StructureItemParameterMapper">
- <delete id="removeNoSample">
- delete
- from structure_item_parameter
- where sample like concat('%', #{sample}, '%')
- </delete>
+
<select id="selectItemParameterList" resultType="com.ruoyi.basic.pojo.StructureItemParameter">
select * from (select A.id,
inspection_item,
@@ -40,7 +36,9 @@
inspection_item_class_en,
code,
radius_list,
- rates
+ rates,
+ device_ids,
+ spot_check_type
from (select *,
CASE
WHEN INSTR(sample, ',') > 0 THEN
@@ -108,6 +106,13 @@
from structure_test_object sto
left join product p on p.object_id = sto.id
</select>
+ <select id="selectDeviceIdsByNumber" resultType="java.lang.Integer">
+ select id from device
+ where management_number in
+ <foreach item="item" collection="managementNumberList" open="(" separator="),(" close=")">
+ #{item}
+ </foreach>
+ </select>
<resultMap id="itemDto" type="com.ruoyi.basic.dto.TestItemDto">
<result column="sId" property="id"/>
diff --git a/basic-server/src/main/resources/mapper/StructureTestMapper.xml b/basic-server/src/main/resources/mapper/StructureTestMapper.xml
index 05c7ae7..a17b51a 100644
--- a/basic-server/src/main/resources/mapper/StructureTestMapper.xml
+++ b/basic-server/src/main/resources/mapper/StructureTestMapper.xml
@@ -31,6 +31,7 @@
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
+
</select>
</mapper>
diff --git a/inspect-server/pom.xml b/inspect-server/pom.xml
index b202918..8676135 100644
--- a/inspect-server/pom.xml
+++ b/inspect-server/pom.xml
@@ -29,12 +29,62 @@
<artifactId>ruoyi-system</artifactId>
</dependency>
+ <!--涓氬姟妯″潡-->
+ <dependency>
+ <groupId>com.ruoyi</groupId>
+ <artifactId>basic-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.ruoyi</groupId>
+ <artifactId>performance-server</artifactId>
+ </dependency>
+
<!-- MyBatis-Plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot4-starter</artifactId>
</dependency>
+ <!-- Excel 宸ュ叿 -->
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>easyexcel</artifactId>
+ </dependency>
+
+ <!-- hutool 宸ュ叿绫� -->
+ <dependency>
+ <groupId>cn.hutool</groupId>
+ <artifactId>hutool-all</artifactId>
+ </dependency>
+
+ <!-- fastjson v1 API 鍏煎鍖� -->
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ </dependency>
+
+ <!-- poi-tl锛歐ord 鎶ヨ〃妯℃澘濉厖 -->
+ <dependency>
+ <groupId>com.deepoove</groupId>
+ <artifactId>poi-tl</artifactId>
+ </dependency>
+
+ <!-- word 杞� pdf -->
+ <dependency>
+ <groupId>com.aspose</groupId>
+ <artifactId>aspose-words</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.itextpdf</groupId>
+ <artifactId>itextpdf</artifactId>
+ </dependency>
+
+ <!-- MockMultipartFile锛歑WPFDocument 鍖呰鎴� MultipartFile 鏃朵娇鐢� -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ </dependency>
+
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
diff --git a/inspect-server/src/main/java/com/ruoyi/basic/pojo/InsSample.java b/inspect-server/src/main/java/com/ruoyi/basic/pojo/InsSample.java
deleted file mode 100644
index bceec47..0000000
--- a/inspect-server/src/main/java/com/ruoyi/basic/pojo/InsSample.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.ruoyi.basic.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-/**
- * 妫�楠屾牱鍝�
- * @TableName ins_sample
- */
-@TableName(value ="ins_sample")
-@Data
-public class InsSample implements Serializable {
- /**
- *
- */
- @TableId(type = IdType.AUTO)
- private Integer id;
-
- /**
- * 1锛氬悎鏍� 0锛氫笉鍚堟牸
- */
- private Integer insResult;
-
- /**
- * 澶栭敭锛歩ns_order琛╥d
- */
- private Integer insOrderId;
-
- /**
- * 閰嶅鏍峰搧鍨嬪彿
- */
- private String joinModel;
-
- /**
- * 閰嶅鏍峰搧鍚嶇О
- */
- private String joinName;
-
- /**
- * 閰嶅鏍峰搧鏁伴噺
- */
- private Integer joinNum;
-
- /**
- * 鏍峰搧缂栫爜
- */
- private String sampleCode;
-
- /**
- * 妫�楠屽伐鍘�
- */
- private String factory;
-
- /**
- * 瀹為獙瀹ゅ悕绉�
- */
- private String laboratory;
-
- /**
- * 鏍峰搧绫诲瀷
- */
- private String sampleType;
-
- /**
- * 鏍峰搧鍚嶇О
- */
- private String sample;
-
- /**
- * 瑙勬牸鍨嬪彿
- */
- private String model;
-
- /**
- * 妫�楠岀姸鎬�(0锛氬緟妫�楠�1:妫�楠屼腑 2:宸叉楠�3锛氬緟澶嶆牳4锛氬鏍告湭閫氳繃5锛氬鏍搁�氳繃)
- */
- private Integer insState;
-
- /**
- * 澶囨敞
- */
- private String remark;
-
- private Integer standardMethodListId;
-
- @Schema(description = "鏍峰搧鍗曚綅")
- private String unit;
-
- private Integer cellId;
-
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private LocalDateTime createTime;
-
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private LocalDateTime updateTime;
-
- private Integer parentId;
-
- @Schema(description = "鏁伴噺")
- private Integer quantity;
-
- @Schema(description = "鐗规畩鏍囧噯鏂规硶")
- private String specialStandardMethod;
-
- @TableField(select = false,exist = false)
- private Integer num=1;
-
-}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/DataAnalysisController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/DataAnalysisController.java
new file mode 100644
index 0000000..2540d16
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/DataAnalysisController.java
@@ -0,0 +1,127 @@
+package com.ruoyi.inspect.controller;
+
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.DataAnalysisDto;
+import com.ruoyi.inspect.service.DataAnalysisService;
+import com.ruoyi.inspect.vo.DeviationAnalyzeVo;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @Author zhuo
+ * @Date 2024/10/16
+ */
+@RequestMapping("/dataAnalysis")
+@RestController
+@AllArgsConstructor
+@Tag(name = "鏁版嵁鍒嗘瀽")
+public class DataAnalysisController {
+
+ private DataAnalysisService dataAnalysisService;
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欐煴鐘剁粺璁�
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ鍘熸潗鏂欐煴鐘剁粺璁�")
+ @GetMapping("/getRawPassRateByBarChart")
+ public Result getRawPassRateByBarChart(DataAnalysisDto dataAnalysisDto) {
+ return Result.success(dataAnalysisService.getRawPassRateByBarChart(dataAnalysisDto));
+ }
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欐煴鐘剁粺璁�
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ鍘熸潗鏂欏悎鏍肩巼楗肩姸鎬�")
+ @GetMapping("/getRawPassRateByCake")
+ public Result getRawPassRateByCake(DataAnalysisDto dataAnalysisDto) {
+ return Result.success(dataAnalysisService.getRawPassRateByCake(dataAnalysisDto));
+ }
+
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓」
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ鍘熸潗鏂欓」")
+ @GetMapping("/getRawItemNames")
+ public Result getRawItemNames(DataAnalysisDto dataAnalysisDto) {
+ return Result.success(dataAnalysisService.getRawItemNames(dataAnalysisDto));
+ }
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓」妫�鍒嗘瀽
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ鍘熸潗鏂欓」妫�鍒嗘瀽")
+ @PostMapping("/getRawProductAnalysis")
+ public Result getRawProductAnalysis(@RequestBody DataAnalysisDto dataAnalysisDto) {
+ return Result.success(dataAnalysisService.getRawProductAnalysis(dataAnalysisDto));
+ }
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓」妫�鍒嗘瀽鍒楄〃
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ鍘熸潗鏂欓」妫�鍒嗘瀽鍒楄〃")
+ @PostMapping("/getRawProductAnalysisAllList")
+ public Result<List<IfsInventoryQuantitySupplierDto>> getRawProductAnalysisAllList(@RequestBody DataAnalysisDto dataAnalysisDto) {
+ return Result.success(dataAnalysisService.getRawProductAnalysisAllList(dataAnalysisDto));
+ }
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓」妫�鍒嗘瀽鍒楄〃
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ鍘熸潗鏂欓」妫�鍒嗘瀽鍚堟牸鐜�")
+ @PostMapping("/getRawProductAnalysisRawPass")
+ public Result getRawProductAnalysisRawPass(@RequestBody DataAnalysisDto dataAnalysisDto) {
+ return Result.success(dataAnalysisService.getRawProductAnalysisRawPass(dataAnalysisDto));
+ }
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓」妫�鍜屽巶瀹舵暟鎹姣�
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ鍘熸潗鏂欓」妫�鍜屽巶瀹舵暟鎹姣�")
+ @PostMapping("/getRawSupplierCompare")
+ public Result<DeviationAnalyzeVo> getRawSupplierCompare(@RequestBody DataAnalysisDto dataAnalysisDto) {
+ return Result.success(dataAnalysisService.getRawSupplierCompare(dataAnalysisDto));
+ }
+
+ /**
+ * 鏌ヨ鏈湀涓庝笂涓湀鍚堟牸鐜囧姣�
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ鏈湀涓庝笂涓湀鍚堟牸鐜囧姣�")
+ @GetMapping("/getRawUpMonth")
+ public Result getRawUpMonth(DataAnalysisDto dataAnalysisDto) {
+ return Result.success(dataAnalysisService.getRawUpMonth(dataAnalysisDto));
+ }
+
+ /**
+ * 鏌ヨ妫�楠岄」绫诲瀷楗煎浘
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ妫�楠岄」绫诲瀷楗煎浘")
+ @GetMapping("/getOrderTypeCookie")
+ public Result getOrderTypeCookie(DataAnalysisDto dataAnalysisDto) {
+ return Result.success(dataAnalysisService.getOrderTypeCookie(dataAnalysisDto));
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/FinishProductSpotCheckController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/FinishProductSpotCheckController.java
new file mode 100644
index 0000000..2a47718
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/FinishProductSpotCheckController.java
@@ -0,0 +1,198 @@
+package com.ruoyi.inspect.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.IfsStockQueryDTO;
+import com.ruoyi.inspect.dto.SpotCheckQuarterDto;
+import com.ruoyi.inspect.dto.SpotCheckYearDto;
+import com.ruoyi.inspect.service.FinishProductSpotCheckService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import jakarta.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * @Author zhuo
+ * @Date 2024/9/29
+ */
+@RequestMapping("/finishProductSpotCheck")
+@RestController
+@AllArgsConstructor
+@Tag(name = "鎴愬搧鎶芥牱")
+public class FinishProductSpotCheckController {
+
+ private FinishProductSpotCheckService finishProductSpotCheckService;
+
+ /**
+ * 鏌ヨifs搴撳瓨鏁伴噺
+ *
+ * @param ifsStockQueryDTO
+ * @return
+ */
+ @Operation(summary = "鏌ヨifs鎴愬搧搴撳瓨")
+ @PostMapping("/getIfsStock")
+ public Result getIfsStock(@RequestBody IfsStockQueryDTO ifsStockQueryDTO) {
+ return finishProductSpotCheckService.getIfsStockReport(ifsStockQueryDTO);
+ }
+
+ /******************************************************** 瀛e害鎶芥牱 ********************************************************/
+
+ /**
+ * 鏂板瀛e害鎶芥
+ *
+ * @param spotCheckQuarterDto
+ * @return
+ */
+ @Operation(summary = "鏂板瀛e害鎶芥")
+ @PostMapping("/addQuarter")
+ public Result addQuarter(@RequestBody SpotCheckQuarterDto spotCheckQuarterDto) {
+ return Result.success(finishProductSpotCheckService.addQuarter(spotCheckQuarterDto));
+ }
+
+ /**
+ * 鏌ヨ瀛e害鎶芥牱璇︽儏
+ *
+ * @param quarterId
+ * @return
+ */
+ @Operation(summary = "鏌ヨ瀛e害鎶芥牱璇︽儏")
+ @GetMapping("/getQuarter")
+ public Result getQuarter(Integer quarterId) {
+ return Result.success(finishProductSpotCheckService.getQuarter(quarterId));
+ }
+
+ /**
+ * 瀛e害鎶芥牱鍒楄〃
+ * @return
+ * @throws Exception
+ */
+ @Operation(summary = "瀛e害鎶芥牱鍒楄〃")
+ @GetMapping("/getQuarterPage")
+ public Result getQuarterPage(Page page, SpotCheckQuarterDto spotCheckQuarter) throws Exception {
+ return Result.success(finishProductSpotCheckService.getQuarterPage(page, spotCheckQuarter));
+ }
+
+ /**
+ * 鏂板瀛e害鎶芥
+ *
+ * @param quarterId
+ * @return
+ */
+ @Operation(summary = "鍒犻櫎瀛e害妫�楠�")
+ @DeleteMapping("/deleteQuarter")
+ public Result deleteQuarter(Integer quarterId) {
+ return Result.success(finishProductSpotCheckService.deleteQuarter(quarterId));
+ }
+
+ /**
+ * 鎴愬搧涓嬪崟鐣岄潰鏌ヨ瀛e害淇℃伅
+ *
+ * @return
+ */
+ @Operation(summary = "鎴愬搧涓嬪崟鐣岄潰鏌ヨ瀛e害淇℃伅")
+ @GetMapping("/getQuarterOnOrder")
+ public Result getQuarterOnOrder() {
+ return Result.success(finishProductSpotCheckService.getQuarterOnOrder());
+ }
+
+ /**
+ * 鎴愬搧涓嬪崟鐣岄潰鏌ヨ瀛e害淇℃伅
+ *
+ * @return
+ */
+ @Operation(summary = "淇敼瀛e害妫�楠�")
+ @PostMapping("/updateQuarterOnOrder")
+ public Result updateQuarterOnOrder(@RequestBody SpotCheckQuarterDto spotCheckQuarterDto) {
+ return Result.success(finishProductSpotCheckService.updateQuarterOnOrder(spotCheckQuarterDto));
+ }
+
+ /**
+ * 鎴愬搧涓嬪崟鐣岄潰鏌ヨ瀛e害淇℃伅
+ *
+ * @return
+ */
+ @Operation(summary = "鎻愪氦鏈�缁堝搴︽姤鍛�")
+ @GetMapping("/finalReportQuarter")
+ public void finalReportQuarter(Integer quarterId, HttpServletResponse response) {
+ finishProductSpotCheckService.finalReportQuarter(quarterId, response);
+ }
+
+
+
+
+
+ /******************************************************** 骞村害鎶芥牱 ********************************************************/
+
+ /**
+ * 鏂板骞村害鎶芥牱
+ *
+ * @param spotCheckYearDto
+ * @return
+ */
+ @Operation(summary = "鏂板骞村害鎶芥牱")
+ @PostMapping("/addSpotCheckYear")
+ public Result addSpotCheckYear(@RequestBody SpotCheckYearDto spotCheckYearDto) {
+ return Result.success(finishProductSpotCheckService.addSpotCheckYear(spotCheckYearDto));
+ }
+
+ /**
+ * 鏌ヨ瀛e害鎶芥牱璇︽儏
+ *
+ * @param yearId
+ * @return
+ */
+ @Operation(summary = "鏌ヨ骞村害鎶芥牱璇︽儏")
+ @GetMapping("/getSpotCheckYear")
+ public Result getSpotCheckYear(Integer yearId) {
+ return Result.success(finishProductSpotCheckService.getSpotCheckYear(yearId));
+ }
+
+ /**
+ * 瀛e害鎶芥牱鍒楄〃
+ * @return
+ * @throws Exception
+ */
+ @Operation(summary = "骞村害鎶芥牱鍒楄〃鍒楄〃")
+ @GetMapping("/getSpotCheckYearPage")
+ public Result getSpotCheckYearPage(Page page, SpotCheckYearDto spotCheckYear) throws Exception {
+ return Result.success(finishProductSpotCheckService.getSpotCheckYearPage(page, spotCheckYear));
+ }
+
+ /**
+ * 鍒犻櫎骞村害鎶芥牱
+ *
+ * @param yearId
+ * @return
+ */
+ @Operation(summary = "鍒犻櫎骞村害鎶芥牱")
+ @DeleteMapping("/deleteSpotCheckYear")
+ public Result deleteSpotCheckYear(Integer yearId) {
+ return Result.success(finishProductSpotCheckService.deleteSpotCheckYear(yearId));
+ }
+
+ /**
+ * 鎴愬搧涓嬪崟鐣岄潰鏌ヨ瀛e害淇℃伅
+ *
+ * @return
+ */
+ @Operation(summary = "淇敼骞村害妫�楠�")
+ @PostMapping("/updateSpotCheckYear")
+ public Result updateSpotCheckYear(@RequestBody SpotCheckYearDto spotCheckYearDto) {
+ return Result.success(finishProductSpotCheckService.updateSpotCheckYear(spotCheckYearDto));
+ }
+
+ /**
+ * 鎴愬搧涓嬪崟鐣岄潰鏌ヨ瀛e害淇℃伅
+ *
+ * @return
+ */
+ @Operation(summary = "鐢熸垚鏈�缁堝勾搴︽姤鍛�")
+ @GetMapping("/finalReportSpotCheckYear")
+ public Result finalReportSpotCheckYear(Integer yearId, HttpServletResponse response) {
+ return Result.success(finishProductSpotCheckService.finalReportSpotCheckYear(yearId, response));
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/IfsOrderInspectionController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/IfsOrderInspectionController.java
new file mode 100644
index 0000000..c052873
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/IfsOrderInspectionController.java
@@ -0,0 +1,38 @@
+package com.ruoyi.inspect.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.service.IfsOrderInspectionService;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * ifs閿�鍞鍗曟姤妫�controller
+ */
+@RestController
+@RequestMapping("/ifsOrderInspection")
+public class IfsOrderInspectionController {
+
+ @Autowired
+ private IfsOrderInspectionService ifsOrderInspectionService;
+
+ @Operation(summary = "閿�鍞鍗曟姤妫�鏌ヨ鍏ㄩ儴")
+ @PreAuthorize("@ss.hasPermi('get:Ifs:ByAll')")
+ @GetMapping("/getIfsByAll")
+ public Result getIfsByAll(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
+ return Result.success(ifsOrderInspectionService.getIfsByOver(page, ifsInventoryQuantityDto));
+ }
+
+ @Operation(summary = "閿�鍞鍗曟姤妫�鏌ョ湅宸插畬鎴愪俊鎭�")
+ @GetMapping("/getIfsByFinish")
+ public Result getIfsByFinish(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
+ ifsInventoryQuantityDto.setIsFinish(1);
+ return Result.success(ifsOrderInspectionService.getIfsByOver(page, ifsInventoryQuantityDto));
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/IfsPartPropsRecordController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/IfsPartPropsRecordController.java
new file mode 100644
index 0000000..933183f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/IfsPartPropsRecordController.java
@@ -0,0 +1,34 @@
+package com.ruoyi.inspect.controller;
+
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.IfsPartPropsRecordDTO;
+import com.ruoyi.inspect.service.IfsPartPropsRecordService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * ifs闆朵欢灞炴�ontroller
+ */
+@Tag(name = "ifs闆朵欢灞炴��")
+@RestController
+@RequestMapping("/ifsPartProps")
+public class IfsPartPropsRecordController {
+
+ @Autowired
+ private IfsPartPropsRecordService ifsPartPropsRecordService;
+
+ @Operation(summary = "鏂板鎴栦繚瀛橀浂浠跺睘鎬�")
+ @PostMapping("/saveOrUpdateProps")
+ public Result saveOrUpdateProps(@RequestBody IfsPartPropsRecordDTO ifsPartPropsRecord){
+ return Result.success(ifsPartPropsRecordService.saveOrUpdateProps(ifsPartPropsRecord));
+ }
+
+ @Operation(summary = "鏌ヨifs璁㈠崟鐨勯浂浠跺睘鎬ц褰�")
+ @GetMapping("/getOneByIfsId/{ifsId}")
+ public Result getOneByIfsId(@PathVariable("ifsId") Long ifsId){
+ return Result.success(ifsPartPropsRecordService.getOneByIfsId(ifsId));
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InformationNotificationController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InformationNotificationController.java
new file mode 100644
index 0000000..7938904
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InformationNotificationController.java
@@ -0,0 +1,55 @@
+package com.ruoyi.inspect.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.system.service.InformationNotificationService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 娑堟伅閫氱煡 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
+ * @since 2024-04-23 02:14:30
+ */
+@Tag(name = "娑堟伅閫氱煡")
+@RestController
+@RequestMapping("/informationNotification")
+public class InformationNotificationController {
+
+ @Autowired
+ private InformationNotificationService informationNotificationService;
+
+ @Operation(summary = "娑堟伅閫氱煡-婊氬姩鍒嗛〉鏌ヨ")
+ @GetMapping("page")
+ public Result<?> getPage(Long size, Long current, String messageType) {
+ return Result.success(informationNotificationService.getPage(new Page<>(current, size), messageType));
+ }
+
+ @Operation(summary = "娑堟伅閫氱煡-婊氬姩鏌ヨ")
+ @GetMapping("msgRoll")
+ public Result<?> msgRoll(Page page) {
+ return Result.success(informationNotificationService.msgRoll(page));
+ }
+
+ @Operation(summary = "娑堟伅閫氱煡-鐐瑰嚮璇︽儏瑙﹀彂淇敼鐘舵�佷负宸茶")
+ @PostMapping("triggerModificationStatusToRead")
+ public Result<?> triggerModificationStatusToRead(@RequestBody Map<String, Integer> params) {
+ Integer id = params.get("id");
+ informationNotificationService.triggerModificationStatusToRead(id);
+ return Result.success();
+ }
+
+ @Operation(summary = "娑堟伅閫氱煡-鏍囪鎵�鏈変俊鎭负宸茶/鍒犻櫎鎵�鏈夊凡璇绘秷鎭�")
+ @PostMapping("informationReadOrDelete/{isMarkAllInformationRead}")
+ public Result<?> markAllInformationReadOrDeleteAllReadMessages(@PathVariable("isMarkAllInformationRead") Boolean isMarkAllInformationRead) {
+ informationNotificationService.markAllInformationReadOrDeleteAllReadMessages(isMarkAllInformationRead);
+ return Result.success();
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java
new file mode 100644
index 0000000..a7ddb11
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java
@@ -0,0 +1,284 @@
+package com.ruoyi.inspect.controller;
+
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.InventoryDetailDTO;
+import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.pojo.StandardProductList;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.*;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsOrderTemplate;
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.inspect.pojo.InsSample;
+import com.ruoyi.inspect.service.InsOrderService;
+import com.ruoyi.inspect.service.InsOrderTemplateService;
+import com.ruoyi.inspect.service.InsProductService;
+import com.ruoyi.inspect.service.InsSampleService;
+import com.ruoyi.inspect.vo.InsOrderPrintingVo;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import jakarta.servlet.http.HttpServletResponse;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/insOrder")
+@Tag(name = "妫�楠屽崟妯″潡")
+public class InsOrderController {
+
+ private InsOrderService insOrderService;
+
+ private InsSampleService insSampleService;
+
+ private InsProductService insProductService;
+
+ private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
+
+ private InsOrderTemplateService insOrderTemplateService;
+
+ //鑾峰彇妫�楠屼笅鍗曟暟鎹�
+ @Operation(summary = "鏌ヨ鍗曚綅妫�楠屽崟")
+ @GetMapping("/selectInsOrderParameter")
+ public Result selectInsOrderParameter(Page page, SampleOrderDto sampleOrderDto) {
+ return Result.success(insOrderService.selectInsOrderParameter(page, sampleOrderDto));
+ }
+
+ @Operation(summary = "澶栬喘涓嬪崟鎴愬搧鏍囩鎵撳嵃")
+ @PostMapping("/labelOutsideOrderPrinting")
+ public Result<List<InventoryDetailDTO>> labelOutsideOrderPrinting(@RequestBody Map<String, Object> param) {
+ List<Integer> ids = (List<Integer>) param.get("ids");
+ return Result.success(insOrderService.labelOutsideOrderPrinting(ids));
+ }
+
+ //鐢ㄤ簬妫�楠屼笅鍗曞尯鍒煡鐪嬫墍鏈夎鍗曞拰鍙煡鐪嬪悓涓�涓鎵樺崟浣嶇殑璁㈠崟
+ @Operation(summary = "鏌ヨ鎵�鏈夋楠屽崟")
+ @GetMapping("/selectAllInsOrderParameter")
+ public Result selectAllInsOrderParameter() {
+ return Result.success();
+ }
+
+
+ @Operation(summary = "妫�楠屽垎閰�")
+ @PostMapping("/upInsOrder")
+ public Result<?> upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId,String sonLaboratory) {
+ return Result.fail("璇峰湪鏍峰搧鎺ユ敹椤甸潰閫夋嫨涓绘楠屼汉鍚庢彁浜ゆ楠�");
+ }
+
+ @Operation(summary = "娣诲姞妫�楠屼笅鍗曟暟鎹�")
+ @PreAuthorize("@ss.hasPermi('add:insOrder')")
+ @PostMapping("/addInsOrder")
+ public Result<?> addInsOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) {
+ if (insPlaceOrderDto.getStandardTreeId() != null) {
+ return Result.success(insOrderService.addNewJuInsOrder(insPlaceOrderDto));
+ }
+ return Result.success(insOrderService.addInsOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getInsOrder()));
+ }
+
+ @Operation(summary = "鏌ヨ璁㈠崟鏈�闀块璁℃椂闂�")
+ @GetMapping("/selectOrderManDay")
+ public Result<?> selectOrderManDay(Integer id) {
+ int day = insProductService.selectOrderManDay(id);
+ return Result.success(LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+ }
+
+ @Operation(summary = "鏌ヨ妫�楠屼笅鍗曞唴瀹硅鎯�")
+ @GetMapping("/getInsOrder")
+ public Result<?> getInsOrder(Integer orderId) {
+ return Result.success(insOrderService.getInsOrder(orderId));
+ }
+
+ @Operation(summary = "瀹℃牳妫�楠屽崟杩涜鐘舵�佷慨鏀�")
+ @PostMapping("/upInsOrderOfState")
+ public Result<?> upInsOrderOfState(@RequestBody InsOrder insOrder) {
+ return Result.success(insOrderService.upInsOrderOfState(insOrder));
+ }
+
+ @Operation(summary = "娣诲姞妫�楠屽崟妯℃澘")
+ @PostMapping("/addInsOrderTemplate")
+ public Result<?> addInsOrderTemplate(@RequestBody InsOrderTemplate insOrderTemplate) {
+ return Result.success(insOrderTemplateService.addInsOrderTemplate(insOrderTemplate));
+ }
+
+ @Operation(summary = "鏌ヨ妫�楠屽崟妯℃澘")
+ @GetMapping("/selectInsOrderTemplate")
+ public Result<?> selectInsOrderTemplate(String company) {
+ return Result.success(insOrderTemplateService.selectInsOrderTemplate(company));
+ }
+
+ @Operation(summary = "閫氳繃妫�楠屽崟妯℃澘id鑾峰彇妫�楠屽崟妯℃澘鍐呭")
+ @GetMapping("/selectInsOrderTemplateById")
+ public Result<?> selectInsOrderTemplateById(Integer id) {
+ return Result.success(insOrderTemplateService.selectInsOrderTemplateById(id));
+ }
+
+ @Operation(summary = "鍒犻櫎妫�楠屽崟妯℃澘")
+ @DeleteMapping("/delInsOrderTemplate")
+ public Result<?> delInsOrderTemplate(Integer id) {
+ return Result.success(insOrderTemplateService.delInsOrderTemplate(id));
+ }
+
+ @Operation(summary = "閫氳繃妫�楠屽崟鏌ヨ妫�楠屾暟鎹紙鏁版嵁鏌ョ湅锛�")
+ @GetMapping("/selectSampleAndProductByOrderId")
+ public Result<?> selectSampleAndProductByOrderId(Page page, SampleProductDto2 sampleProductDto){
+ return Result.success(insOrderService.selectSampleAndProductByOrderId(page, sampleProductDto));
+ }
+
+
+ @Operation(summary = "鎾ら攢")
+ @PostMapping("/updateStatus")
+ public Result<?> updateStatus(@RequestBody Map<String, Object> param) {
+ Integer id = (Integer) param.get("id");
+ insOrderService.updateStatus(id);
+ return Result.success();
+ }
+
+ //寰呮鐨勬挙閿�鐨勬煡璇㈠緟妫�椤圭洰
+ @GetMapping("/selectNoProducts")
+ public Result<?> selectNoProducts(Page page, InsProduct insProduct,Integer orderId ,String ids){
+ return Result.success(insProductService.selectNoProducts(page, insProduct,orderId,ids));
+ }
+
+ //鎾ら攢瀹℃牳锛屾煡璇㈡挙閿�鐨勬娴嬮」
+ @GetMapping("/getRevocationInsProductList")
+ public Result<?> getRevocationInsProductList(@RequestParam("orderId") Integer orderId){
+ return Result.success(insProductService.getRevocationInsProductList(orderId));
+ }
+
+
+ @Operation(summary = "寰呮鐨勬挙閿�")
+ @PostMapping("/updateInspected")
+ public Result<?> updateInspected(@RequestBody Map<String, Object> param){
+ Integer orderId = (Integer) param.get("orderId");
+ String ids = (String) param.get("ids");
+ Integer typeSource = (Integer) param.get("typeSource");
+ if(Objects.nonNull(typeSource) && typeSource == 1){
+ Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString());
+ ifsInventoryQuantityMapper.update(null,new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getState,0)
+ .eq(IfsInventoryQuantity::getId,ifsInventoryId));
+ insOrderService.update(null,new LambdaUpdateWrapper<InsOrder>().set(InsOrder::getState,-1).eq(InsOrder::getId,orderId)); // 鎾ら攢
+ }
+ insProductService.updateInspected(orderId,ids);
+ return Result.success();
+ }
+
+ @Operation(summary = "瀹℃牳寰呮鎾ら攢")
+ @PostMapping("/checkUpdate")
+ public Result<?> checkUpdate(@RequestBody Map<String, Object> param){
+ Integer orderId = (Integer) param.get("orderId");
+ Integer state = (Integer) param.get("state");
+ insProductService.checkUpdate(orderId,state);
+ return Result.success();
+ }
+
+
+ @Operation(summary = "鑾峰彇ifs璁㈠崟")
+ @GetMapping("/getIfsOrder")
+ public Result<?> getIfsOrder() {
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("LOCATION_NO","1302");
+ map.put("STATE_DB","To be Inspected");
+ insOrderService.getIfsOrder(map,false);
+ return Result.success();
+ }
+
+
+ @Operation(summary = "淇敼璁㈠崟鍗曞彿")
+ @PostMapping("/updateEntrustCode")
+ public Result<?> updateEntrustCode(@RequestBody InsOrder insOrder) {
+ insOrderService.updateEntrustCode(insOrder);
+ return Result.success();
+ }
+
+ @Operation(summary = "鏌ヨ涓嶅悎鏍煎娴嬩俊鎭�")
+ @GetMapping("/getRetestResult")
+ public Result<?> getRetestResult(Integer insProductId) {
+ return Result.success(insOrderService.getRetestResult(insProductId));
+ }
+
+ @Operation(summary = "淇敼濮旀墭缂栧彿")
+ @PostMapping("/updateOrderEntrustCode")
+ public Result<?> updateOrderEntrustCode(@RequestBody InsOrder insOrder) {
+ insOrderService.updateOrderEntrustCode(insOrder);
+ return Result.success();
+ }
+
+ @Operation(summary = "淇敼妫�楠屼笅鍗曞唴瀹�")
+ @PostMapping("/updateInsOrder")
+ public Result<?> updateInsOrder(@RequestBody InsOrderUpdateDto insOrderUpdateDto) {
+ return Result.success(insOrderService.updateInsOrder(insOrderUpdateDto));
+ }
+
+ @Operation(summary = "鍒犻櫎閫�鍥炶鍗�")
+ @DeleteMapping("/delInsOrder")
+ public Result<?> delInsOrder(Integer insOrderId) {
+ // 鏌ヨ璁㈠崟
+ InsOrder order = insOrderService.getById(insOrderId);
+ if (!(order.getState().equals(2) || order.getState().equals(3))) {
+ throw new ErrorException("鍙湁閫�鍥炶鍗曟墠鑳藉垹闄�");
+ }
+
+ return Result.success(insOrderService.removeById(insOrderId));
+ }
+
+ @Operation(summary = "鎴愬搧鏍囩鎵撳嵃")
+ @PostMapping("/labelOrderPrinting")
+ public Result<List<InsOrderPrintingVo>> labelOrderPrinting(@RequestBody Map<String, Object> param) {
+ List<Integer> ids = (List<Integer>) param.get("ids");
+ return Result.success(insOrderService.labelOrderPrinting(ids));
+ }
+
+ @Operation(summary = "鏍规嵁璁㈠崟id鏌ヨ鏍峰搧")
+ @GetMapping("/getSampleByOrderId")
+ public Result<List<InsSample>> getSampleByOrderId(Integer insOrderId) {
+ return Result.success(insSampleService.getSampleByOrderId(insOrderId));
+ }
+
+ @Operation(summary = "鏍规嵁鏍峰搧id鏌ヨ妫�楠岄」鏍�")
+ @GetMapping("/getProductTreeBySampleId")
+ public Result<List<StandardProductList>> getProductTreeBySampleId(Integer insSampleId) {
+ return Result.success(insOrderService.getProductTreeBySampleId(insSampleId));
+ }
+
+
+ @Operation(summary = "娣诲姞閬楁紡鐨勬楠岄」")
+ @PostMapping("/addOmitOrderProduct")
+ public Result addOmitOrderProduct(@RequestBody OmitOrderProductDto omitOrderProductDto) {
+ return Result.success(insOrderService.addOmitOrderProduct(omitOrderProductDto));
+ }
+
+ @Operation(summary = "鎴愬搧妫�楠屽崟鍏ㄩ儴淇℃伅瀵煎嚭")
+ @GetMapping("/rawAllInsOrderExport")
+ public void rawAllInsOrderExport(SampleOrderDto sampleOrderDto, HttpServletResponse response){
+ insOrderService.rawAllInsOrderExport(sampleOrderDto,response);
+ }
+
+
+ @Operation(summary = "淇敼鏍峰搧鍨嬪彿")
+ @PostMapping("/updateSampleModel")
+ public Result<?> updateSampleModel(@RequestBody List<InsSample> insSampleList) {
+ for (InsSample insSample : insSampleList) {
+ insOrderService.updateSampleModel(insSample);
+ }
+ return Result.success();
+ }
+
+ @Operation(summary = "鏌ヨ褰撳墠鏃堕棿鏄惁娌℃湁璇ユ娴嬮」鐨勬娊鏍疯鍒�")
+ @PostMapping("/judgeNotSpotCheckOrder")
+ public Result<?> judgeNotSpotCheckOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) {
+ return insOrderService.judgeNotSpotCheckOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getInsOrder());
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java
new file mode 100644
index 0000000..28e7a6a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java
@@ -0,0 +1,303 @@
+package com.ruoyi.inspect.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.InsOrderPlanDTO;
+import com.ruoyi.inspect.dto.InsOrderPlanProductDto;
+import com.ruoyi.inspect.dto.InsProductBindingDto;
+import com.ruoyi.inspect.dto.SaveInsContextDto;
+import com.ruoyi.inspect.dto.SaveOrderDevicesDto;
+import com.ruoyi.inspect.dto.SaveTemplateContextDto;
+import com.ruoyi.inspect.dto.VerifyPlanDto;
+import com.ruoyi.inspect.dto.WriteInspectionConditionDto;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsOrderFactoryVerify;
+import com.ruoyi.inspect.pojo.InsOrderFile;
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.inspect.service.InsOrderFileService;
+import com.ruoyi.inspect.service.InsOrderPlanService;
+import com.ruoyi.inspect.service.InsOrderRatesService;
+import com.ruoyi.inspect.service.InsProductService;
+import com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursTemporaryDto;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary;
+import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 妫�楠屼换鍔�-鎺у埗灞�
+ */
+@RestController
+@RequestMapping("/insOrderPlan")
+@Tag(name = "妫�楠屼换鍔�")
+@AllArgsConstructor
+public class InsOrderPlanController {
+
+ private InsOrderPlanService insOrderPlanService;
+ private InsOrderFileService insOrderFileService;
+ private InsProductService insProductService;
+ private AuxiliaryOutputWorkingHoursTemporaryService auxiliaryOutputWorkingHoursTemporaryService;
+
+
+ @Operation(summary = "鑾峰彇妫�楠屼换鍔″垪琛�")
+ @GetMapping("/selectInsOrderPlanList")
+ public Result selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO){
+ return Result.success(insOrderPlanService.selectInsOrderPlanList(page, insOrderPlanDTO));
+ }
+
+ @Operation(summary = "妫�楠屽崟璇︽儏-浠诲姟鍒囨崲")
+ @GetMapping("/inspectionOrderDetailsTaskSwitching")
+ public Result inspectionOrderDetailsTaskSwitching(Page page, InsOrderPlanDTO insOrderPlanDTO) throws Exception {
+ return Result.success(insOrderPlanService.inspectionOrderDetailsTaskSwitching(page, insOrderPlanDTO));
+ }
+
+ @Operation(summary = "璁ら浠诲姟璁″垝")
+ @PostMapping("/claimInsOrderPlan")
+ public Result claimInsOrderPlan(@RequestBody InsOrderPlanDTO data) {
+ return Result.success(insOrderPlanService.claimInsOrderPlan(data));
+ }
+
+
+ @Operation(summary = "鏌ヨ妫�楠屾搷浣�")
+ @GetMapping("/doInsOrder")
+ public Result<?> doInsOrder(Integer id, String laboratory) {
+ return Result.success(insOrderPlanService.doInsOrder(id, laboratory));
+ }
+
+ @Operation(summary = "鑾峰彇妫�楠岄」鐩拰妯℃澘鍐呭")
+ @GetMapping("/getInsProduct")
+ public Result<?> getInsProduct(InsOrderPlanProductDto insOrderPlanProductDto) {
+ return Result.success(insOrderPlanService.getInsProduct(insOrderPlanProductDto));
+ }
+
+
+ @Operation(summary = "浠诲姟浜ゆ帴")
+ @PostMapping("/upPlanUser")
+ public Result<?> upPlanUser(Integer userId, Integer orderId, String sonLaboratory) {
+ return Result.success(insOrderPlanService.upPlanUser(userId, orderId, sonLaboratory));
+ }
+
+ @Operation(summary = "鍒ゆ柇浜ゆ帴鐨勮瘯楠屽")
+ @GetMapping("/upPlanUser2")
+ public Result<?> upPlanUser2(Integer orderId) {
+ return Result.success(insOrderPlanService.upPlanUser2(orderId));
+ }
+
+
+ @Operation(summary = "澶嶆牳妫�楠屼换鍔�")
+ @PostMapping("/verifyPlan")
+ public Result<?> verifyPlan(@RequestBody VerifyPlanDto verifyPlanDto) {
+ return Result.success(insOrderPlanService.rawMaterialVerifyPlan(verifyPlanDto));
+ }
+
+ @Operation(summary = "鏍¢獙妫�楠屼换鍔℃彁浜�")
+ @PostMapping("/checkSubmitPlan")
+ public Result<?> checkSubmitPlan(Integer orderId, String laboratory) {
+ return Result.success(insOrderPlanService.checkSubmitPlan(orderId, laboratory));
+ }
+
+
+ @Operation(summary = "妫�楠屼换鍔℃彁浜�")
+ @PostMapping("/submitPlan")
+ public Result<?> submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode, Boolean registerInsResults) {
+ int num = insOrderPlanService.submitPlan(orderId, laboratory, verifyUser, entrustCode, registerInsResults);
+ return num == 1 ? Result.success() : Result.fail("鎻愪氦澶辫触锛岄儴鍒嗛」鐩繕鏈繘琛屾楠�");
+ }
+
+ @Operation(summary = "淇濆瓨妫�楠屽唴瀹�")
+ @PostMapping("/saveInsContext")
+ public Result<?> saveInsContext(@RequestBody SaveInsContextDto saveInsContextDto) {
+ insOrderPlanService.saveInsContext(saveInsContextDto);
+ return Result.success();
+ }
+
+ @Operation(summary = "鎸夋ā鏉垮潗鏍囦繚瀛樻柊鑱氬師濮嬭褰�")
+ @PostMapping("/saveTemplateContext")
+ public Result<?> saveTemplateContext(@RequestBody SaveTemplateContextDto saveTemplateContextDto) {
+ insOrderPlanService.saveTemplateContext(saveTemplateContextDto);
+ return Result.success();
+ }
+
+ @Operation(summary = "鏌ヨ妫�楠屽崟閫夋嫨鐨勮澶�")
+ @GetMapping("/orderDevices")
+ public Result<?> getOrderDevices(Integer orderId) {
+ return Result.success(insOrderPlanService.getOrderDeviceIds(orderId));
+ }
+
+ @Operation(summary = "淇濆瓨妫�楠屽崟閫夋嫨鐨勮澶�")
+ @PutMapping("/orderDevices")
+ public Result<?> saveOrderDevices(@RequestBody SaveOrderDevicesDto saveOrderDevicesDto) {
+ insOrderPlanService.saveOrderDevices(saveOrderDevicesDto);
+ return Result.success();
+ }
+
+ @Operation(summary = "鏌ョ湅妫�楠屽崟涓嬬殑闄勪欢鍒楄〃")
+ @GetMapping("/getFileList")
+ public Result<?> getFileList(Page page, InsOrderFile insOrderFile) throws Exception {
+ return Result.success(insOrderPlanService.getFileList(page, insOrderFile));
+ }
+
+
+ @Operation(summary = "涓婁紶闄勪欢")
+ @PreAuthorize("@ss.hasPermi('upload:order:file')")
+ @PostMapping("/uploadFile")
+ public Result<?> taskUploadFile(Integer orderId, MultipartFile file) {
+ return Result.success(insOrderPlanService.uploadFile(orderId, file));
+ }
+
+
+ @Operation(summary = "鍒犻櫎闄勪欢")
+ @PreAuthorize("@ss.hasPermi('del:order:file')")
+ @DeleteMapping("/delfile")
+ public Result<?> delfile(Integer id) {
+ return Result.success(insOrderFileService.removeById(id));
+ }
+
+
+ @Operation(summary = "涓嬭浇闄勪欢")
+ @GetMapping("/downFile")
+ public Result<?> downFile(Integer id) {
+ InsOrderFile insOrderFile = insOrderFileService.getById(id);
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("type", insOrderFile.getType());
+ map.put("fileUrl", insOrderFile.getFileUrl());
+ return Result.success(map);
+ }
+
+ @Operation(summary = "濉啓娓╁害涓庢箍搴�")
+ @PostMapping("/write")
+ public Result<?> write(@RequestBody WriteInspectionConditionDto dto) {
+ return Result.success(insProductService.write(dto));
+ }
+
+
+ @Operation(summary = "鐢电紗閰嶇疆,鏌ョ湅閰嶇疆鏍囪瘑")
+ @GetMapping("/getCableTag")
+ public Result<?> getCableTag(Integer id, String laboratory) {
+ return Result.success(insOrderPlanService.getCableTag(id, laboratory));
+ }
+
+ @Operation(summary = "鍘熸潗鏂�,鏌ョ湅閰嶇疆鏍囪瘑")
+ @GetMapping("/getRawMaterialTag")
+ public Result<?> getRawMaterialTag(Integer id, String laboratory) {
+ return Result.success(insOrderPlanService.getRawMaterialTag(id, laboratory));
+ }
+
+ @Operation(summary = "鏌ョ湅閲嶅鏍囪瘑")
+ @GetMapping("/getRepetitionTag")
+ public Result<?> getRepetitionTag(Integer id, String laboratory, String cableTag) {
+ return Result.success(insOrderPlanService.getRepetitionTag(id, laboratory, cableTag));
+ }
+
+ @Operation(summary = "鏂板涓嶅悎鏍煎娴嬩俊鎭�")
+ @PostMapping("/addUnqualifiedRetest")
+ public Result<?> addDisqualificationRetest(@RequestBody List<InsProduct> insProductsList) {
+ return Result.success(insOrderPlanService.addDisqualificationRetest(insProductsList));
+ }
+
+ @Operation(summary = "鑾峰彇涓嶅悎鏍煎娴嬫暟鎹�")
+ @GetMapping("/getInsProductUnqualifiedRetest")
+ public Result<?> getInsProductUnqualifiedRetest(InsOrderPlanProductDto insOrderPlanProductDto) {
+ return Result.success(insOrderPlanService.getInsProductUnqualifiedRetest(insOrderPlanProductDto));
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Operation(summary = "淇濆瓨 涓嶅悎鏍煎娴嬫楠屽唴瀹�")
+ @PostMapping("/saveUnqualifiedContext")
+ public Result<?> saveUnqualifiedContext(@RequestBody SaveInsContextDto saveInsContextDto) {
+ Map<String, Object> param2 = JSON.parseObject(saveInsContextDto.getParam(), Map.class);
+ insOrderPlanService.saveUnqualifiedContext(param2, saveInsContextDto.getCurrentTable(), saveInsContextDto.getSampleId(), saveInsContextDto.getOrderId(), saveInsContextDto.getSonLaboratory());
+ return Result.success();
+ }
+
+ @Operation(summary = "鏌ヨ鍘熸潗鏂欒繘璐ч獙璇�")
+ @GetMapping("/getFactoryVerify")
+ public Result<?> getFactoryVerify(Integer insOrderId) {
+ return Result.success(insOrderPlanService.getFactoryVerify(insOrderId));
+ }
+
+
+
+ @Operation(summary = "淇濆瓨鍘熸潗鏂欒繘璐ч獙璇�")
+ @PostMapping("/addFactoryVerify")
+ public Result<?> addFactoryVerify(@RequestBody InsOrderFactoryVerify factoryVerify) {
+ return Result.success(insOrderPlanService.addFactoryVerify(factoryVerify));
+ }
+
+
+ @Operation(summary = "淇敼妫�楠岄」鍐呭")
+ @PreAuthorize("@ss.hasPermi('update:product:onPlan')")
+ @PostMapping("/updateProductOnPlan")
+ public Result<?> updateProductOnPlan(@RequestBody InsProduct insProduct) {
+ insProductService.updateById(insProduct);
+ return Result.success();
+ }
+
+
+ @Operation(summary = "鏍规嵁妫�楠岄」id鏌ヨ妫�楠岄」鏍戜俊鎭�")
+ @GetMapping("/getProductTreeByProductId")
+ public Result<List<InsProduct>> getProductTreeByProductId(Integer productId) {
+ return Result.success(insProductService.getProductTreeByProductId(productId));
+ }
+
+
+
+ @Operation(summary = "鐗规畩妫�楠岄」缁戝畾")
+ @PostMapping("/bindingProductTreeByProductId")
+ public Result<?> bindingProductTreeByProductId(@RequestBody InsProductBindingDto insProductBindingDto) {
+ return Result.success(insProductService.bindingProductTreeByProductId(insProductBindingDto));
+ }
+
+
+ @Operation(summary = "鐗规畩妫�楠岄」缁戝畾鏌ヨ")
+ @GetMapping("/getBindingProductByProductId")
+ public Result<List<InsProduct>> getBindingProductByProductId(Integer productId) {
+ return Result.success(insProductService.list(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getBindingProductId, productId)
+ .orderByAsc(InsProduct::getSort)));
+ }
+
+
+
+ @Operation(summary = "鍒犻櫎鐗规畩妫�楠岄」缁戝畾淇℃伅")
+ @DeleteMapping("/delProductTreeByProductId")
+ public Result<?> delProductTreeByProductId(Integer productId) {
+ return Result.success(insProductService.removeBindingProductTree(productId));
+ }
+
+ /**
+ * 鏍规嵁璁㈠崟鏌ヨ宸ユ椂璇︽儏
+ * @return
+ */
+ @Operation(summary = "鏍规嵁璁㈠崟鏌ヨ宸ユ椂璇︽儏")
+ @PreAuthorize("@ss.hasPermi('get:working:hours:byOrder')")
+ @GetMapping("/getWorkingHoursByOrderId")
+ public Result<IPage<AuxiliaryOutputWorkingHoursTemporaryDto>> getWorkingHoursByOrderId(Page page, AuxiliaryOutputWorkingHoursTemporaryDto workingHoursTemporary) {
+ return Result.success(auxiliaryOutputWorkingHoursTemporaryService.getWorkingHoursByOrderId(page, workingHoursTemporary));
+ }
+
+ /**
+ * 淇敼宸ユ椂璇︽儏
+ * @return
+ */
+ @Operation(summary = "淇敼宸ユ椂璇︽儏")
+ @PreAuthorize("@ss.hasPermi('update:order:workingHours')")
+ @PostMapping("/updateWorkingHours")
+ public Result updateWorkingHours(@RequestBody AuxiliaryOutputWorkingHoursTemporary workingHoursTemporary) {
+ return Result.success(auxiliaryOutputWorkingHoursTemporaryService.updateById(workingHoursTemporary));
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderRatesController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderRatesController.java
new file mode 100644
index 0000000..89859ab
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderRatesController.java
@@ -0,0 +1,56 @@
+package com.ruoyi.inspect.controller;
+
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.SampleOrderDto;
+import com.ruoyi.inspect.service.InsOrderRatesService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.web.bind.annotation.*;
+
+import jakarta.annotation.Resource;
+
+
+/**
+ * 璁㈠崟璐圭敤琛�
+ *
+ * @author zhuo
+ * @since 2025-02-28
+ */
+@Tag(name = "璁㈠崟璐圭敤淇℃伅")
+@RestController
+@RequestMapping("/insOrderRates")
+public class InsOrderRatesController {
+
+ @Resource
+ private InsOrderRatesService insOrderRatesService;
+
+
+ /**
+ * 鏌ヨ璁㈠崟鍒楄〃
+ * @param page
+ * @param sampleOrderDto
+ * @return
+ */
+ @Operation(summary = "鏌ヨ璁㈠崟鍒楄〃")
+ @GetMapping("/selectRatesPage")
+ public Result selectInsOrderRates(Page page, SampleOrderDto sampleOrderDto) {
+ return Result.success(insOrderRatesService.selectInsOrderRates(page, sampleOrderDto));
+ }
+
+
+ /**
+ * 鏌ヨ璁㈠崟鍒楄〃
+ * @param insOrderId
+ * @return
+ */
+ @Operation(summary = "鏌ヨ璁㈠崟璐圭敤璇︽儏")
+ @GetMapping("/selectRatesDetail")
+ public Result selectRatesDetail(Page page, Integer insOrderId) {
+ return Result.success(insOrderRatesService.selectTemplateRatesDetail(page, insOrderId));
+ }
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsProductDeviationWarningController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsProductDeviationWarningController.java
new file mode 100644
index 0000000..906feee
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsProductDeviationWarningController.java
@@ -0,0 +1,63 @@
+package com.ruoyi.inspect.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.InsProductDeviationWarningDto;
+import com.ruoyi.inspect.dto.SampleOrderDto;
+import com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail;
+import com.ruoyi.inspect.service.InsProductDeviationWarningDetailService;
+import com.ruoyi.inspect.service.InsProductDeviationWarningService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 妫�楠岄」鍋忓樊棰勮涓昏〃 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author
+ * @since 2025-03-28 02:18:02
+ */
+@RestController
+@RequestMapping("/insProductDeviationWarning")
+@AllArgsConstructor
+@Tag(name = "妫�楠岄」鍋忓樊棰勮")
+public class InsProductDeviationWarningController {
+
+
+ private InsProductDeviationWarningService insProductDeviationWarningService;
+ private InsProductDeviationWarningDetailService insProductDeviationWarningDetailService;
+
+ /**
+ * 鏌ヨ棰勮鍒楄〃
+ * @param page
+ * @return
+ * @throws Exception
+ */
+ @Operation(summary = "鏌ヨ棰勮鍒楄〃")
+ @GetMapping("/selectDeviationWarningPage")
+ public Result<IPage<InsProductDeviationWarningDto>> selectDeviationWarningPage(Page page, InsProductDeviationWarningDto deviationWarningDto) {
+ return Result.success(insProductDeviationWarningService.selectDeviationWarningPage(page, deviationWarningDto));
+ }
+
+ /**
+ * 鏌ヨ棰勮璇︽儏
+ * @return
+ * @throws Exception
+ */
+ @Operation(summary = "鏌ヨ棰勮璇︽儏")
+ @GetMapping("/selectDeviationWarning")
+ public Result<List<InsProductDeviationWarningDetail>> selectDeviationWarning(Integer deviationWarningId){
+ return Result.success(insProductDeviationWarningDetailService.list(Wrappers.<InsProductDeviationWarningDetail>lambdaQuery()
+ .eq(InsProductDeviationWarningDetail::getDeviationWarningId, deviationWarningId)));
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsReportController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsReportController.java
new file mode 100644
index 0000000..7f2c1f7
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsReportController.java
@@ -0,0 +1,205 @@
+package com.ruoyi.inspect.controller;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.common.annotation.PersonalScope;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.ReportPageDto;
+import com.ruoyi.inspect.service.InsOrderPlanService;
+import com.ruoyi.inspect.service.InsReportService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Scanner;
+
+@RestController
+@RequestMapping("/insReport")
+@Tag(name = "妫�楠屾姤鍛�")
+public class InsReportController {
+
+ @Resource
+ private InsReportService insReportService;
+
+ @Resource
+ private InsOrderPlanService insOrderPlanService;
+
+ @Value("${wordUrl}")
+ private String wordUrl;
+
+ @Operation(summary = "鏌ヨ妫�楠屾姤鍛婃暟鎹�")
+ @GetMapping("/pageInsReport")
+ @PreAuthorize("@ss.hasPermi('business:reportPreparation')")
+ @PersonalScope(permsName = "business:reportPreparation", objectName = ReportPageDto.class, paramName = "createOrderUser")
+ public Result pageInsReport(Page page, ReportPageDto reportPageDto){
+ return Result.success(insReportService.pageInsReport(page, reportPageDto));
+ }
+
+ @Operation(summary = "鎶ュ憡涓婁紶")
+ @PostMapping("/inReport")
+ public Result inReport(MultipartFile file, Integer id) {
+ String urlString;
+ String pathName;
+ try {
+ String path = wordUrl;
+ File realpath = new File(path);
+ if (!realpath.exists()) {
+ realpath.mkdirs();
+ }
+ pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "_" + file.getOriginalFilename();
+ urlString = realpath + "/" + pathName;
+ file.transferTo(new File(urlString));
+ return Result.success(insReportService.inReport("/word/" + pathName, id));
+ } catch (Exception e) {
+ throw new ErrorException("鏂囦欢涓婁紶澶辫触");
+ }
+ }
+
+ @Operation(summary = "鎶ュ憡杩樺師")
+ @PostMapping("/upReportUrl")
+ public Result upReportUrl(@RequestBody Map<String, Object> param) {
+ Integer id = (Integer) param.get("id");
+ return Result.success(insReportService.upReportUrl(id));
+ }
+
+ @Operation(summary = "鎶ュ憡鍦ㄧ嚎缂栧埗")
+ @GetMapping("/upReportFile")
+ public Result upReportFile() {
+ return Result.success();
+ }
+
+ @Operation(summary = "鎻愪氦")
+ @PostMapping("/writeReport")
+ public Result writeReport(@RequestBody Map<String, Object> param) {
+ Integer id = (Integer) param.get("id");
+ Integer userId = (Integer) param.get("userId");
+ return Result.success(insReportService.writeReport(id, userId, null));
+ }
+
+ /**
+ * @param userId 闇�瑕佺殑鎵瑰噯浜�
+ * @return
+ */
+
+ @Operation(summary = "瀹℃牳")
+ @PostMapping("/examineReport")
+ public Result examineReport(@RequestBody Map<String, Object> param) {
+ Integer id = (Integer) param.get("id");
+ Integer isExamine = (Integer) param.get("isExamine");
+ String examineTell = (String) param.get("examineTell");
+ Integer userId = (Integer) param.get("userId");
+ return Result.success(insReportService.examineReport(id, isExamine, examineTell, userId));
+ }
+
+ @Operation(summary = "鎵瑰噯")
+ @PostMapping("/ratifyReport")
+ public Result ratifyReport(@RequestBody Map<String, Object> param) {
+ Integer id = (Integer) param.get("id");
+ Integer isRatify = (Integer) param.get("isRatify");
+ String ratifyTell = (String) param.get("ratifyTell");
+ return Result.success(insReportService.ratifyReport(id, isRatify, ratifyTell));
+ }
+
+ @Anonymous
+ @RequestMapping("/onlyOffice/save")
+ public void saveFile(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) {
+ PrintWriter writer = null;
+ try {
+ writer = response.getWriter();
+ // 鑾峰彇浼犺緭鐨刯son鏁版嵁
+ Scanner scanner = new Scanner(request.getInputStream()).useDelimiter("\\A");
+ String body = scanner.hasNext() ? scanner.next() : "";
+ JSONObject jsonObject = JSONObject.parseObject(body);
+
+ if (jsonObject.containsKey("url")) {
+ String jsonArray = jsonObject.get("lastsave").toString(); // 鏇存柊鏃堕棿
+ String fileUrl = jsonObject.get("url").toString(); // 鏇存柊鏂囦欢url
+ HttpUtil.downloadFile(fileUrl, FileUtil.file(wordUrl + "/" + fileName));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ writer.write("{\"error\":-1}");
+ return;
+ }
+ /*
+ * status = 1锛屾垜浠粰onlyOffice鐨勬湇鍔¤繑鍥瀧"error":"0"}鐨勪俊鎭��
+ * 杩欐牱onlyOffice浼氳涓哄洖璋冩帴鍙f槸娌¢棶棰樼殑锛岃繖鏍峰氨鍙互鍦ㄧ嚎缂栬緫鏂囨。浜嗭紝鍚﹀垯鐨勮瘽浼氬脊鍑虹獥鍙h鏄�
+ */
+ if (Objects.nonNull(writer)) {
+ writer.write("{\"error\":0}");
+ }
+ }
+
+ @Operation(summary = "鎶ュ憡鎵归噺涓嬭浇")
+ @GetMapping("/downAll")
+ public Result downAll(String ids) {
+ return Result.success(insReportService.downAll(ids));
+ }
+
+ @Operation(summary = "鎶ュ憡涓嬭浇锛坮eportType锛�0妫�娴嬫姤鍛婏紝1妫�楠屾姤鍛婏級")
+ @GetMapping("/download")
+ @PreAuthorize("@ss.hasPermi('business:reportPreparation')")
+ @PersonalScope(permsName = "business:reportPreparation", objectName = ReportPageDto.class, paramName = "createOrderUser")
+ public void download(Integer id, Integer reportType, ReportPageDto reportPageDto, HttpServletResponse response) {
+ insReportService.download(id, reportType, reportPageDto.getCreateOrderUser(), response);
+ }
+
+ @Operation(summary = "閲嶆柊鐢熸垚鎶ュ憡")
+ @PostMapping("/regenerate")
+// @PreAuthorize("@ss.hasPermi('business:reportPreparation')")
+ @PersonalScope(permsName = "business:reportPreparation", objectName = ReportPageDto.class, paramName = "createOrderUser")
+ public Result regenerate(@RequestBody ReportPageDto reportPageDto) {
+ insOrderPlanService.regenerateReport(reportPageDto.getId(), reportPageDto.getCreateOrderUser());
+ return Result.success();
+ }
+
+ @Operation(summary = "鎶ュ憡鎵归噺涓婁紶")
+ @PostMapping("/upAll")
+ public Result upAll(MultipartFile file) throws IOException {
+ return Result.success(insReportService.upAll(file));
+ }
+
+ /**
+ * 閫�鍥炲埌妫�楠屼换鍔�
+ * @param id
+ * @return
+ */
+ @Operation(summary = "閫�鍥炲埌妫�楠屼换鍔�")
+ @PostMapping("/sendBackTask")
+ public Result sendBackTask(@RequestBody Map<String, Object> param){
+ Integer id = (Integer) param.get("id");
+ return Result.success(insReportService.sendBackTask(id));
+ }
+
+ /**
+ * 鎶ュ憡瀵煎嚭
+ * @param dto
+ * @param response
+ * @throws Exception
+ */
+ @Operation(summary = "鎶ュ憡瀵煎嚭")
+ @GetMapping("/reportAllExport")
+ @PreAuthorize("@ss.hasPermi('business:reportPreparation')")
+ @PersonalScope(permsName = "business:reportPreparation", objectName = ReportPageDto.class, paramName = "createOrderUser")
+ public void reportAllExport(ReportPageDto dto, HttpServletResponse response) throws Exception {
+ insReportService.reportAllExport(dto,response);
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsSampleReceiptController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsSampleReceiptController.java
new file mode 100644
index 0000000..6659d88
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsSampleReceiptController.java
@@ -0,0 +1,58 @@
+package com.ruoyi.inspect.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.SampleReceiptActionDto;
+import com.ruoyi.inspect.dto.SampleReceiptQueryDto;
+import com.ruoyi.inspect.service.InsSampleReceiptService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import jakarta.servlet.http.HttpServletResponse;
+
+@RestController
+@RequestMapping("/insSampleReceipt")
+@Tag(name = "鏍峰搧鎺ユ敹")
+@AllArgsConstructor
+public class InsSampleReceiptController {
+ private final InsSampleReceiptService insSampleReceiptService;
+
+ @Operation(summary = "鏍峰搧鎺ユ敹鍒嗛〉")
+ @GetMapping("/page")
+ public Result page(Page<?> page, SampleReceiptQueryDto query) {
+ return Result.success(insSampleReceiptService.page(page, query));
+ }
+
+ @Operation(summary = "鏍峰搧鎺ユ敹璇︽儏")
+ @GetMapping("/{id}")
+ public Result detail(@PathVariable Integer id) {
+ return Result.success(insSampleReceiptService.detail(id));
+ }
+
+ @Operation(summary = "鎻愪氦妫�楠�")
+ @PostMapping("/submit")
+ public Result submit(@RequestBody SampleReceiptActionDto dto) {
+ insSampleReceiptService.submit(dto);
+ return Result.success();
+ }
+
+ @Operation(summary = "鎷掓敹鏍峰搧")
+ @PostMapping("/reject")
+ public Result reject(@RequestBody SampleReceiptActionDto dto) {
+ insSampleReceiptService.reject(dto);
+ return Result.success();
+ }
+
+ @Operation(summary = "鏍峰搧鎺ユ敹瀵煎嚭")
+ @GetMapping("/export")
+ public void export(SampleReceiptQueryDto query, HttpServletResponse response) {
+ insSampleReceiptService.export(query, response);
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsUnqualifiedHandlerController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsUnqualifiedHandlerController.java
new file mode 100644
index 0000000..53f57c3
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsUnqualifiedHandlerController.java
@@ -0,0 +1,82 @@
+package com.ruoyi.inspect.controller;
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.UnqualifiedHandlerDto;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandlerFile;
+import com.ruoyi.inspect.service.InsUnqualifiedHandlerFileService;
+import com.ruoyi.inspect.service.InsUnqualifiedHandlerService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.HashMap;
+
+@RestController
+@Tag(name = "涓嶅悎鏍煎鐞嗙鐞�")
+@RequestMapping("/unqualifiedHandler")
+@AllArgsConstructor
+@Slf4j
+public class InsUnqualifiedHandlerController {
+
+ private final InsUnqualifiedHandlerService unqualifiedHandlerService;
+ private final InsUnqualifiedHandlerFileService unqualifiedHandlerFileService;
+ @Operation(summary = "鏌ヨ")
+ @GetMapping("/page")
+ public Result pageByUnqualified(Page page, UnqualifiedHandlerDto unqualifiedHandlerDto){
+ return Result.success(unqualifiedHandlerService.pageList(page, unqualifiedHandlerDto));
+ }
+
+
+
+ @Operation(summary = "闄勪欢涓婁紶")
+ @PostMapping("/uploadFileByUnqualified")
+ public Result<?> uploadFileByUnqualified(Long handlerId, MultipartFile file) {
+ return Result.success(unqualifiedHandlerFileService.uploadFile(handlerId, file));
+ }
+
+
+ @Operation(summary = "鏂板涓嶅悎鏍煎鐞�")
+ @PostMapping("/addUnqualifiedHandler")
+ public Result addUnqualifiedHandler(@RequestBody UnqualifiedHandlerDto unqualifiedHandlerDto){
+ return Result.success(unqualifiedHandlerService.addUnqualifiedHandler(unqualifiedHandlerDto));
+ }
+
+
+ @Operation(summary = "缂栬緫涓嶅悎鏍煎鐞�")
+ @PostMapping("/updateUnqualifiedHandler")
+ public Result updateUnqualifiedHandler(@RequestBody UnqualifiedHandlerDto unqualifiedHandlerDto){
+ return Result.success(unqualifiedHandlerService.updateUnqualifiedHandler(unqualifiedHandlerDto));
+ }
+
+
+
+ @Operation(summary = "鏌ョ湅涓嶅悎鏍煎鐞嗙晫闈�")
+ @GetMapping("/getUnqualifiedHandler")
+ public Result getUnqualifiedHandler(Integer id){
+ return Result.success(unqualifiedHandlerService.getUnqualifiedHandler(id));
+ }
+
+
+ @Operation(summary = "鍒犻櫎涓嶅悎鏍煎鐞�")
+ @DeleteMapping("/deleteUnqualifiedHandler")
+ public Result deleteUnqualifiedHandler(Integer id) {
+ return Result.success(unqualifiedHandlerService.deleteUnqualifiedHandler(id));
+ }
+
+
+ @Operation(summary = "涓嬭浇闄勪欢")
+ @GetMapping("/downFile")
+ public Result<?> oaDownFile(Integer id) {
+ InsUnqualifiedHandlerFile insUnqualifiedHandlerFile = unqualifiedHandlerFileService.getById(id);
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("type", insUnqualifiedHandlerFile.getType());
+ map.put("fileUrl", insUnqualifiedHandlerFile.getFileUrl());
+ return Result.success(map);
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/OutsourcingFinishProductInspectionController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/OutsourcingFinishProductInspectionController.java
new file mode 100644
index 0000000..0004d64
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/OutsourcingFinishProductInspectionController.java
@@ -0,0 +1,58 @@
+package com.ruoyi.inspect.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.IfsInventoryQuantityDto;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.common.annotation.PersonalScope;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.service.OutsourcingFinishProductInspectionService;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 澶栬喘鎴愬搧妫�楠宑ontroller
+ */
+@RestController
+@RequestMapping("/outsourcingFinishProduct")
+public class OutsourcingFinishProductInspectionController {
+
+ @Autowired
+ private OutsourcingFinishProductInspectionService outsourcingFinishProductInspectionService;
+
+ @Operation(summary = "浠撳簱鎶ユ鏌ヨ")
+ @GetMapping("/getWarehouseSubmit")
+ public Result getWarehouseSubmit(Page page, IfsInventoryQuantity ifsInventoryQuantity) {
+ return Result.success(outsourcingFinishProductInspectionService.getWarehouseSubmit(page, ifsInventoryQuantity));
+ }
+
+ @Operation(summary = "澶栬喘鎴愬搧妫�楠屾煡璇㈡楠屼腑")
+ @GetMapping("/getIfsByStateOne")
+ @PreAuthorize("@ss.hasPermi('business:order')")
+ @PersonalScope(permsName = "business:order", objectName = IfsInventoryQuantityDto.class, paramName = "createUser")
+ public Result getIfsByStateOne(Page page, IfsInventoryQuantityDto ifsInventoryQuantityDto){
+ return Result.success(outsourcingFinishProductInspectionService.getIfsByStateOne(page, ifsInventoryQuantityDto));
+ }
+
+ @Operation(summary = "澶栬喘鎴愬搧妫�楠屾煡璇㈠凡妫�楠�")
+ @GetMapping("/getIfsByOver")
+ @PreAuthorize("@ss.hasPermi('business:order')")
+ @PersonalScope(permsName = "business:order", objectName = IfsInventoryQuantitySupplierDto.class, paramName = "createUser")
+ public Result getIfsByOver(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
+ return Result.success(outsourcingFinishProductInspectionService.getIfsByOver(page, ifsInventoryQuantityDto));
+ }
+
+ @Operation(summary = "鍘熸潗鏂欐姤妫�鏌ヨ鍏ㄩ儴")
+ @PreAuthorize("@ss.hasPermi('get:Ifs:ByAll')")
+ @GetMapping("/getIfsByAll")
+ public Result getIfsByAll(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
+ return Result.success(outsourcingFinishProductInspectionService.getIfsByOver(page, ifsInventoryQuantityDto));
+ }
+
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java
new file mode 100644
index 0000000..a6549f5
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java
@@ -0,0 +1,367 @@
+package com.ruoyi.inspect.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.IfsInventoryQuantityCheckDto;
+import com.ruoyi.basic.dto.IfsInventoryQuantityDto;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.common.annotation.PersonalScope;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.enums.OrderType;
+import com.ruoyi.common.utils.WxCpUtils;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.InsPlaceOrderDto;
+import com.ruoyi.inspect.dto.OrderSplitDTO;
+import com.ruoyi.inspect.pojo.RawMaterialOrderTemplate;
+import com.ruoyi.inspect.service.InsOrderService;
+import com.ruoyi.inspect.service.RawMaterialOrderService;
+import com.ruoyi.inspect.service.RawMaterialOrderTemplateService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @Author zhuo
+ * @Date 2024/7/31
+ */
+@RequestMapping("/rawMaterialOrder")
+@RestController
+@AllArgsConstructor
+@Tag(name = "鍘熸潗鏂欎笅鍗�")
+public class RawMaterialOrderController {
+
+ private InsOrderService insOrderService;
+ private RawMaterialOrderService rawMaterialOrderService;
+ private RawMaterialOrderTemplateService rawMaterialOrderTemplateService;
+
+ @Operation(summary = "鏇村叿闆朵欢鍙疯幏鍙栨爣鍑嗘爲")
+ @GetMapping("/selectStandardTreeListByPartNo")
+ public Result selectStandardTreeListByPartNo(String partNo) {
+ return rawMaterialOrderService.selectStandardTreeListByPartNo(partNo);
+ }
+
+ @Operation(summary = "鍘熸潗鏂欐楠屾煡璇唬涓嬪崟")
+ @GetMapping("/getPurchaseOrder")
+ public Result getPurchaseOrder(Page page, IfsInventoryQuantityCheckDto ifsInventoryQuantity){
+ return Result.success(rawMaterialOrderService.selectIfsInventoryQuantity(page, ifsInventoryQuantity));
+ }
+
+ @Operation(summary = "鍘熸潗鏂欐楠屾煡璇㈡楠屼腑")
+ @GetMapping("/getIfsByStateOne")
+ @PreAuthorize("@ss.hasPermi('business:order')")
+ @PersonalScope(permsName = "business:order", objectName = IfsInventoryQuantityDto.class, paramName = "createUser")
+ public Result getIfsByStateOne(Page page, IfsInventoryQuantityDto ifsInventoryQuantityDto){
+ return Result.success(rawMaterialOrderService.getIfsByStateOne(page, ifsInventoryQuantityDto));
+ }
+
+ @Operation(summary = "鍘熸潗鏂欐楠屾煡璇㈠凡妫�楠�")
+ @GetMapping("/getIfsByOver")
+ @PreAuthorize("@ss.hasPermi('business:order')")
+ @PersonalScope(permsName = "business:order", objectName = IfsInventoryQuantitySupplierDto.class, paramName = "createUser")
+ public Result getIfsByOver(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
+ return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
+ }
+
+ @Operation(summary = "娣诲姞鍘熸潗鏂欐楠屽崟妯℃澘")
+ @PostMapping("/addRawMaterOrderTemplate")
+ public Result<?> addRawMaterOrderTemplate(@RequestBody RawMaterialOrderTemplate rawMaterialOrderTemplate) {
+ return Result.success(rawMaterialOrderTemplateService.addRawMaterOrderTemplate(rawMaterialOrderTemplate));
+ }
+ @Operation(summary = "鏌ヨ鍘熸潗鏂欐楠屽崟妯℃澘鍒楄〃")
+ @GetMapping("/selectRawMaterOrderTemplate")
+ public Result<?> selectRawMaterOrderTemplate(String partNo) {
+ return Result.success(rawMaterialOrderTemplateService.selectRawMaterOrderTemplate(partNo));
+ }
+
+ @Operation(summary = "閫氳繃鍘熸潗鏂欐楠屽崟妯℃澘id鑾峰彇妫�楠屽崟妯℃澘鍐呭")
+ @GetMapping("/selectRawMaterOrderTemplateById")
+ public Result<?> selectRawMaterOrderTemplateById(Integer id) {
+ return Result.success(rawMaterialOrderTemplateService.selectRawMaterOrderTemplateById(id));
+ }
+
+ @Operation(summary = "鍒犻櫎鍘熸潗鏂欐楠屽崟妯℃澘")
+ @DeleteMapping("/delRawMaterOrderTemplate")
+ public Result<?> delRawMaterOrderTemplate(Integer id) {
+ return Result.success(rawMaterialOrderTemplateService.delRawMaterOrderTemplate(id));
+ }
+
+
+ /**
+ * 鎶ユ鎵归噺
+ * @param param 鍘熸潗鏂檌d
+ * @return
+ */
+ @Operation(summary = "鎶ユ鎵归噺")
+ @PostMapping("/inspectionReport")
+ public Result<?> inspectionReport(@RequestBody Map<String, Object> param) {
+ List<Long> ids = (List<Long>) param.get("ids");
+ String orderType = Objects.nonNull(param.get("orderType"))?param.get("orderType").toString():"";
+ String materialProp = Objects.nonNull(param.get("materialProp"))?param.get("materialProp").toString():"";
+ if(!OrderType.validateValue(orderType)){
+ throw new ErrorException("鎵归噺鎶ユ澶辫触,闈炴硶鐨勯攢鍞鍗曞垎绫绘灇涓�");
+ }
+ return Result.success(rawMaterialOrderService.inspectionReport(ids,orderType,materialProp));
+ }
+
+ /**
+ * 鍙栨秷鎶ユ
+ * @param param
+ * @return
+ */
+ @Operation(summary = "鎾ら攢鎶ユ")
+ @PostMapping("/revokeInspectionReport")
+ public Result<?> revokeInspectionReport(@RequestBody Map<String, Object> param) {
+ Long id = Long.parseLong(param.get("id").toString());
+ return Result.success(rawMaterialOrderService.revokeInspectionReport(id));
+ }
+
+ /**
+ * 鎵撳嵃鏍囩鏌ヨ
+ * @param param 鍘熸潗鏂檌d
+ * @return
+ */
+ @Operation(summary = "鎵撳嵃鏍囩鏌ヨ")
+ @PostMapping("/printLabel")
+ public Result<?> printLabel(@RequestBody Map<String, Object> param) {
+ List<Integer> ids = (List<Integer>) param.get("ids");
+ return Result.success(rawMaterialOrderService.printLabel(ids));
+ }
+
+ /**
+ * 鎶ユ
+ * @param ifsInventoryQuantity 鍘熸潗鏂�
+ * @return
+ */
+ @Operation(summary = "鎶ユ")
+ @PostMapping("/inspectionReportOne")
+ public Result<?> inspectionReportOne(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) {
+ return Result.success(rawMaterialOrderService.inspectionReportOne(ifsInventoryQuantity));
+ }
+
+ /**
+ * 鑾峰彇閾滀骇涓氶摼妫�娴嬫暟鎹�
+ * @param id 鍘熸潗鏂檌d
+ * @return
+ */
+ @Operation(summary = "鑾峰彇閾滀骇涓氶摼妫�娴嬫暟鎹�")
+ @GetMapping("/getIndustryChain")
+ public Result<?> getIndustryChain(Integer id) {
+ return Result.success(rawMaterialOrderService.getIndustryChain(id));
+ }
+
+ /**
+ * 鍘熸潗鏂欐挙閿�
+ * @param param
+ * @return
+ */
+ @Operation(summary = "鍘熸潗鏂欐挙閿�涓嬪崟")
+ @GetMapping("/repealRawOrder")
+ public Result<?> repealRawOrder(@RequestBody Map<String, Object> param){
+ Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString());
+ return Result.success(rawMaterialOrderService.repealRawOrder(ifsInventoryId));
+ }
+
+
+ @Operation(summary = "鍘熸潗鏂欎笅鍗曞厤妫�")
+ @PostMapping("/addExemptionOrder")
+ public Result<?> addExemptionOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) {
+ return Result.success(rawMaterialOrderService.addExemptionOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getInsOrder()));
+ }
+
+
+ @Operation(summary = "浠撳簱鎶ユ鏌ヨ")
+ @GetMapping("/getWarehouseSubmit")
+ public Result getWarehouseSubmit(Page page, IfsInventoryQuantity ifsInventoryQuantity) {
+ return Result.success(rawMaterialOrderService.getWarehouseSubmit(page, ifsInventoryQuantity));
+ }
+
+ /**
+ * 鍙栨秷鎶ユ
+ * @param id
+ * @return
+ */
+ @Operation(summary = "鍒犻櫎鍘熸潗鏂欐姤妫�淇℃伅")
+ @DeleteMapping("/delIfsInventory")
+ public Result<?> delIfsInventory(Integer id) {
+ return Result.success(rawMaterialOrderService.delIfsInventory(id));
+ }
+
+ /**
+ * 鍘熸潗鏂欎笅鍗曟斁琛�
+ * @param param
+ * @return
+ */
+ @Operation(summary = "鍘熸潗鏂欎笅鍗曟斁琛屽厤妫�")
+ @PostMapping("/rawOrderRelease")
+ public Result<?> rawOrderRelease(@RequestBody Map<String, Object> param){
+ Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString());
+ String partDetail = (String) param.get("partDetail");
+ return Result.success(rawMaterialOrderService.rawOrderRelease(ifsInventoryId, partDetail));
+ }
+
+ /**
+ * 鍘熸潗鏂欎笅鍗曢�氱煡鍏嶆鎴栬�呭娆℃楠�
+ * @param ifsInventoryId
+ * @return
+ */
+ @Operation(summary = "鍘熸潗鏂欎笅鍗曢�氱煡鍏嶆鎴栬�呭娆℃楠�")
+ @GetMapping("/notificationRawOrder")
+ public Result<?> notificationRawOrder(Long ifsInventoryId){
+ return Result.success(rawMaterialOrderService.notificationRawOrder(ifsInventoryId));
+ }
+
+
+ @Operation(summary = "鍘熸潗鏂欐姤妫�鏌ヨ鍏ㄩ儴")
+ @PreAuthorize("@ss.hasPermi('get:Ifs:ByAll')")
+ @GetMapping("/getIfsByAll")
+ public Result getIfsByAll(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
+ ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
+ return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
+ }
+
+
+ @Operation(summary = "鏂板鍘熸潗鏂欐姤妫�淇℃伅")
+ @PostMapping("/addIfsInventoryQuantity")
+ public Result addIfsInventoryQuantity(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) {
+ rawMaterialOrderService.addIfsInventoryQuantity(ifsInventoryQuantity);
+ return Result.success();
+ }
+
+ @Operation(summary = "鍘熸潗鏂欎笅鍗曟煡鐪嬪凡瀹屾垚淇℃伅")
+ @GetMapping("/getIfsByFinish")
+ public Result getIfsByFinish(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) throws Exception {
+ ifsInventoryQuantityDto.setIsFinish(1);
+ ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
+ return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
+ }
+
+ @Operation(summary = "寰俊鍙戦�佹枃浠舵祴璇�")
+ @GetMapping("/wxSend")
+ public Result wxSend(String user, String content, String filePath) throws Exception {
+ WxCpUtils.inform(user, content, new File(filePath));
+ return Result.success();
+ }
+
+
+
+ @Operation(summary = "閾滃崟涓濅笅鍗�")
+ @PostMapping("/addRawCopperOrder")
+ public Result<?> addRawCopperOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) {
+ return Result.success(insOrderService.addRawCopperOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getCopperInsOrder()));
+ }
+
+ @Operation(summary = "閾滃崟涓濅笅鍗曞厤妫�")
+ @PostMapping("/addRawCopperOrderExemptionOrder")
+ public Result<?> addRawCopperOrderExemptionOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) {
+ return Result.success(rawMaterialOrderService.addRawCopperOrderExemptionOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getCopperInsOrder()));
+ }
+
+ /**
+ * 璁╂鏀捐
+ * @param param
+ * @return
+ */
+ @Operation(summary = "璁╂鏀捐")
+ @PostMapping("/concessionRelease")
+ public Result<?> concessionRelease(@RequestBody Map<String, Object> param){
+ Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString());
+ return Result.success(rawMaterialOrderService.concessionRelease(ifsInventoryId));
+ }
+
+ /**
+ * 鍘熸潗鏂欒繘鍘傛挙閿�涓嬪崟
+ * @param param
+ * @return
+ */
+ @Operation(summary = "鍘熸潗鏂欒繘鍘傛挙閿�涓嬪崟")
+ @PostMapping("/repealEnterRawOrder")
+ public Result<?> repealEnterRawOrder(@RequestBody Map<String, Object> param){
+ Integer enterOrderId = (Integer) param.get("enterOrderId");
+ return Result.success(rawMaterialOrderService.repealEnterRawOrder(enterOrderId));
+ }
+
+ /**
+ * 鍘熸潗鏂欏搴︽挙閿�涓嬪崟
+ * @param param
+ * @return
+ */
+ @Operation(summary = "鍘熸潗鏂欏搴︽挙閿�涓嬪崟")
+ @PostMapping("/repealQuarterRawOrder")
+ public Result<?> repealQuarterRawOrder(@RequestBody Map<String, Object> param){
+ Integer quarterOrderId = (Integer) param.get("quarterOrderId");
+ return Result.success(rawMaterialOrderService.repealQuarterRawOrder(quarterOrderId));
+ }
+
+ @Operation(summary = "鍏ㄩ儴淇℃伅瀵煎嚭")
+ @GetMapping("/rawAllExport")
+ public void rawAllExport(IfsInventoryQuantitySupplierDto dto, HttpServletResponse response) throws Exception {
+ rawMaterialOrderService.rawAllExport(dto,response);
+ }
+
+ @Operation(summary = "鍘熸潗鏂欐楠屾煡璇㈠搴︽楠�")
+ @GetMapping("/getIfsByQuarter")
+ @PreAuthorize("@ss.hasPermi('business:order')")
+ @PersonalScope(permsName = "business:order", objectName = IfsInventoryQuantitySupplierDto.class, paramName = "createUser")
+ public Result getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
+ return Result.success(rawMaterialOrderService.getIfsByQuarter(page, ifsInventoryQuantityDto));
+ }
+
+ /**
+ * 鎻愬墠鍏ュ簱
+ * @param param
+ * @return
+ */
+ @Operation(summary = "鎻愬墠鍏ュ簱")
+ @PostMapping("/advancedGodown")
+ public Result<?> advancedGodown(@RequestBody Map<String, Object> param){
+ Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString());
+ return Result.success(rawMaterialOrderService.advancedGodown(ifsInventoryId));
+ }
+
+ /**
+ * 涓嬭浇璁㈠崟鎷嗗垎瀵煎叆妯℃澘
+ */
+ @Operation(summary = "涓嬭浇璁㈠崟鎷嗗垎瀵煎叆妯℃澘")
+ @GetMapping("/downloadTemplate")
+ public void downloadTemplate(HttpServletResponse response){
+ rawMaterialOrderService.downloadTemplate(response);
+ }
+
+ /**
+ * 涓嬭浇璁㈠崟鎷嗗垎瀵煎叆妯℃澘
+ */
+ @Operation(summary = "瀵煎叆璁㈠崟鎷嗗垎鏁版嵁")
+ @PostMapping("/importSplitOrderData")
+ public Result importSplitOrderData(@RequestParam(value = "file") MultipartFile file, @RequestParam("ifsId") Long ifsId, HttpServletRequest request){
+ return rawMaterialOrderService.importSplitOrderData(file,ifsId,request);
+ }
+
+ /**
+ * 纭鎷嗗垎璁㈠崟
+ */
+ @Operation(summary = "纭鎷嗗垎璁㈠崟")
+ @PostMapping("/confirmSplitOrder")
+ public Result confirmSplitOrder(@RequestBody OrderSplitDTO orderSplitDTO){
+ return Result.success(rawMaterialOrderService.confirmSplitOrder(orderSplitDTO));
+ }
+
+ /**
+ * 鏍规嵁ifsId鏌ヨ涓嬪崟鏁伴噺
+ */
+ @Operation(summary = "鏍规嵁ifsId鏌ヨ涓嬪崟鏁伴噺")
+ @GetMapping("/getOrderCountByIfsId/{ifsId}")
+ public Result getOrderCountByIfsId(@PathVariable("ifsId") Long ifsId){
+ return Result.success(rawMaterialOrderService.getOrderCountByIfsId(ifsId));
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/ReportController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/ReportController.java
new file mode 100644
index 0000000..69a524e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/ReportController.java
@@ -0,0 +1,32 @@
+package com.ruoyi.inspect.controller;
+
+
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.service.ReportService;
+import com.ruoyi.performance.dto.AuxiliaryOriginalHoursLookDto;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/report")
+@Tag(name = "鎶ヨ〃妯″潡")
+public class ReportController {
+
+ private ReportService reportService;
+
+ @Operation(summary = "鏌ヨ鏃ュ巻浠诲姟鍥�")
+ @GetMapping("/calendarWorkByWeek")
+ public Result calendarWorkByWeek(){
+ return Result.success(reportService.calendarWorkByWeek());
+ }
+
+ @Operation(summary = "褰撳墠鐢ㄦ埛宸ユ椂缁熻")
+ @GetMapping("/currentUserWorkHourCount")
+ public Result currentUserWorkHourCount(AuxiliaryOriginalHoursLookDto dto){
+ return Result.success(reportService.currentUserWorkHourCount(dto));
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/WarehouseController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/WarehouseController.java
new file mode 100644
index 0000000..7f4359e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/WarehouseController.java
@@ -0,0 +1,103 @@
+package com.ruoyi.inspect.controller;
+
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.pojo.Warehouse;
+import com.ruoyi.inspect.pojo.WarehouseShelf;
+import com.ruoyi.inspect.service.WarehouseService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+@RequestMapping("/warehouse")
+@RestController
+@AllArgsConstructor
+@Tag(name = "鏍峰搧绠$悊")
+public class WarehouseController {
+
+ private WarehouseService warehouseService;
+
+ @Operation(summary = "娣诲姞浠撳簱")
+ @PostMapping("/addWarehouse")
+ public Result addWarehouse(@RequestBody Warehouse warehouse) {
+ return Result.success(warehouseService.addWarehouse(warehouse));
+ }
+
+
+ @Operation(summary = "鏌ヨ浠撳簱")
+ @GetMapping("/selectWarehouse")
+ public Result selectWarehouse() {
+ return Result.success(warehouseService.selectWarehouse());
+ }
+
+ @PostMapping("/addShelf")
+ @Operation(summary = "娣诲姞璐ф灦")
+ public Result addShelf(@RequestBody WarehouseShelf warehouseShelf) {
+ return Result.success(warehouseService.addShelf(warehouseShelf));
+ }
+
+
+ @Operation(summary = "鍒犻櫎浠撳簱")
+ @DeleteMapping("/delWarehouse")
+ public Result delWarehouse(Integer id) {
+ return Result.success(warehouseService.delWarehouse(id));
+ }
+
+
+ @Operation(summary = "淇敼浠撳簱")
+ @PostMapping("/upWarehouse")
+ public Result upWarehouse(@RequestBody Warehouse warehouse) {
+ return Result.success(warehouseService.upWarehouse(warehouse));
+ }
+
+
+ @Operation(summary = "鍒犻櫎璐ф灦")
+ @DeleteMapping("/delShelf")
+ public Result delShelf(Integer id) {
+ return Result.success(warehouseService.delShelf(id));
+ }
+
+
+ @Operation(summary = "淇敼璐ф灦")
+ @PostMapping("/upShelf")
+ public Result upShelf(@RequestBody WarehouseShelf warehouseShelf) {
+ return Result.success(warehouseService.upShelf(warehouseShelf));
+ }
+
+ @Operation(summary = "鏌ヨ璐ф灦涓嬬殑瀛樻斁淇℃伅")
+ @GetMapping("/getWarehouse")
+ public Result getWarehouse(Integer shelfId) {
+ return Result.success(warehouseService.getWarehouse(shelfId));
+ }
+
+
+ @Operation(summary = "鏍峰搧鍏ュ簱")
+ @PostMapping("/inWarehouse")
+ public Result inWarehouse(@RequestBody Map<String, String> param) {
+ String trees = param.get("trees");
+ String sampleCode = param.get("sampleCode");
+ return Result.success(warehouseService.inWarehouse(trees, sampleCode));
+ }
+
+
+ @PostMapping("/outWarehouse")
+ @Operation(summary = "鏍峰搧鍑哄簱")
+ public Result outWarehouse(@RequestBody Map<String, String> param) {
+ String sampleCode = param.get("sampleCode");
+ return Result.success(warehouseService.outWarehouse(sampleCode));
+ }
+
+ @Operation(summary = "鏌ヨ鏍峰搧璇︾粏璁板綍")
+ @GetMapping("/getSampleRecord")
+ public Result getSampleRecord(Integer id) {
+ return Result.success(warehouseService.getSampleRecord(id));
+ }
+
+ @Operation(summary = "閫氳繃鏍峰搧缂栧彿杩涜妫�绱�")
+ @GetMapping("/searchSampleId")
+ public Result searchSampleId(String sampleCode) {
+ return Result.success(warehouseService.searchSampleId(sampleCode));
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/CopperInsOrderDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/CopperInsOrderDto.java
new file mode 100644
index 0000000..b6bf00c
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/CopperInsOrderDto.java
@@ -0,0 +1,37 @@
+package com.ruoyi.inspect.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.inspect.pojo.InsOrder;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 閾滃崟涓濅笅鍗曚俊鎭�
+ *
+ * @Author zhuo
+ * @Date 2024/9/13
+ */
+@Data
+public class CopperInsOrderDto extends InsOrder {
+
+ @Schema(description = "鍒拌揣鏁伴噺")
+ private BigDecimal qtyArrived;
+
+ @Schema(description = "鍗曚綅")
+ private String buyUnitMeas;
+
+ @Schema(description = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+ @Schema(description = "鎵瑰彿")
+ private String updateBatchNo;
+
+ @Schema(description = "鎺ユ敹鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime declareDate;
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/CostStatisticsDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/CostStatisticsDto.java
new file mode 100644
index 0000000..1fc6312
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/CostStatisticsDto.java
@@ -0,0 +1,63 @@
+package com.ruoyi.inspect.dto;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+public class CostStatisticsDto{
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","鏃ユ湡"})
+ private LocalDateTime createTime;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","妫�楠岀紪鍙�"})
+ private String entrustCode;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","鏍峰搧鍚嶇О"})
+ private String sample;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","瑙勬牸鍨嬪彿"})
+ private String model;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","鏍峰搧鏁伴噺"})
+ private Integer num;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","鎬讳环"})
+ private BigDecimal price;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","璇曢獙椤圭洰"})
+ private String inspectionItem;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","濮旀墭鍗曚綅"})
+ private String company;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","濮旀墭浜�"})
+ private String name;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","鐢熶骇鍗曚綅"})
+ private String production;
+
+ @ExcelProperty(value ={"鏍峰搧鐧昏琛�","宸ョ▼鍚嶇О"})
+ private String engineering;
+
+ @ExcelIgnore
+ private Integer createUser;
+
+ @ExcelIgnore
+ private Integer insSampleId;
+
+ @ExcelIgnore
+ private Double cost;//宸ユ椂
+
+ @TableField(exist = false,select = false)
+ @ExcelIgnore
+ private String dates;
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/DataAnalysisDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/DataAnalysisDto.java
new file mode 100644
index 0000000..e290486
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/DataAnalysisDto.java
@@ -0,0 +1,48 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author zhuo
+ * @Date 2024/10/16
+ */
+@Data
+public class DataAnalysisDto {
+
+ @Schema(description = "鏃堕棿绫诲瀷, 1:鏈懆, 2:鏈湀, 3:鏈勾")
+ private String dateType;
+
+ @Schema(description = "妫�娴嬬被鍨�, 1:杩涘巶妫�楠�, 2:瀛e害妫�楠�")
+ private String orderType;
+
+ @Schema(description = "寮�濮嬫椂闂�")
+ private String beginDate;
+
+ @Schema(description = "缁撴潫鏃堕棿")
+ private String endDate;
+
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sampleName;
+
+ @Schema(description = "鍨嬪彿")
+ private String modelName;
+
+ @Schema(description = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+ @Schema(description = "鍒嗙粍绫诲瀷, 0: 榛樿鎸夌収鏍峰搧鍖哄垎 1: 鍚屼竴鍘傚, 鍚屼竴鍨嬪彿, 涓嶅悓鎵规, 2 : 鍚屼竴鍨嬪彿, 涓嶅悓鍘傚")
+ private String groupType;
+
+ @Schema(description = "閫夋嫨鐨勬楠岄」鍚嶇О")
+ private List<String> itemNames;
+
+ @Schema(description = "璁㈠崟id")
+ private List<Integer> orderIds;
+
+ @Schema(description = "鍘傚鏁版嵁")
+ private List<String> supplierDataList;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/EnterFactoryReport.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/EnterFactoryReport.java
new file mode 100644
index 0000000..f464762
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/EnterFactoryReport.java
@@ -0,0 +1,52 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @Author zhuo
+ * @Date 2024/8/12
+ */
+@Data
+public class EnterFactoryReport {
+
+ @Schema(description = "鏉愭枡鍚嶇О")
+ private String sample;
+
+ @Schema(description = "鍒拌揣鏁伴噺")
+ private String qtyArrived;
+
+ @Schema(description = "鎶芥鏁伴噺")
+ private String quantity;
+
+ @Schema(description = "瑙勬牸鍨嬪彿")
+ private String partDesc;
+
+ @Schema(description = "鏉愭枡鍘傚")
+ private String supplierName;
+
+ @Schema(description = "鎵瑰彿")
+ private String lotBatchNo;
+
+ @Schema(description = "妫�娴嬬紪鍙�")
+ private String code;
+
+ /**
+ * 澶栨姢棰滆壊
+ */
+ @Schema(description = "澶栨姢棰滆壊")
+ private String outerColor;
+
+ /**
+ * 妫�楠屽憳
+ */
+ @Schema(description = "妫�楠屽憳")
+ private String inspector;
+
+ /**
+ * 妫�楠屾棩鏈�
+ */
+ @Schema(description = "妫�楠屾棩鏈�")
+ private String inspectDate;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/HistoryDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/HistoryDto.java
new file mode 100644
index 0000000..8bb9834
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/HistoryDto.java
@@ -0,0 +1,13 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.WarehouseHistory;
+import lombok.Data;
+
+@Data
+public class HistoryDto extends WarehouseHistory {
+
+ private String createUserName;
+
+ private String warehouseCode;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsPartPropsRecordDTO.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsPartPropsRecordDTO.java
new file mode 100644
index 0000000..6d78d3b
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsPartPropsRecordDTO.java
@@ -0,0 +1,13 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.IfsPartPropsRecord;
+import lombok.Data;
+
+@Data
+public class IfsPartPropsRecordDTO extends IfsPartPropsRecord {
+
+ private String partNo;
+
+ private String lotBatchNo;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsStockQueryDTO.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsStockQueryDTO.java
new file mode 100644
index 0000000..0091e69
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsStockQueryDTO.java
@@ -0,0 +1,65 @@
+package com.ruoyi.inspect.dto;
+
+import lombok.Data;
+
+@Data
+public class IfsStockQueryDTO {
+ private String partNo;
+ private String partDescription; // 闆朵欢鎻忚堪
+ private String partDesc;
+ private String locNo; // 搴撲綅鍙�
+ private String locDesc; // 搴撲綅鎻忚堪
+ private String lotBatchNo; // 鎵瑰彿
+ private String wdrNo; // WDR缂栧彿
+ private String warehouse; // 浠撳簱
+ private String quantityFlag; // 鏁伴噺鏍囪瘑(鐜版湁鏁伴噺)
+ private String locationGroup; // 搴撲綅缁�
+ private String locationGroupDesc; // 搴撲綅缁勬弿杩�
+ private String reelNumber; // 杞藉叿缂栧彿
+ private String startMeter; // 璧峰绫虫爣
+ private String endMeter; // 鎴绫虫爣
+ private String outerColor; // 澶栨姢棰滆壊
+ private String insulationColor; // 缁濈紭棰滆壊
+ private String otcOrderNo; // 鐗╂枡灞炴�ч噷闈㈢殑OTC璁㈠崟鍙�
+ private String mpsNo; // 鐢熶骇璁″垝鍙�
+ private String letteringInfo; // 鍗板瓧淇℃伅
+ private String sStockQuantity; // 搴撳瓨鏁伴噺2
+ private String availableStockQuantity; // 鍙敤搴撳瓨鏁伴噺
+ private String sAvailableStockQuantity; // 搴撶敤搴撳瓨鏁伴噺2
+ private String sunit; // 鍗曚綅2
+ private String stockSource; // 鏉ユ簮
+ private String inspInstorageTime; // 妫�娴嬪叆搴撴棩鏈�
+ private String testRemark; // 妫�娴嬪娉�
+ private String grossWeight; // 姣涢噸
+ private String netWeight; // 鍑�閲�
+ private String packingManner; // 鍖呰鏂瑰紡
+ private String cylinderNumber; //鎵撳湀涓暟
+ private String systemNo; //绯荤粺鍙�
+ private String remark; //澶囨敞
+ private String customerName; //瀹㈡埛鍚嶇О
+ private String reserveQuantity; //棰勭暀鏁伴噺
+ private String lengthRequirement; // 鍒ゆ柇瑕佹眰
+ private String inSource;//鍏ュ簱鏉ユ簮
+ private String splitQuality;//鍒嗗壊棰勭暀鏁伴噺
+
+ //鎺ュ彛 getIfsStockReport 鐢ㄥ埌鐨勫瓧娈�
+ private String attr23;//鍏ュ簱鏉ユ簮
+ private String attr6;//otc璁㈠崟鍙�
+ private String attr21;//瀹㈡埛鍚嶇О
+ private String attr4;//澶栨姢棰滆壊
+ private String attr5;//缁濈紭棰滆壊
+ private String attr8;//鍗板瓧淇℃伅
+ private String lot_batch_no;//鎵规鍙�
+ private String location_no;//搴撲綅鍙�
+ private String attr17;//鍖呰鏂瑰紡
+ private String attr1;//杞藉叿缂栧彿
+
+ //鎺ュ彛queryColReservedInfoStd 鐢ㄥ埌鐨勪袱涓瓧娈�
+ private String cotcOrderNo; // 琛ㄩ噷闈㈢殑OTC璁㈠崟鍙�
+ private String cotcLineNo; // 琛ㄩ噷闈㈢殑OTC琛屽彿
+
+ private Boolean isAll;//鏄惁鏌ヨ鍏ㄩ儴搴撳瓨
+
+ private Long page;
+ private Long limit;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderDeviceRecordDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderDeviceRecordDto.java
new file mode 100644
index 0000000..e6dc2d9
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderDeviceRecordDto.java
@@ -0,0 +1,16 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsOrderDeviceRecord;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @Author zhuo
+ * @Date 2024/12/22
+ */
+@Data
+public class InsOrderDeviceRecordDto extends InsOrderDeviceRecord {
+
+ @Schema(description = "璁惧缂栧彿")
+ private String managementNumber;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanDTO.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanDTO.java
new file mode 100644
index 0000000..1dd2780
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanDTO.java
@@ -0,0 +1,36 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class InsOrderPlanDTO extends IfsInventoryQuantity implements Serializable {
+
+ @Schema(description = "妫�楠屼换鍔′富閿甶d")
+ private Long insSampleId;
+
+ @Schema(description = "鐢ㄦ埛id")
+ private Long userId;
+
+ @Schema(description = "鐘舵��(妫�楠屽鐞�)")
+ private Integer state;
+
+ @Schema(description = "瀛愬疄楠屽")
+ private String sonLaboratory;
+
+ @Schema(description = "妫�楠岀姸鎬�")
+ private String insState;
+
+ @Schema(description = "濮旀墭缂栧彿")
+ private String entrustCode;
+
+ @Schema(description = "妫�楠岀被鍨�")
+ private Integer typeSource;
+
+ @Schema(description = "鏄惁澶嶆牳")
+ private Integer isCheck;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanProductDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanProductDto.java
new file mode 100644
index 0000000..d87aae7
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanProductDto.java
@@ -0,0 +1,36 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 妫�楠屼换鍔℃楠岄」鏌ヨ鏉′欢
+ *
+ * @Author zhuo
+ * @Date 2024/11/29
+ */
+@Data
+public class InsOrderPlanProductDto {
+
+ @Schema(description = "鏍峰搧id")
+ private Integer id;
+
+ @Schema(description = "绫诲瀷")
+ private Integer type;
+
+ @Schema(description = "璇曢獙瀹�")
+ private String laboratory;
+
+ @Schema(description = "鐢电紗閰嶇疆鏍囪瘑")
+ private String cableTag;
+
+ @Schema(description = "鍘熸潗鏂欐壒娆℃爣璇�")
+ private String rawMaterialTag;
+
+ @Schema(description = "鎴愬搧涓嬪崟閲嶅鏍囪瘑")
+ private String repetitionTag;
+
+ @Schema(description = "涓嶅悎鏍煎娴嬮噸澶嶆鏁�")
+ private String retestTag;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderUpdateDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderUpdateDto.java
new file mode 100644
index 0000000..ef4223f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderUpdateDto.java
@@ -0,0 +1,21 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsOrder;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author zhuo
+ * @Date 2024/11/29
+ */
+@Data
+public class InsOrderUpdateDto {
+
+ @Schema(description = "璁㈠崟淇敼瀵硅薄")
+ private InsOrder insOrder;
+
+ @Schema(description = "妫�娴嬫牱鍝佸璞�")
+ private List<SampleProductDto> sampleProduct;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsPlaceOrderDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsPlaceOrderDto.java
new file mode 100644
index 0000000..5a6466e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsPlaceOrderDto.java
@@ -0,0 +1,36 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsOrder;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 涓嬪崟瀵硅薄
+ *
+ * @Author zhuo
+ * @Date 2025/2/19
+ */
+@Data
+public class InsPlaceOrderDto{
+
+ @Schema(description = "鏍峰搧")
+ private List<SampleProductDto> sampleList;
+
+ @Schema(description = "璁㈠崟淇℃伅")
+ private InsOrder insOrder;
+
+ @Schema(description = "鏍囧噯搴撲簩绾ф爣鍑咺D锛堟柊鑱氬崟鏍峰搧涓嬪崟锛�")
+ private Integer standardTreeId;
+
+ @Schema(description = "鏍峰搧缂栧彿锛堟柊鑱氬崟鏍峰搧涓嬪崟锛�")
+ private String sampleCode;
+
+ @Schema(description = "涓嬪崟鏃朵繚鐣欑殑鍘熷璁板綍妯℃澘")
+ private List<OrderTemplateSelectionDto> templateList;
+
+ @Schema(description = "閾滃崟涓濊鍗�")
+ private CopperInsOrderDto copperInsOrder;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductAnalysisDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductAnalysisDto.java
new file mode 100644
index 0000000..75cb923
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductAnalysisDto.java
@@ -0,0 +1,29 @@
+package com.ruoyi.inspect.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 妫�娴嬮」鍒嗘瀽缁撴灉鏁版嵁
+ *
+ * @Author zhuo
+ * @Date 2025/3/26
+ */
+@Data
+public class InsProductAnalysisDto {
+
+ @Schema(description = "妫�娴嬮」id")
+ private Integer insProductId;
+
+ @Schema(description = "妫�娴嬬粨鏋�")
+ @TableField("`last_value`")
+ private String lastValue;
+
+ @Schema(description = "璁㈠崟id")
+ private Integer insOrderId;
+
+ @Schema(description = "鏍峰搧id")
+ private Integer insSampleId;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductBindingDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductBindingDto.java
new file mode 100644
index 0000000..979ad96
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductBindingDto.java
@@ -0,0 +1,21 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsProduct;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author zhuo
+ * @Date 2024/11/29
+ */
+@Data
+public class InsProductBindingDto {
+ @Schema(description = "闇�瑕佺粦瀹氱殑id")
+ private Integer insProductId;
+
+
+ @Schema(description = "闇�瑕佺粦瀹氱殑妫�楠岄」")
+ private List<InsProduct> insProductBindingList;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductDeviationWarningDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductDeviationWarningDto.java
new file mode 100644
index 0000000..dfbc5e8
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductDeviationWarningDto.java
@@ -0,0 +1,23 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsProductDeviationWarning;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @Author zhuo
+ * @Date 2025/3/28
+ */
+@Data
+public class InsProductDeviationWarningDto extends InsProductDeviationWarning {
+
+ @Schema(description = "鏍峰搧")
+ private String sampleName;
+
+ @Schema(description = "鍨嬪彿")
+ private String sampleModel;
+
+ @Schema(description = "妫�楠岄」")
+ private String inspectionItemName;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsReportExport.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsReportExport.java
new file mode 100644
index 0000000..e98fbfc
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsReportExport.java
@@ -0,0 +1,79 @@
+package com.ruoyi.inspect.dto;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @Author zhuo
+ * @Date 2025/4/18
+ */
+@Data
+@ExcelIgnoreUnannotated
+public class InsReportExport {
+
+ @ExcelProperty(value = "鎶ュ憡缂栧彿")
+ @Schema(description = "濮旀墭缂栧彿")
+ private String code;
+
+ @ExcelProperty(value = "鎶ュ憡绫诲瀷")
+ @Schema(description = "鎶ュ憡绫诲瀷")
+ private String reportTypeName;
+
+ @ExcelProperty(value = "涓嬪崟绫诲瀷")
+ @Schema(description = "涓嬪崟绫诲瀷")
+ private String typeSource;
+
+ @ExcelProperty(value = "妫�楠岀被鍨�")
+ @Schema(description = "妫�楠岀被鍨�")
+ private String orderType;
+
+ @ExcelProperty(value = "鍒涘缓鏃堕棿")
+ @Schema(description = "鍒涘缓鏃堕棿")
+ private String createTime;
+
+ @ExcelProperty(value = "鎻愪氦浜�")
+ @Schema(description = "鎻愪氦浜�")
+ private String writeUserName;
+
+ @ExcelProperty(value = "鎻愪氦鏃堕棿")
+ @Schema(description = "鎻愪氦鏃堕棿")
+ private String writeTime;
+
+ @ExcelProperty(value = "鎻愪氦鐘舵��")
+ @Schema(description = "鎻愪氦鐘舵��")
+ private String state;
+
+ @ExcelProperty(value = "瀹℃牳浜�")
+ @Schema(description = "瀹℃牳浜�")
+ private String examineUser;
+
+ @ExcelProperty(value = "瀹℃牳鏃堕棿")
+ @Schema(description = "瀹℃牳鏃堕棿")
+ private String examineTime;
+
+ @ExcelProperty(value = "瀹℃牳鐘舵��")
+ @Schema(description = "瀹℃牳鐘舵��")
+ private String isExamine;
+
+ @ExcelProperty(value = "瀹℃牳澶囨敞")
+ @Schema(description = "瀹℃牳澶囨敞")
+ private String examineTell;
+
+ @ExcelProperty(value = "鎵瑰噯浜�")
+ @Schema(description = "鎵瑰噯浜�")
+ private String ratifyUser;
+
+ @ExcelProperty(value = "鎵瑰噯鏃堕棿")
+ @Schema(description = "鎵瑰噯鏃堕棿")
+ private String ratifyTime;
+
+ @ExcelProperty(value = "鎵瑰噯鐘舵��")
+ @Schema(description = "鎵瑰噯鐘舵��")
+ private String isRatify;
+
+ @ExcelProperty(value = "鎵瑰噯澶囨敞")
+ @Schema(description = "鎵瑰噯澶囨敞")
+ private String ratifyTell;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsulatingDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsulatingDto.java
new file mode 100644
index 0000000..641f499
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsulatingDto.java
@@ -0,0 +1,20 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsProduct;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class InsulatingDto {
+
+ // 鏂规硶id
+ private Integer standardMethodListId;
+
+ // 鑺暟
+ private List<String> num;
+
+ // 妫�楠岄」
+ private List<InsProduct> insProduct;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/OmitOrderProductDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/OmitOrderProductDto.java
new file mode 100644
index 0000000..6b9819f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/OmitOrderProductDto.java
@@ -0,0 +1,21 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsProduct;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author zhuo
+ * @Date 2024/12/12
+ */
+@Data
+public class OmitOrderProductDto {
+ @Schema(description = "闇�瑕佹坊鍔犵殑鏍峰搧Id")
+ private Integer insSampleId;
+
+
+ @Schema(description = "闇�瑕佺粦瀹氱殑妫�楠岄」")
+ private List<InsProduct> insProductBindingList;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/OrderSplitDTO.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/OrderSplitDTO.java
new file mode 100644
index 0000000..1fb48ad
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/OrderSplitDTO.java
@@ -0,0 +1,38 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.excel.OrderSplitExcelData;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 璁㈠崟鎷嗗垎dto
+ */
+@Data
+public class OrderSplitDTO implements Serializable {
+
+ /**
+ * ifs璁㈠崟涓婚敭id
+ */
+ @Schema(description = "ifs璁㈠崟涓婚敭id")
+ private Long ifsId;
+
+ /**
+ *鎷嗗垎璇︽儏鍒楄〃
+ */
+ @Schema(description = "鎷嗗垎璇︽儏鍒楄〃")
+ private List<OrderSplitExcelData> splitDetailList;
+
+ /**
+ *鏄惁鍚屾鍒癕ES
+ */
+ @Schema(description = "鏄惁鍚屾鍒癕ES")
+ private Boolean pushToMes;
+
+ @Schema(description = "鐗╂枡灞炴�э紝鐢ㄤ簬鍖哄垎閾溿�侀摑瀵间綋绛夋潗鏂�")
+ private String materialProp;
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/OrderTemplateSelectionDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/OrderTemplateSelectionDto.java
new file mode 100644
index 0000000..4956689
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/OrderTemplateSelectionDto.java
@@ -0,0 +1,15 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/** 涓嬪崟鏃朵繚鐣欑殑鍘熷璁板綍妯℃澘銆� */
+@Data
+public class OrderTemplateSelectionDto {
+
+ @Schema(description = "妯℃澘ID")
+ private Integer templateId;
+
+ @Schema(description = "妯℃澘灞曠ず鍙婄敓鎴愰『搴�")
+ private Integer sort;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/ProcurementSuppliesListEDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/ProcurementSuppliesListEDto.java
new file mode 100644
index 0000000..824bbf7
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/ProcurementSuppliesListEDto.java
@@ -0,0 +1,54 @@
+package com.ruoyi.inspect.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class ProcurementSuppliesListEDto {
+
+ @TableId(value = "id", type = IdType.AUTO)
+ @Schema(description = "缂栧彿")
+ @ExcelProperty("缂栧彿")
+ private Long id;
+
+ @Schema(description = "鑰楁潗绫诲瀷")
+ @ExcelProperty("绫诲埆")
+ private String consumablesType;
+
+ @Schema(description = "璐у彿")
+ @ExcelProperty("璐у彿")
+ private String itemNumber;
+
+ @Schema(description = "鑰楁潗鍚嶇О")
+ @ExcelProperty("鍚嶇О")
+ private String consumablesName;
+
+ @Schema(description = "瑙勬牸")
+ @ExcelProperty("瑙勬牸")
+ private String specifications;
+
+ @Schema(description = "璁¢噺鍗曚綅")
+ @ExcelProperty("璁¢噺鍗曚綅")
+ private String unit;
+
+
+
+
+ @Schema(description = "搴撳瓨涓嬮檺")
+ @ExcelProperty("搴撳瓨涓嬮檺")
+ private Integer lowerLimit;
+
+
+
+ @Schema(description = "澶囨敞")
+ @ExcelProperty("澶囨敞")
+ private String remark;
+
+
+ @Schema(description = "褰撳墠搴撳瓨鏁伴噺")
+ @ExcelProperty("褰撳墠搴撳瓨")
+ private Integer currentAmount;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/ProductResultDto2.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/ProductResultDto2.java
new file mode 100644
index 0000000..3e76881
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/ProductResultDto2.java
@@ -0,0 +1,19 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsProduct;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class ProductResultDto2 extends InsProduct {
+
+ @Schema(description = "妫�楠岃澶�")
+ private String equipValue;
+
+ @Schema(description = "妫�楠屼汉")
+ private String updateUserName;
+
+ @Schema(description = "濮旀墭缂栧彿")
+ private String entrustCode;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/RawMaterialStandardTreeDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/RawMaterialStandardTreeDto.java
new file mode 100644
index 0000000..fa031b3
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/RawMaterialStandardTreeDto.java
@@ -0,0 +1,35 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.basic.dto.ModelDto;
+import com.ruoyi.basic.dto.SampleDto;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author zhuo
+ * @Date 2024/7/31
+ */
+@Data
+public class RawMaterialStandardTreeDto {
+
+ @Schema(description = "鏍戝悕绉�")
+ private String treeName;
+
+ @Schema(description = "鏍戝悕绉�")
+ private String code;
+
+ @Schema(description = "鏍戝悕绉�")
+ private String label;
+
+ @Schema(description = "鏍戝悕绉�")
+ private String value;
+
+ @Schema(description = "浜у搧")
+ private List<SampleDto> children1;
+
+ @Schema(description = "鍨嬪彿")
+ private List<ModelDto> children2;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java
new file mode 100644
index 0000000..7c79187
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java
@@ -0,0 +1,48 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsReport;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class ReportPageDto extends InsReport implements Serializable {
+
+ @Schema(description = "濮旀墭缂栧彿")
+ private String entrustCode;
+
+ @Schema(description = "鎻愪氦浜�")
+ private String writeUserName;
+
+ @Schema(description = "鎵瑰噯浜�")
+ private String ratifyUser;
+
+ @Schema(description = "瀹℃牳浜�")
+ private String examineUser;
+
+ @Schema(description = "涓嬪崟绫诲埆")
+ private Integer typeSource;
+
+ @Schema(description = "鐗╂枡灞炴��")
+ private String materialProp;
+
+ @Schema(description = "妫�楠岀被鍒�")
+ private String orderType;
+
+ @Schema(description = "鍘熸潗鏂檌d")
+ private Integer ifsInventoryId;
+
+ @Schema(description = "鏄惁澶嶆牳閫氳繃")
+ private String queryStatus;
+
+ @Schema(description = "鏄惁鏄摐鏉�, 0鍚�, 1鏄�")
+ private Integer isCopper;
+
+ @Schema(description = "瀹為獙瀹�")
+ private String sonLaboratory;
+
+ @Schema(description = "鍙湅鑷繁鏍囪瘑")
+ private Integer createOrderUser;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleOrderDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleOrderDto.java
new file mode 100644
index 0000000..af0e5c5
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleOrderDto.java
@@ -0,0 +1,106 @@
+package com.ruoyi.inspect.dto;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.inspect.pojo.InsOrder;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @author gaoaoy
+ * @version 1.0.0
+ * @create 2024/3/14 18:46
+ **/
+@Data
+@ExcelIgnoreUnannotated
+public class SampleOrderDto extends InsOrder {
+
+ @Schema(description = "妫�楠屽璞�")
+ private String sampleType;
+
+ @ExcelProperty(index = 2, value = "鏍峰搧鍚嶇О")
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sampleName;
+
+ @ExcelProperty(index = 3, value = "鏍峰搧鍨嬪彿")
+ @Schema(description = "鏍峰搧鍨嬪彿")
+ private String sampleModel;
+
+ @Schema(description = "鎸囨淳妫�楠屼汉id")
+ private String assign;
+
+ @ExcelProperty(index = 4, value = "鏍峰搧鏁伴噺")
+ @Schema(description = "鏍峰搧鏁伴噺")
+ private Integer sampleNum;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+
+ @ExcelProperty(index = 8, value = "妫�楠岃繘搴�%")
+ @Schema(description = "妫�楠岃繘搴�%")
+ private String insProgress;
+
+ @Schema(description = "鎶ュ憡id")
+ private String reportId;
+
+ @Schema(description = "绯荤粺鐢熸垚鎶ュ憡鍦板潃")
+ @TableField("`url`")
+ private String url;
+
+ @Schema(description = "鎵嬪姩涓婁紶鎶ュ憡鍦板潃")
+ private String urlS;
+
+ @Schema(description = "涓嬪崟浜哄鍚�")
+ private String name;
+
+ @ExcelProperty(index = 5, value = "妫�楠屼汉")
+ @Schema(description = "妫�楠屼汉")
+ private String testingName;
+
+ /**
+ * (鎶ュ憡瀵煎嚭)绱ф�ョ▼搴� 锛�0鏅�� 1浼樺厛 2绱ф�ワ級
+ */
+ @ExcelProperty(index = 6, value = "绱ф�ョ▼搴�")
+ @Schema(description = "绱ф�ョ▼搴� 锛�0鏅�� 1浼樺厛 2绱ф�ワ級")
+ private String typeString;
+
+ /**
+ * (鎶ュ憡瀵煎嚭)妫�楠岀粨鏋�
+ */
+ @ExcelProperty(index = 10, value = "妫�楠岀粨鏋�")
+ @Schema(description = "妫�楠岀粨鏋�")
+ private String insResultString;
+
+ /**
+ * (鎶ュ憡瀵煎嚭)涓嶅悎鏍奸」鐩�
+ */
+ @Schema(description = "涓嶅悎鏍奸」")
+ @ExcelProperty(index = 13, value = "涓嶅悎鏍奸」")
+ private String unqualifiedItem;
+
+ /**
+ * (鎶ュ憡瀵煎嚭)涓嬪崟鏃堕棿
+ */
+ @ExcelProperty(index = 11, value = "涓嬪崟鏃堕棿")
+ @Schema(description = "涓嬪崟鏃堕棿")
+ private String createTimeString;
+
+ @Schema(description = "瀛愬疄楠屽")
+ private String sonLaboratory;
+
+ @Schema(description = "鏍峰搧鍚嶇О锛堝師鏉愭枡鍙栨牱鍝佸瓧娈碉紝鎴愬搧鍙栨姤鍛婂睍绀哄瓧娈碉級")
+ private String sampleStr;
+
+
+ @Schema(description = "鎬讳环")
+ private String totalPrice;
+
+ @Schema(description = "璁㈠崟id(瀵煎嚭鐢�)")
+ private String ids;
+
+ @Schema(description = "鎷掓敹鍘熷洜")
+ private String sampleRejectRemark;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto.java
new file mode 100644
index 0000000..02c2807
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto.java
@@ -0,0 +1,28 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.inspect.pojo.InsSample;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SampleProductDto extends InsSample {
+
+ @Schema(description = "妫�楠岄」鐩�")
+ private List<InsProduct> insProduct;
+
+ @Schema(description = "瀛愭牱鍝侀厤缃�")
+ private List<SampleProductDto> childSampleList;
+
+ @Schema(description = "鐢电紗閰嶇疆瀵硅薄")
+ private InsulatingDto insulating;
+
+ @Schema(description = "杈呭姪绾胯姱閰嶇疆")
+ private InsulatingDto auxiliaryWireCore;
+
+ @Schema(description = "妫�楠屼汉")
+ private String checkName;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto2.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto2.java
new file mode 100644
index 0000000..305caba
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto2.java
@@ -0,0 +1,124 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.TreeMap;
+
+@Data
+public class SampleProductDto2 implements Serializable {
+
+ @Schema(description = "鏍峰搧id")
+ private Integer id;
+
+ @Schema(description = "妫�楠岄」id")
+ private Integer insProductId;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sample;
+
+ @Schema(description = "妫�楠岄」鍒嗙被")
+ private String inspectionItemClass;
+
+ @Schema(description = "妫�楠岄」鍒嗙被鑻辨枃")
+ private String inspectionItemClassEN;
+
+ @Schema(description = "妫�楠岄」")
+ private String inspectionItem;
+
+ @Schema(description = "妫�楠岄」鑻辨枃")
+ private String inspectionItemEn;
+
+ @Schema(description = "妫�楠屽瓙椤�")
+ private String inspectionItemSubclass;
+
+ @Schema(description = "妫�楠屽瓙椤硅嫳鏂�")
+ private String inspectionItemSubclassEn;
+
+ @Schema(description = "鍗曚綅")
+ private String unit;
+
+ @Schema(description = "鏍峰搧鍨嬪彿")
+ private String model;
+
+ @Schema(description = "鏍峰搧鐘舵��")
+ private Integer insState;
+
+ @Schema(description = "瀹為獙瀹�")
+ private String sonLaboratory;
+
+ @Schema(description = "妫�楠岄」绫诲瀷")
+ private String inspectionItemType;
+
+ @Schema(description = "妫�楠屽�肩被鍨�")
+ private String inspectionValueType;
+
+ @Schema(description = "瑕佹眰鍊�")
+ private String ask;
+
+ @Schema(description = "璇曢獙瑕佹眰")
+ private String tell;
+
+ @Schema(description = "妫�楠岀粨鏋�")
+ private String lastValue;
+
+ @Schema(description = "缁撴灉鍒ゅ畾")
+ private Integer insResult;
+
+ @Schema(description = "妫�楠屼汉")
+ private String checkName;
+
+ @Schema(description = "妫�楠屾棩鏈�")
+ private String checkTime;
+
+ @Schema(description = "璁惧鍊�")
+ private String equipValue;
+
+ @Schema(description = "搴忓彿")
+ private String index;
+ @Schema(description = "鏍峰搧鍚嶇О(鏁翠綋)")
+ private String inspectionName;
+
+ @Schema(description = "鏉′欢")
+ private String radius;
+
+ @Schema(description = "妫�楠岀粨鏋滃垪琛�")
+ private List<String> lastValueList;
+
+ @Schema(description = "妫�楠岀粨鏋滃垪琛�")
+ private List<Integer> insResultList;
+
+ @Schema(description = "鏈�缁堢粨鏋�")
+ private String finalResult;
+
+ @Schema(description = "鍘熸潗鏂檌d")
+ private Integer ifsInventoryId;
+
+ @Schema(description = "妫�楠屽崟绫诲瀷")
+ private String orderType;
+
+ @Schema(description = "妫�楠屽崟绫诲瀷")
+ private Integer quantity;
+
+ @Schema(description = "妫�楠屽崟绫诲瀷")
+ private Integer sort;
+
+ @Schema(description = "鐢电紗鏍囪瘑")
+ private String cableTag;
+
+ @Schema(description = "鍞竴缁撴灉鍊�")
+ private LinkedHashSet<String> tellSet;
+
+ @Schema(description = "鐢电紗鏍囪瘑鍐呭闆嗗悎")
+ private TreeMap<String, String> cableTagValueMap;
+
+ @Schema(description = "鐢电紗鏍囪瘑缁撴灉闆嗗悎")
+ private TreeMap<String, Integer> cableTagResultMap;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductExportDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductExportDto.java
new file mode 100644
index 0000000..1dbce0e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductExportDto.java
@@ -0,0 +1,128 @@
+package com.ruoyi.inspect.dto;
+
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.TreeMap;
+
+/**
+ * @Author zhuo
+ * @Date 2024/11/30
+ */
+@Data
+public class SampleProductExportDto {
+
+ @Schema(description = "鏍峰搧id")
+ private Integer id;
+
+ @Schema(description = "浜у搧id")
+ private Integer insProductId;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sample;
+
+ @Schema(description = "妫�楠岄」鍒嗙被")
+ private String inspectionItemClass;
+ private String inspectionItemClassEN;
+
+ @Schema(description = "妫�楠岄」")
+ private String inspectionItem;
+ private String inspectionItemEn;
+
+ @Schema(description = "妫�楠屽瓙椤�")
+ private String inspectionItemSubclass;
+ private String inspectionItemSubclassEn;
+
+ @Schema(description = "鍗曚綅")
+ private String unit;
+
+ @Schema(description = "鏍峰搧鍨嬪彿")
+ private String model;
+
+ @Schema(description = "鏍峰搧鐘舵��")
+ private Integer insState;
+
+ @Schema(description = "瀹為獙瀹�")
+ private String sonLaboratory;
+
+ @Schema(description = "妫�楠岄」绫诲瀷")
+ private String inspectionItemType;
+
+ @Schema(description = "妫�楠屽�肩被鍨�")
+ private String inspectionValueType;
+
+ @Schema(description = "瑕佹眰鍊�")
+ private String ask;
+
+ @Schema(description = "璇曢獙瑕佹眰")
+ private String tell;
+
+ @Schema(description = "妫�楠岀粨鏋�")
+ private String lastValue;
+
+ @Schema(description = "缁撴灉鍒ゅ畾")
+ private Integer insResult;
+
+ @Schema(description = "妫�楠屼汉")
+ private String checkName;
+
+ @Schema(description = "妫�楠屾棩鏈�")
+ private String checkTime;
+
+ @Schema(description = "搴忓彿")
+ private String index;
+
+ @Schema(description = "鍚嶇О")
+ private String inspectionName;
+
+ //鏉′欢
+ private String radius;
+
+ // 妫�楠岀粨鏋滃垪琛�
+ private List<String> lastValueList;
+
+ // 妫�楠岀粨鏋滃垪琛�
+ private List<Integer> insResultList;
+
+ //鏈�缁堢粨鏋�
+ private String finalResult;
+
+ //鍘熸潗鏂檌d
+ private Integer ifsInventoryId;
+
+ //妫�楠屽崟绫诲瀷
+ private String orderType;
+
+ //妫�楠屽崟绫诲瀷
+ private Integer quantity;
+
+ //妫�楠屽崟绫诲瀷
+ private Integer sort;
+
+ //鐢电紗鏍囪瘑
+ private String cableTag;
+
+ // 鍞竴缁撴灉鍊�
+ private LinkedHashSet<String> tellSet;
+
+ // 鐢电紗鏍囪瘑鍐呭闆嗗悎
+ private TreeMap<String, String> cableTagValueMap;
+
+ // 鐢电紗鏍囪瘑缁撴灉闆嗗悎
+ private TreeMap<String, Integer> cableTagResultMap;
+
+ // 妫�楠岄」鍜屾潯浠跺悎骞跺叧鑱�
+ public String getInspectionItemRadius() {
+ if (StringUtils.isBlank(radius)) {
+ return inspectionItem;
+ }
+ return inspectionItem + radius;
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductRawAnalysisDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductRawAnalysisDto.java
new file mode 100644
index 0000000..739170a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductRawAnalysisDto.java
@@ -0,0 +1,41 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @Author zhuo
+ * @Date 2024/10/17
+ */
+@Data
+public class SampleProductRawAnalysisDto {
+
+ @Schema(description = "鏍峰搧id")
+ private Integer insSampleId;
+
+ @Schema(description = "妫�楠岄」id")
+ private Integer insProductId;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+
+ @Schema(description = "妫�楠岄」鍚嶇О")
+ private String inspectionItem;
+
+ @Schema(description = "妫�楠岀粨鏋�")
+ private String lastValue;
+
+ @Schema(description = "鍚堟牸鍒ゆ柇, 1:鍚堟牸, 0:涓嶅悎鏍�, 3:涓嶅垽瀹�")
+ private Integer insResult;
+
+ @Schema(description = "鎵规鍙�")
+ private String updateBatchNo;
+
+ @Schema(description = "鍘傚鍚嶇О")
+ private String supplierName;
+
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sample;
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptActionDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptActionDto.java
new file mode 100644
index 0000000..aa21532
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptActionDto.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class SampleReceiptActionDto {
+
+ @Schema(description = "鏍峰搧鎺ユ敹璁板綍ID")
+ private Integer receiptId;
+
+ @Schema(description = "涓绘楠屼汉ID")
+ private Integer mainInspectorId;
+
+ @Schema(description = "鎺ユ敹澶囨敞锛屾嫆鏀舵椂涓烘嫆鏀跺娉�")
+ private String remark;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptPageDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptPageDto.java
new file mode 100644
index 0000000..1ddc52f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptPageDto.java
@@ -0,0 +1,52 @@
+package com.ruoyi.inspect.dto;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@ExcelIgnoreUnannotated
+public class SampleReceiptPageDto {
+
+ @Schema(description = "鏍峰搧鎺ユ敹璁板綍ID")
+ private Integer receiptId;
+ @Schema(description = "濮旀墭鍗旾D")
+ private Integer orderId;
+ @Schema(description = "鏍峰搧ID")
+ private Integer sampleId;
+ @Schema(description = "鏍峰搧鎺ユ敹鐘舵�� 0寰呮帴鏀� 1宸叉彁浜ゆ楠� 2宸叉嫆鏀� 3宸插彇娑�")
+ private Integer status;
+ @ExcelProperty(value = "鏍峰搧鍚嶇О", index = 0)
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sampleName;
+ @ExcelProperty(value = "鏍峰搧缂栧彿", index = 1)
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+ @ExcelProperty(value = "妫�娴嬮」鐩�", index = 2)
+ @Schema(description = "妫�娴嬮」鐩�")
+ private String inspectionItem;
+ @ExcelProperty(value = "濮旀墭缂栧彿", index = 3)
+ @Schema(description = "濮旀墭缂栧彿")
+ private String entrustCode;
+ @ExcelProperty(value = "鏂规硶鏍囧噯", index = 4)
+ @Schema(description = "鏂规硶鏍囧噯")
+ private String methodStandard;
+ @Schema(description = "涓绘楠屼汉ID")
+ private Integer mainInspectorId;
+ @ExcelProperty(value = "涓绘浜虹瀛�", index = 5)
+ @Schema(description = "涓绘楠屼汉濮撳悕")
+ private String mainInspectorName;
+ @ExcelProperty(value = "澶囨敞", index = 6)
+ @Schema(description = "鎺ユ敹澶囨敞")
+ private String remark;
+ @ExcelProperty(value = "鎷掓敹澶囨敞", index = 7)
+ @Schema(description = "鎷掓敹澶囨敞")
+ private String rejectRemark;
+ @Schema(description = "鎺ユ敹澶勭悊鏃堕棿")
+ private LocalDateTime receiveTime;
+ @Schema(description = "鎺ユ敹澶勭悊浜�")
+ private String receiveUserName;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptQueryDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptQueryDto.java
new file mode 100644
index 0000000..38d9674
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleReceiptQueryDto.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class SampleReceiptQueryDto {
+
+ @Schema(description = "鏍峰搧鎺ユ敹鐘舵�� 0寰呮帴鏀� 1宸叉彁浜ゆ楠� 2宸叉嫆鏀� 3宸插彇娑�")
+ private Integer status;
+ @Schema(description = "濮旀墭缂栧彿")
+ private String entrustCode;
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sampleName;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveInsContextDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveInsContextDto.java
new file mode 100644
index 0000000..8cc846b
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveInsContextDto.java
@@ -0,0 +1,29 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 淇濆瓨妯℃澘浼犲弬
+ */
+@Data
+public class SaveInsContextDto {
+
+ @Schema(description = "妯℃澘鍐呭")
+ private String param;
+
+ @Schema(description = "褰撳墠妯℃澘id")
+ private Integer currentTable;
+
+ @Schema(description = "褰撳墠鏍峰搧id")
+ private Integer sampleId;
+
+ @Schema(description = "褰撳墠璁㈠崟id")
+ private Integer orderId;
+
+ @Schema(description = "瀛愯瘯楠屽")
+ private String sonLaboratory;
+
+ @Schema(description = "鏄惁娌℃湁妫�楠屽��")
+ private Integer isNoTestValue;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveOrderDevicesDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveOrderDevicesDto.java
new file mode 100644
index 0000000..6260bf9
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveOrderDevicesDto.java
@@ -0,0 +1,12 @@
+package com.ruoyi.inspect.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/** 妫�楠屽崟姒傚喌涓殑璁惧閫夋嫨銆� */
+@Data
+public class SaveOrderDevicesDto {
+ private Integer orderId;
+ private List<Integer> deviceIds;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveTemplateContextDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveTemplateContextDto.java
new file mode 100644
index 0000000..7190653
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveTemplateContextDto.java
@@ -0,0 +1,14 @@
+package com.ruoyi.inspect.dto;
+
+import lombok.Data;
+
+import java.util.Map;
+
+/** 鏂拌仛鍘熷璁板綍妯℃澘鎸夊潗鏍囦繚瀛樸�� */
+@Data
+public class SaveTemplateContextDto {
+ private Integer orderId;
+ private Integer sampleId;
+ private Integer templateId;
+ private Map<String, Object> values;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SpotCheckQuarterDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SpotCheckQuarterDto.java
new file mode 100644
index 0000000..652218c
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SpotCheckQuarterDto.java
@@ -0,0 +1,22 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.SpotCheckQuarter;
+import com.ruoyi.inspect.pojo.SpotCheckQuarterItem;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author zhuo
+ * @Date 2024/10/10
+ */
+@Data
+public class SpotCheckQuarterDto extends SpotCheckQuarter {
+
+ @Schema(description = "瀛e害鎶芥璇︽儏")
+ private List<SpotCheckQuarterItem> quarterItems;
+
+ @Schema(description = "鍒涘缓浜�")
+ private String createUserName;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/SpotCheckYearDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SpotCheckYearDto.java
new file mode 100644
index 0000000..f2bd2bf
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/SpotCheckYearDto.java
@@ -0,0 +1,22 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.SpotCheckYear;
+import com.ruoyi.inspect.pojo.SpotCheckYearItem;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author zhuo
+ * @Date 2024/10/10
+ */
+@Data
+public class SpotCheckYearDto extends SpotCheckYear {
+
+ @Schema(description = "骞村害鎶芥牱璇︽儏")
+ private List<SpotCheckYearItem> yearItems;
+
+ @Schema(description = "鍒涘缓浜�")
+ private String createUserName;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/TemplateRateDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/TemplateRateDto.java
new file mode 100644
index 0000000..c214fda
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/TemplateRateDto.java
@@ -0,0 +1,16 @@
+package com.ruoyi.inspect.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class TemplateRateDto {
+ @Schema(description = "妫�楠岄」鐩�")
+ private String number;
+ @Schema(description = "妯℃澘鍚嶇О")
+ private String name;
+ @Schema(description = "浠锋牸(鍏�)")
+ private BigDecimal price;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/UnqualifiedHandlerDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/UnqualifiedHandlerDto.java
new file mode 100644
index 0000000..ffd73f0
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/UnqualifiedHandlerDto.java
@@ -0,0 +1,148 @@
+package com.ruoyi.inspect.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandler;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandlerFile;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Data
+public class UnqualifiedHandlerDto extends InsUnqualifiedHandler implements Serializable {
+
+ @Schema(description = "鍩�")
+ private String contract;
+
+ @Schema(description = "璁㈠崟鍙�")
+ private String orderNo;
+
+ @Schema(description = "琛屽彿")
+ private String lineNo;
+
+ @Schema(description = "涓嬭揪鍙�")
+ private String releaseNo;
+
+ @Schema(description = "鎺ユ敹鍙�")
+ private Integer receiptNo;
+
+ @Schema(description = "闆朵欢鍙�")
+ private String partNo;
+
+ @Schema(description = "闆朵欢鎻忚堪")
+ private String partDesc;
+
+ @Schema(description = "鐘舵�佹弿杩�")
+ private String status;
+
+ @Schema(description = "鐘舵��")
+ private String statusDB;
+
+ @Schema(description = "鎶佃揪鐨勯噰璐暟閲�")
+ private BigDecimal qtyArrived;
+
+ @Schema(description = "宸叉楠岀殑璐拱鏁伴噺")
+ private BigDecimal qtyInspected;
+
+ @Schema(description = "瑕佹楠岀殑閲囪喘鏁伴噺")
+ private BigDecimal qtyToInspect;
+
+ @Schema(description = "渚涘簲鍟嗙紪鍙�")
+ private String supplierId;
+
+ @Schema(description = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+ @Schema(description = "鎶佃揪鐨勫簱瀛樻暟閲�")
+ private BigDecimal invQtyInStore;
+
+ @Schema(description = "鎶佃揪鐨勯噰璐暟閲�")
+ private BigDecimal purQtyInStore;
+
+ @Schema(description = "閰嶇疆鏍囪瘑")
+ private String configurationId;
+
+ @Schema(description = "鎵瑰彿")
+ private String lotBatchNo;
+
+ @Schema(description = "wdr鍙�")
+ private String waivDevRejNo;
+
+ @Schema(description = "娲诲姩搴忓垪")
+ private String activitySeq;
+
+ @Schema(description = "搴忓垪鍙�")
+ private String serialNo;
+
+ @Schema(description = "搴撲綅鍙�")
+ private String locationNo;
+
+ @Schema(description = "鐗堟湰鍙�")
+ private String engChgLevel;
+
+ @Schema(description = "鎺ユ敹浜�")
+ private String receiver;
+
+ @Schema(description = "鎺ユ敹浜哄鍚�")
+ private String receiverName;
+
+ @Schema(description = "閲囪喘鍛�")
+ private String buyerCode;
+
+ @Schema(description = "閲囪喘鍛樺鍚�")
+ private String buyerName;
+
+ @Schema(description = "瀹為檯鍒拌揣鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime arriveDate;
+
+ @Schema(description = "瀹為檯浜よ揣鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime deliveryDate;
+
+ @Schema(description = "鐢熶骇鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime productDate;
+
+ @Schema(description = "澶辨晥鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime invalidDate;
+
+
+ @Schema(description = "瀹℃壒鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime approvedDate;
+
+ @Schema(description = "閲囪喘鐢宠鍒涘缓浜�")
+ private String reqCeater;
+
+ @Schema(description = "閲囪喘鐢宠鍒涘缓浜哄鍚�")
+ private String reqCeaterName;
+
+ @Schema(description = "閲囪喘璁㈠崟琛屽娉�")
+ private String lineRemarks;
+
+ @Schema(description = "閲囪喘鍗曚綅")
+ private String buyUnitMeas;
+
+
+ private Integer isSource;
+
+ private Integer number;
+
+ private Integer state;
+
+ @Schema(description = "鎺ユ敹鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime receiverDate;
+
+
+ @Schema(description = "闄勪欢鍒楄〃")
+ private List<InsUnqualifiedHandlerFile> unqualifiedHandlerFiles;
+
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/VerifyPlanDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/VerifyPlanDto.java
new file mode 100644
index 0000000..10a2185
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/VerifyPlanDto.java
@@ -0,0 +1,16 @@
+package com.ruoyi.inspect.dto;
+
+import lombok.Data;
+
+/** 妫�楠屽鏍告彁浜ゅ弬鏁般�� */
+@Data
+public class VerifyPlanDto {
+ private Integer orderId;
+ private String laboratory;
+ /** 1 閫氳繃锛�0 閫�鍥炪�� */
+ private Integer type;
+ private String tell;
+ private Integer userId;
+ /** 鏂拌仛妫�楠屽崟鏁翠綋缁撹锛�1 鍚堟牸锛�0 涓嶅悎鏍笺�� */
+ private Integer insResult;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/WarehouseCellAndSampleDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/WarehouseCellAndSampleDto.java
new file mode 100644
index 0000000..59f3939
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/WarehouseCellAndSampleDto.java
@@ -0,0 +1,14 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.InsSample;
+import com.ruoyi.inspect.pojo.WarehouseCell;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class WarehouseCellAndSampleDto extends WarehouseCell {
+
+ private List<InsSample> samples;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/WarehouseDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/WarehouseDto.java
new file mode 100644
index 0000000..180e741
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/WarehouseDto.java
@@ -0,0 +1,14 @@
+package com.ruoyi.inspect.dto;
+
+import com.ruoyi.inspect.pojo.Warehouse;
+import com.ruoyi.inspect.pojo.WarehouseShelf;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class WarehouseDto extends Warehouse {
+
+ List<WarehouseShelf> warehouseShelfList;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/WriteInspectionConditionDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/WriteInspectionConditionDto.java
new file mode 100644
index 0000000..9399548
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/WriteInspectionConditionDto.java
@@ -0,0 +1,69 @@
+package com.ruoyi.inspect.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+
+import java.time.LocalDate;
+import java.util.List;
+
+/** 淇濆瓨璁㈠崟绾у娉ㄦ垨妯℃澘绾ф楠屾潯浠躲�� */
+@Data
+public class WriteInspectionConditionDto {
+
+ private Integer id;
+ private Integer templateId;
+ private String remark;
+ private String temperature;
+ private String humidity;
+
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate detectionTime;
+
+ private String detectionPlace;
+ private List<Integer> deviceIds;
+ private Integer insResult;
+
+ @JsonIgnore
+ private boolean temperaturePresent;
+ @JsonIgnore
+ private boolean humidityPresent;
+ @JsonIgnore
+ private boolean detectionTimePresent;
+ @JsonIgnore
+ private boolean detectionPlacePresent;
+ @JsonIgnore
+ private boolean deviceIdsPresent;
+ @JsonIgnore
+ private boolean insResultPresent;
+
+ public void setTemperature(String temperature) {
+ this.temperature = temperature;
+ this.temperaturePresent = true;
+ }
+
+ public void setHumidity(String humidity) {
+ this.humidity = humidity;
+ this.humidityPresent = true;
+ }
+
+ public void setDetectionTime(LocalDate detectionTime) {
+ this.detectionTime = detectionTime;
+ this.detectionTimePresent = true;
+ }
+
+ public void setDetectionPlace(String detectionPlace) {
+ this.detectionPlace = detectionPlace;
+ this.detectionPlacePresent = true;
+ }
+
+ public void setDeviceIds(List<Integer> deviceIds) {
+ this.deviceIds = deviceIds;
+ this.deviceIdsPresent = true;
+ }
+
+ public void setInsResult(Integer insResult) {
+ this.insResult = insResult;
+ this.insResultPresent = true;
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/event/NewJuOrderPlacedEvent.java b/inspect-server/src/main/java/com/ruoyi/inspect/event/NewJuOrderPlacedEvent.java
new file mode 100644
index 0000000..a59a6ef
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/event/NewJuOrderPlacedEvent.java
@@ -0,0 +1,14 @@
+package com.ruoyi.inspect.event;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+/**
+ * 鏂拌仛鐩寸粦妯℃澘涓嬪崟鎴愬姛浜嬩欢銆�
+ */
+@Data
+@AllArgsConstructor
+public class NewJuOrderPlacedEvent {
+
+ private Integer insOrderId;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/excel/OrderSplitExcelData.java b/inspect-server/src/main/java/com/ruoyi/inspect/excel/OrderSplitExcelData.java
new file mode 100644
index 0000000..77a3ea2
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/excel/OrderSplitExcelData.java
@@ -0,0 +1,107 @@
+package com.ruoyi.inspect.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 鍘熸潗鏂欐姤妫�锛氳鍗曟媶鍒嗗鍏ユā鏉垮璞�
+ */
+@Data
+public class OrderSplitExcelData implements Serializable {
+
+ /**
+ * 闆朵欢缂栧彿
+ */
+ @ExcelProperty(index = 0,value = "闆朵欢缂栧彿")
+ @Schema(description = "闆朵欢缂栧彿")
+ private String partNo;
+
+ /**
+ * 绯荤粺缂栧彿
+ */
+ @ExcelProperty(index = 1,value = "绯荤粺缂栧彿")
+ @Schema(description = "绯荤粺缂栧彿 ")
+ private String systemNo;
+
+ /**
+ * 瑙勬牸
+ */
+ @ExcelProperty(index = 2,value = "瑙勬牸")
+ @Schema(description = "瑙勬牸")
+ private String spec;
+
+ /**
+ * 闆朵欢鎵瑰彿
+ */
+ @ExcelProperty(index = 3,value = "闆朵欢鎵瑰彿")
+ @Schema(description = "闆朵欢鎵瑰彿")
+ private String lotBatchNo;
+
+ /**
+ * 搴撳瓨鏁伴噺1
+ */
+ @ExcelProperty(index = 4,value = "搴撳瓨鏁伴噺1")
+ @Schema(description = "搴撳瓨鏁伴噺1锛堢敤浜庡鎺es鍒嗙洏璁$畻锛�")
+ private BigDecimal length;
+
+ /**
+ * 搴撳瓨鏁伴噺2
+ */
+ @ExcelProperty(index = 5,value = "搴撳瓨鏁伴噺2")
+ @Schema(description = "搴撳瓨鏁伴噺2锛坕fs瀵逛簬鐨勫簱瀛樻暟閲忥級")
+ private BigDecimal qtyStock;
+
+ /**
+ * 缁濈紭棰滆壊
+ */
+ @ExcelProperty(index = 6,value = "缁濈紭棰滆壊")
+ @Schema(description = "缁濈紭棰滆壊")
+ private String insulationColor;
+
+ /**
+ * 澶栨姢棰滆壊
+ */
+ @ExcelProperty(index = 7,value = "澶栨姢棰滆壊")
+ @Schema(description = "澶栨姢棰滆壊")
+ private String outerColor;
+
+ /**
+ * 鍗板瓧淇℃伅
+ */
+ @ExcelProperty(index = 8,value = "鍗板瓧淇℃伅")
+ @Schema(description = "鍗板瓧淇℃伅")
+ private String letteringInfo;
+
+ /**
+ * 鐩樺彿
+ */
+ @ExcelProperty(index = 9,value = "鐩樺彿")
+ @Schema(description = "鐩樺彿")
+ private String drumNo;
+
+ /**
+ * 搴撲綅缂栧彿
+ */
+ @ExcelProperty(index = 10,value = "搴撲綅缂栧彿")
+ @Schema(description = "搴撲綅缂栧彿")
+ private String locationNo;
+
+ /**
+ * 搴撲綅鏉ユ簮
+ */
+ @ExcelProperty(index = 11,value = "搴撲綅鏉ユ簮")
+ @Schema(description = "搴撲綅鏉ユ簮")
+ private String stockSource;
+
+ /**
+ * 澶囨敞
+ */
+ @ExcelProperty(index = 12,value = "澶囨敞")
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/excel/OrderSplitExcelListener.java b/inspect-server/src/main/java/com/ruoyi/inspect/excel/OrderSplitExcelListener.java
new file mode 100644
index 0000000..c8eb7ae
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/excel/OrderSplitExcelListener.java
@@ -0,0 +1,146 @@
+package com.ruoyi.inspect.excel;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+
+@Slf4j
+public class OrderSplitExcelListener extends AnalysisEventListener<Map<Integer,Object>> {
+
+ //琛ㄥご妯℃澘
+ private static final String HEAD_TEMPLATE = "[闆朵欢缂栧彿, 绯荤粺缂栧彿, 瑙勬牸, 闆朵欢鎵瑰彿, 搴撳瓨鏁伴噺1, 搴撳瓨鏁伴噺2, 缁濈紭棰滆壊, 澶栨姢棰滆壊, 鍗板瓧淇℃伅, 鐩樺彿, 搴撲綅缂栧彿, 搴撲綅鏉ユ簮, 澶囨敞]";
+
+ AtomicInteger index = new AtomicInteger(0);//绗﹀悎琛ㄦ牸妯℃澘鐨勮鏁�
+
+ @Getter
+ List<OrderSplitExcelData> dataList = new ArrayList<>();//瀵煎叆鐨勬暟鎹垪琛�
+
+ IfsInventoryQuantity ifsInventoryQuantity;//瀵瑰簲鎶ユifs淇℃伅
+
+ public String errorMsg = "";
+
+ public OrderSplitExcelListener(IfsInventoryQuantity ifsInventoryQuantity) {
+ this.ifsInventoryQuantity = ifsInventoryQuantity;
+ }
+
+ AtomicReference<String> prePartLotBatchNo = new AtomicReference<>("");//涓婁竴鏉℃暟鎹殑闆朵欢鎵瑰彿
+
+ AtomicReference<BigDecimal> storeQty2Sum = new AtomicReference<>(BigDecimal.ZERO);//瀵煎叆鏁版嵁搴撳瓨鏁伴噺2鐨勬�诲拰
+
+ @Override
+ public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
+ String temp = headMap.values().toString();
+ if(StringUtils.equals(HEAD_TEMPLATE,temp)){
+ index.getAndIncrement();
+ }
+ }
+
+ @Override
+ public void invoke(Map<Integer,Object> mapData, AnalysisContext analysisContext) {
+ Integer currentRowNum = analysisContext.getCurrentRowNum();
+ OrderSplitExcelData data = transformExcelData(mapData, currentRowNum);
+ if(Objects.nonNull(data)){
+ dataList.add(data);
+ }
+ }
+
+ @Override
+ public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+ if(index.get()==0){
+ throw new RuntimeException("鏂囦欢鍐呭鏍煎紡涓庢ā鏉夸笉绗�");
+ }
+ if(storeQty2Sum.get().compareTo(ifsInventoryQuantity.getPurQtyInStore())>0){
+ throw new RuntimeException("搴撳瓨鏁伴噺2涓嶈兘澶т簬鎶ユ闆朵欢鐨勬姷杈鹃噰璐暟閲�");
+ }
+ }
+
+ /**
+ * 鏍¢獙鏁版嵁
+ * @param mapData
+ * @param rowNumber
+ */
+ private void validateRowData(Map<Integer,Object> mapData,Integer rowNumber){
+ String rowStr = "</br>绗�"+(rowNumber+1)+"琛�:";
+ List<String> errorMsgList = new ArrayList<>();
+ //闆朵欢缂栧彿
+ if(Objects.isNull(mapData.get(0))){
+ errorMsgList.add("闆朵欢缂栧彿涓嶈兘涓虹┖");
+ }else if(!StringUtils.equals(mapData.get(0).toString(),ifsInventoryQuantity.getPartNo())){
+ errorMsgList.add("闆朵欢缂栧彿涓庢姤妫�闆朵欢涓嶄竴鑷�");
+ }
+ //闆朵欢鎵瑰彿
+ if(Objects.isNull(mapData.get(3))){
+ errorMsgList.add("闆朵欢鎵瑰彿涓嶈兘涓虹┖");
+ }else if(StringUtils.equals(mapData.get(3).toString(),ifsInventoryQuantity.getLotBatchNo())){
+ errorMsgList.add("闆朵欢鎵瑰彿涓庢姤妫�闆朵欢鎵瑰彿鐩稿悓");
+ }else if(StringUtils.equals(prePartLotBatchNo.get(),mapData.get(3).toString())){
+ errorMsgList.add("闆朵欢鎵瑰彿瀛樺湪閲嶅");
+ }
+ prePartLotBatchNo.getAndSet(mapData.get(3).toString());
+ //搴撳瓨鏁伴噺2
+ if(Objects.isNull(mapData.get(5))){
+ errorMsgList.add("搴撳瓨鏁伴噺2涓嶈兘涓虹┖");
+ }else{
+ BigDecimal storeQty2 = BigDecimal.ZERO;
+ try{
+ storeQty2 = new BigDecimal(mapData.get(5).toString());
+ }catch (Exception e){
+ errorMsgList.add("搴撳瓨鏁伴噺2鏍煎紡寮傚父");
+ }
+ if(storeQty2.compareTo(ifsInventoryQuantity.getPurQtyInStore())>0){
+ errorMsgList.add("搴撳瓨鏁伴噺2涓嶈兘澶т簬鎶ユ闆朵欢鐨勬姷杈鹃噰璐暟閲�");
+ }
+ BigDecimal oldSum = storeQty2Sum.get();
+ storeQty2Sum.getAndSet(oldSum.add(storeQty2));
+ }
+ //搴撲綅缂栧彿
+ if(Objects.isNull(mapData.get(10))){
+ errorMsgList.add("搴撲綅缂栧彿涓嶈兘涓虹┖");
+ }else if(!StringUtils.equals(mapData.get(10).toString(),ifsInventoryQuantity.getLocationNo())){
+ errorMsgList.add("搴撲綅缂栧彿涓庢姤妫�闆朵欢鐨勫簱浣嶇紪鍙蜂笉涓�鑷�");
+ }
+ if(!errorMsgList.isEmpty()){
+ String errorStr = String.join(";",errorMsgList);
+ errorMsg+= rowStr + errorStr ;
+ }
+ }
+
+ /**
+ * 杞崲excel瀵煎叆琛屾暟鎹�
+ * @param mapData
+ * @return
+ */
+ private OrderSplitExcelData transformExcelData(Map<Integer,Object> mapData,Integer rowNumber){
+ validateRowData(mapData,rowNumber);
+ if(StringUtils.isBlank(errorMsg)){
+ OrderSplitExcelData data = new OrderSplitExcelData();
+ data.setPartNo(mapData.get(0).toString());
+ data.setSystemNo(Objects.isNull(mapData.get(1))?"":mapData.get(1).toString());
+ data.setSpec(Objects.isNull(mapData.get(2))?"":mapData.get(2).toString());
+ data.setLotBatchNo(Objects.isNull(mapData.get(3))?"":mapData.get(3).toString());
+ data.setLength(new BigDecimal(mapData.get(4).toString()));
+ data.setQtyStock(new BigDecimal(mapData.get(5).toString()));
+ data.setInsulationColor(Objects.isNull(mapData.get(6))?"":mapData.get(6).toString());
+ data.setOuterColor(Objects.isNull(mapData.get(7))?"":mapData.get(7).toString());
+ data.setLetteringInfo(Objects.isNull(mapData.get(8))?"":mapData.get(8).toString());
+ data.setDrumNo(Objects.isNull(mapData.get(9))?"":mapData.get(9).toString());
+ data.setLocationNo(Objects.isNull(mapData.get(10))?"":mapData.get(10).toString());
+ data.setStockSource(Objects.isNull(mapData.get(11))?"":mapData.get(11).toString());
+ data.setRemark(Objects.isNull(mapData.get(12))?"":mapData.get(12).toString());
+ return data;
+ }
+ return null;
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/DataAnalysisMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/DataAnalysisMapper.java
new file mode 100644
index 0000000..6cb9f0a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/DataAnalysisMapper.java
@@ -0,0 +1,74 @@
+package com.ruoyi.inspect.mapper;
+
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.inspect.dto.DataAnalysisDto;
+import com.ruoyi.inspect.vo.RawMaterialSupplierVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鏁版嵁鍒嗘瀽
+ *
+ * @Author zhuo
+ * @Date 2024/10/16
+ */
+@Mapper
+public interface DataAnalysisMapper {
+
+ /**
+ * 鑾峰彇鏈懆鐨勫師鏉愭枡淇℃伅
+ * @return
+ */
+ List<Map<String, Object>> getRawPassRateByBarChartByWeek(@Param("dto") DataAnalysisDto dataAnalysisDto);
+
+ /**
+ * 鑾峰彇鏈湀鐨勫師鏉愭枡淇℃伅
+ * @return
+ */
+ List<Map<String, Object>> getRawPassRateByBarChartByDay(@Param("dto") DataAnalysisDto dataAnalysisDto);
+
+ /**
+ * 鑾峰彇鏈勾鐨勫師鏉愭枡淇℃伅
+ * @return
+ */
+ List<Map<String, Object>> getRawPassRateByBarChartByYear(@Param("dto") DataAnalysisDto dataAnalysisDtor);
+
+ /**
+ * 鏌ョ湅鍘熸潗鏂欓ゼ鐘跺浘
+ * @return
+ */
+ Map<String, Object> getRawPassRateByCake(@Param("dto") DataAnalysisDto dataAnalysisDto);
+
+
+ /**
+ * 鏌ヨ妫�娴嬮」闆嗗悎
+ * @param dataAnalysisDto
+ * @return
+ */
+ List<IfsInventoryQuantitySupplierDto> getRawProductAnalysisAllSample(@Param("dto") DataAnalysisDto dataAnalysisDto);
+
+ /**
+ * 鏌ヨ鎵�鏈夌殑
+ * @param dataAnalysisDto
+ * @return
+ */
+ List<IfsInventoryQuantitySupplierDto> getRawProductAnalysisList(@Param("dto") DataAnalysisDto dataAnalysisDto);
+
+
+ List<RawMaterialSupplierVo> getItemValueByOrderIds(@Param("insOrderIds") List<Integer> insOrderIds, @Param("itemName") String itemName);
+
+ /**
+ * 鏌ヨ鏈湀涓庝笂鏈堝悎鏍肩巼瀵规瘮
+ * @return
+ */
+ List<Map<String, Object>> getRawUpMonth();
+
+ /**
+ * 鏌ヨ妫�楠岄」绫诲瀷楗煎浘
+ * @return
+ */
+ Map<String, Object> getOrderTypeCookie();
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/IfsPartPropsRecordMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/IfsPartPropsRecordMapper.java
new file mode 100644
index 0000000..23033cf
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/IfsPartPropsRecordMapper.java
@@ -0,0 +1,22 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.IfsPartPropsRecord;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑fs_part_props_record(ifs璁㈠崟闆朵欢灞炴�ц褰曡〃)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2025-10-23 15:00:34
+* @Entity com.ruoyi.inspect.pojo.IfsPartPropsRecord
+*/
+@Mapper
+public interface IfsPartPropsRecordMapper extends BaseMapper<IfsPartPropsRecord> {
+
+ Long selectCountByPartNoAndLotBatchNo(@Param("partNo") String partNo, @Param("lotBatchNo") String lotBatchNo);
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/IfsSplitOrderRecordMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/IfsSplitOrderRecordMapper.java
new file mode 100644
index 0000000..148f82b
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/IfsSplitOrderRecordMapper.java
@@ -0,0 +1,20 @@
+package com.ruoyi.inspect.mapper;
+
+import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑fs_split_order_record(ifs鍘熸潗鏂欒鍗曟媶鍒嗚褰曡〃)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2025-10-29 16:39:41
+* @Entity com.ruoyi.inspect.pojo.IfsSplitOrderRecord
+*/
+@Mapper
+public interface IfsSplitOrderRecordMapper extends BaseMapper<IfsSplitOrderRecord> {
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderDeviceRecordMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderDeviceRecordMapper.java
new file mode 100644
index 0000000..ea79796
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderDeviceRecordMapper.java
@@ -0,0 +1,33 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.dto.InsOrderDeviceRecordDto;
+import com.ruoyi.inspect.pojo.InsOrderDeviceRecord;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * cnas璁惧浣跨敤璁板綍琛�(DeviceRecord)$desc
+ *
+ * @author makejava
+ * @since 2024-12-21 11:11:01
+ */
+public interface InsOrderDeviceRecordMapper extends BaseMapper<InsOrderDeviceRecord> {
+
+ /**
+ * 鏌ヨ璁惧浣跨敤璁板綍
+ * @param insOrderId
+ * @return
+ */
+ List<InsOrderDeviceRecordDto> selectDeviceNumber(@Param("insOrderId") Integer insOrderId);
+
+ /**
+ * 鏍规嵁缂栧彿鏌ヨ璁惧id
+ * @param deviceNumbers
+ * @return
+ */
+ List<Integer> selectDeviceIdsByNumbers(@Param("deviceNumbers") Set<String> deviceNumbers);
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFactoryVerifyItemMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFactoryVerifyItemMapper.java
new file mode 100644
index 0000000..a858ab1
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFactoryVerifyItemMapper.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsOrderFactoryVerifyItem;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 鍘熸潗鏂欏巶瀹惰繘璐ч獙璇佹楠岄」
+ *
+ * @author zhuo
+ * @since 2024-09-26
+ */
+@Mapper
+public interface InsOrderFactoryVerifyItemMapper extends BaseMapper<InsOrderFactoryVerifyItem> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFactoryVerifyMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFactoryVerifyMapper.java
new file mode 100644
index 0000000..5012c04
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFactoryVerifyMapper.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsOrderFactoryVerify;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 鍘熸潗鏂欏巶瀹惰繘璐ч獙璇�
+ *
+ * @author zhuo
+ * @since 2024-09-26
+ */
+@Mapper
+public interface InsOrderFactoryVerifyMapper extends BaseMapper<InsOrderFactoryVerify> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFileMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFileMapper.java
new file mode 100644
index 0000000..f4f3c4a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderFileMapper.java
@@ -0,0 +1,21 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.pojo.InsOrderFile;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 妫�楠屽崟涓嬬殑闄勪欢鍒楄〃 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
+ * @since 2024-06-06 10:08:21
+ */
+public interface InsOrderFileMapper extends BaseMapper<InsOrderFile> {
+
+ IPage<InsOrderFile> getFileList(@Param("page") Page page, @Param("ew") QueryWrapper<InsOrderFile> ew, @Param("insOrderId") Integer insOrderId);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java
new file mode 100644
index 0000000..d1662ae
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java
@@ -0,0 +1,177 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.InventoryDetailDTO;
+import com.ruoyi.basic.pojo.StructureTestObject;
+import com.ruoyi.inspect.dto.SampleOrderDto;
+import com.ruoyi.inspect.dto.SampleProductDto2;
+import com.ruoyi.inspect.dto.SampleProductExportDto;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.vo.IfsOrderVO;
+import com.ruoyi.inspect.vo.InsOrderPrintingVo;
+import com.ruoyi.inspect.vo.SampleDefectsFatherVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author gaoaoy
+ * @description 閽堝琛ㄣ�恑ns_order(妫�楠屼笅鍗�)銆戠殑鏁版嵁搴撴搷浣淢apper
+ * @createDate 2024-03-12 16:17:55
+ * @Entity com.yuanchu.mom.pojo.InsOrder
+ */
+@Mapper
+public interface InsOrderMapper extends BaseMapper<InsOrder> {
+
+ //鑾峰彇妫�楠屼笅鍗曟暟鎹�
+ IPage<SampleOrderDto> selectInsOrderPage(@Param("page") IPage<InsOrder> page, @Param("ew") QueryWrapper<SampleOrderDto> ew, @Param("laboratory") String laboratory, @Param("isOrderAll") String isOrderAll, @Param("receiptSubmitted") String receiptSubmitted);
+
+
+ String getLaboratoryCode(@Param("name") String name);
+
+ IPage<SampleProductDto2> selectSampleAndProductByOrderId(@Param("page") IPage<SampleProductDto2> page, @Param("ew") QueryWrapper<SampleProductDto2> ew, @Param("id") Integer id);
+
+ List<Map<String, String>> selectDeviceListByIds(@Param("deviceIds") Set<Integer> deviceIds);
+
+ List<SampleDefectsFatherVo> selectSampleDefects(Page page, @Param("inspectionItems") String inspectionItems, @Param("orderNumber") String orderNumber);
+
+ String getStandardMethodCode(@Param("id") Integer id);
+
+ String getStandardMethodReportText(@Param("id") Integer id);
+
+ String getStandardMethodReportTextByCode(@Param("code") String code);
+
+ int updateStatus(@Param("id") Integer id);
+
+ String selLaboratoryCode(@Param("laboratory") String laboratory);
+
+ List<Map<Integer, Object>> selectReportModelByOrderId(@Param("id") Integer id, @Param("laboratory") String laboratory);
+
+ String seldepLimsId(@Param("depLimsId") Integer depLimsId);
+
+ /**
+ * 鏌ヨ妫�楠岀粨鏋�
+ *
+ * @param ids
+ * @return
+ */
+ List<SampleProductExportDto> selectSampleBySampleId(@Param("ids") List<Integer> ids);
+
+ /**
+ * 鑾峰彇鎵归噺妫�楠岀殑鎬绘暟
+ *
+ * @param id
+ * @return
+ */
+ int selectSampleMax(@Param("id") Integer id);
+
+ /**
+ * 鑾峰彇绾胯姱棰滆壊
+ *
+ * @param id
+ * @return
+ */
+ List<String> selectSampleCableTag(@Param("id") Integer id);
+
+ /**
+ *
+ * @param orderId
+ * @return
+ */
+ int selectSampleItemS(@Param("orderId") Integer orderId);
+
+ /**
+ * 鍙煡璇㈤粯璁ょ涓�涓殑浜у搧
+ *
+ * @param id
+ * @return
+ */
+ List<SampleProductExportDto> selectSampleBySampleIdOne(@Param("id") Integer id);
+
+ /**
+ * 鏌ヨ鏃ュ巻鍥�
+ *
+ * @param
+ * @return
+ */
+ List<Map<String, Object>> selectCalendarWorkByWeek(@Param("day") Integer day);
+
+ /**
+ *
+ * @param partNo
+ * @return
+ */
+ StructureTestObject selectProductByPartNo(@Param("partNo") String partNo);
+
+ /**
+ *
+ * @param partNo
+ * @return
+ */
+ StructureTestObject selectByPartNo(@Param("partNo") String partNo);
+
+ /**
+ * 鎴愬搧鏍囩鎵撳嵃
+ *
+ * @param ids
+ * @return
+ */
+ List<InsOrderPrintingVo> labelOrderPrinting(@Param("ids") List<Integer> ids);
+
+ /**
+ * 澶栬喘浜у搧鏍囩鎵撳嵃
+ *
+ * @param ids
+ * @return
+ */
+ List<InventoryDetailDTO> labelOutsideOrderPrinting(@Param("ids") List<Integer> ids);
+
+ /**
+ * 鏌ヨ瀵煎嚭淇℃伅
+ *
+ * @return
+ */
+ List<SampleOrderDto> rawAllInsOrderExport(@Param("ew") QueryWrapper<SampleOrderDto> ew, @Param("laboratory") String laboratory, @Param("isOrderAll") String isOrderAll);
+
+ /**
+ * 鏍规嵁璁㈠崟鏌ヨ璇曢獙瀹�
+ *
+ * @param insOrderId
+ * @return
+ */
+ String selectLaboratoryByOrderId(@Param("insOrderId") Integer insOrderId);
+
+ /**
+ * 鏌ヨ璁㈠崟淇℃伅
+ *
+ * @param insSampleId
+ * @return
+ */
+ InsOrder selectFirstSubmit(@Param("insSampleId") Integer insSampleId);
+
+ /**
+ * 鏍规嵁璁㈠崟id鏌ヨ璁㈠崟瀵煎嚭淇℃伅
+ *
+ * @param orderIds
+ * @return
+ */
+ List<SampleOrderDto> getInsOrderExportByIds(@Param("orderIds") List<String> orderIds);
+
+ /**
+ * 鏌ヨ褰撳墠鏃堕棿鏄惁鏈夎妫�娴嬮」鐨勬娊鏍疯鍒掕鍗�
+ *
+ * @param itmeId 鏍峰搧Id
+ * @param startTime 寮�濮嬫椂闂�
+ * @param endTime 缁撴潫鏃堕棿
+ * @return
+ */
+ Integer selectNotSpotCheckOrder(@Param("itmeId") Integer itmeId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+ IfsOrderVO selectOrderInfoById(@Param("id") Integer id);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderRatesMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderRatesMapper.java
new file mode 100644
index 0000000..b139164
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderRatesMapper.java
@@ -0,0 +1,32 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.dto.SampleOrderDto;
+import com.ruoyi.inspect.dto.TemplateRateDto;
+import com.ruoyi.inspect.pojo.InsOrderRates;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 璁㈠崟璐圭敤琛�
+ *
+ * @author zhuo
+ * @since 2025-02-28
+ */
+public interface InsOrderRatesMapper extends BaseMapper<InsOrderRates> {
+
+ /**
+ * 鏌ヨ璁㈠崟璐圭敤鍒楄〃
+ * @return
+ */
+ IPage<SampleOrderDto> selectInsOrderRates(Page page, @Param("ew") QueryWrapper<SampleOrderDto> ew);
+
+ /**
+ * 鏌ヨ璁㈠崟璐圭敤璇︽儏锛堟ā鏉夸环鏍硷級
+ * @return
+ */
+ IPage<TemplateRateDto> selectTemplateRatesDetail(Page page, @Param("insOrderId") Integer insOrderId);
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderStandardTemplateMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderStandardTemplateMapper.java
new file mode 100644
index 0000000..2864f73
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderStandardTemplateMapper.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsOrderStandardTemplate;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 璁㈠崟鏍囧噯妯℃澘澶嶅埗
+ *
+ * @author zhuo
+ * @since 2024-11-05
+ */
+@Mapper
+public interface InsOrderStandardTemplateMapper extends BaseMapper<InsOrderStandardTemplate> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderStateMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderStateMapper.java
new file mode 100644
index 0000000..15d102f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderStateMapper.java
@@ -0,0 +1,19 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsOrderState;
+
+/**
+* @author admin
+* @description 閽堝琛ㄣ�恑ns_order_state銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-04-01 11:44:50
+* @Entity com.yuanchu.mom.pojo.InsOrderState
+*/
+public interface InsOrderStateMapper extends BaseMapper<InsOrderState> {
+
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderTemplateDeviceMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderTemplateDeviceMapper.java
new file mode 100644
index 0000000..9a3951a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderTemplateDeviceMapper.java
@@ -0,0 +1,16 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsOrderTemplateDevice;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface InsOrderTemplateDeviceMapper extends BaseMapper<InsOrderTemplateDevice> {
+
+ List<Integer> selectExistingDeviceIds(@Param("deviceIds") List<Integer> deviceIds);
+
+ List<Integer> selectDeviceIdsByOrderId(@Param("orderId") Integer orderId);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderTemplateMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderTemplateMapper.java
new file mode 100644
index 0000000..6e064e5
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderTemplateMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsOrderTemplate;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_order_template銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-03-18 14:14:54
+* @Entity com.yuanchu.mom.pojo.InsOrderTemplate
+*/
+public interface InsOrderTemplateMapper extends BaseMapper<InsOrderTemplate> {
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningDetailMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningDetailMapper.java
new file mode 100644
index 0000000..88d1de0
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningDetailMapper.java
@@ -0,0 +1,16 @@
+package com.ruoyi.inspect.mapper;
+
+import com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 妫�楠岄」鍋忓樊棰勮璇︽儏琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author
+ * @since 2025-03-28 02:18:58
+ */
+public interface InsProductDeviationWarningDetailMapper extends BaseMapper<InsProductDeviationWarningDetail> {
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningMapper.java
new file mode 100644
index 0000000..ad8eed7
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningMapper.java
@@ -0,0 +1,27 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.dto.InsProductDeviationWarningDto;
+import com.ruoyi.inspect.pojo.InsProductDeviationWarning;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 妫�楠岄」鍋忓樊棰勮涓昏〃 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author
+ * @since 2025-03-28 02:18:02
+ */
+public interface InsProductDeviationWarningMapper extends BaseMapper<InsProductDeviationWarning> {
+
+ /**
+ * 鏌ョ湅棰勮鍒楄〃
+ * @param page
+ * @return
+ */
+ IPage<InsProductDeviationWarningDto> selectDeviationWarningPage(@Param("page") Page page, @Param("ew") QueryWrapper<InsProductDeviationWarningDto> ew);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java
new file mode 100644
index 0000000..69dd801
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java
@@ -0,0 +1,88 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.dto.InsProductAnalysisDto;
+import com.ruoyi.inspect.dto.ProductResultDto2;
+import com.ruoyi.inspect.dto.SampleProductRawAnalysisDto;
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_product(妫�楠岄」鐩�)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-03-08 09:45:03
+* @Entity com.yuanchu.mom.pojo.InsProduct
+*/
+@Mapper
+public interface InsProductMapper extends BaseMapper<InsProduct> {
+
+ int selectOrderManDay(@Param("orderId") Integer orderId);
+
+ Map<String, String> selectUserById(@Param("userId") Integer userId);
+
+ List<ProductResultDto2> getProductAndResult(@Param("sampleId") Integer sampleId);
+
+ int updateInspected(@Param("id") Integer id);
+
+ List<InsProduct> selectFiberInsProduct(@Param("ids") List<Integer> ids, @Param("laboratory") String laboratory);
+
+ IPage<InsProduct> selectNoProducts(@Param("page") Page page, @Param("orderId") Integer orderId, @Param("noIds") List<Integer> noIds);
+
+ int selectInsProductCountByOrderId(@Param("orderId") Integer orderId);
+
+ /**
+ * 鏍规嵁鏍峰搧id鏌ヨ妫�楠岄」鐩�
+ * @param sampleIds
+ * @return
+ */
+ List<SampleProductRawAnalysisDto> selectListBySampleIds(@Param("sampleIds") List<Integer> sampleIds);
+
+ /**
+ * 鏌ヨ鎵�鏈夌殑妫�楠岄」
+ * @param sampleIds
+ * @return
+ */
+ List<String> selectItemNameBySampleIds(@Param("sampleIds") List<Integer> sampleIds);
+
+ /**
+ * 鏍规嵁璁㈠崟id鏌ヨ涓嶅悎鏍奸」
+ * @param orderId
+ * @return
+ */
+ List<String> selectUnqualifiedList(@Param("orderId") Integer orderId);
+
+ /**
+ * 鏌ヨ鍒ゆ柇鏄惁鏈変笉鍒ゅ畾椤圭洰,鍜屽叏閮芥槸鍒ゅ畾椤�
+ * @param orderId
+ * @return
+ */
+ int selectNoJudge(@Param("orderId") Integer orderId);
+
+ /**
+ * 鏍规嵁璁㈠崟鏌ヨ浜у搧淇℃伅
+ * @param orderId
+ * @return
+ */
+ List<InsProduct> selectProductByOrderId(Integer orderId);
+
+ /**
+ * 鏌ヨ鍚屼竴鍨嬪彿, 鍚屼竴鍘傚, 鍚屼竴妫�娴嬮」鐨勬娴嬫暟鎹�
+ * @param insProduct
+ * @param supplierName
+ * @return
+ */
+ List<InsProductDeviationWarningDetail> selectAnalysis(@Param("insProduct") InsProduct insProduct, @Param("supplierName") String supplierName);
+
+ List<InsProduct> getRevocationInsProductList(@Param("ids") List<Integer> ids);
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductResultMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductResultMapper.java
new file mode 100644
index 0000000..57e640d
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductResultMapper.java
@@ -0,0 +1,29 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsProductResult;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 閽堝琛ㄣ�恑ns_product_result(妫�楠岄」鐩殑缁撴灉)銆戠殑鏁版嵁搴撴搷浣淢apper
+ * @createDate 2024-03-28 10:29:37
+ * @Entity com.yuanchu.mom.pojo.InsProductResult
+ */
+public interface InsProductResultMapper extends BaseMapper<InsProductResult> {
+
+ List<InsProductResult> selDetail(@Param("ips") List<Integer> ips);
+
+ /**
+ * 鏍规嵁璁㈠崟id鏌ヨ妫�楠岀粨鏋�
+ * @param orderId
+ * @return
+ */
+ List<InsProductResult> selectResultByOrderId(@Param("orderId") Integer orderId);
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductUserMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductUserMapper.java
new file mode 100644
index 0000000..0598f28
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductUserMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsProductUser;
+
+/**
+* @author z1292
+* @description 閽堝琛ㄣ�恑ns_product_user(妫�楠岄」鐩殑浜哄憳妫�楠岃褰�)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-04-17 13:42:44
+* @Entity com.yuanchu.mom.pojo.InsProductUser
+*/
+public interface InsProductUserMapper extends BaseMapper<InsProductUser> {
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsReportMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsReportMapper.java
new file mode 100644
index 0000000..dfca56d
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsReportMapper.java
@@ -0,0 +1,53 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ruoyi.inspect.dto.InsReportExport;
+import com.ruoyi.inspect.dto.ReportPageDto;
+import com.ruoyi.inspect.pojo.InsReport;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_report(妫�楠屾姤鍛�)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-03-17 22:10:02
+* @Entity com.yuanchu.mom.pojo.InsReport
+*/
+public interface InsReportMapper extends BaseMapper<InsReport> {
+
+ /**
+ * 鏌ヨ妫�楠屼换鍔�
+ * @param userId 褰撳墠鐧诲綍浜篿d
+ * @param queryStatus 鐘舵��
+ * @param createOrderUser 鏄惁鏄彧鏈夋煡鐪嬭嚜宸辩殑鏉冮檺
+ * @return
+ */
+ IPage<ReportPageDto> pageInsReport(IPage<ReportPageDto> page,
+ @Param("ew") QueryWrapper<ReportPageDto> ew,
+ @Param("laboratory") String laboratory,
+ @Param("userId") Integer userId,
+ @Param("queryStatus") String queryStatus,
+ @Param("createOrderUser") Integer createOrderUser);
+
+ String getLaboratoryByName(@Param("name") String name, @Param("type") String type);
+
+ /** 鎸夋姤鍛婄紪鍒跺垪琛ㄧ浉鍚岀殑鏁版嵁鑼冨洿鏌ヨ鍙笅杞界殑鎶ュ憡銆� */
+ InsReport selectDownloadableReport(@Param("id") Integer id,
+ @Param("createOrderUser") Integer createOrderUser);
+
+ /**
+ * 鎶ュ憡鎶ヨ〃瀵煎嚭
+ * @return
+ */
+ List<InsReportExport> reportAllExport(@Param("ew") QueryWrapper<ReportPageDto> ew,
+ @Param("userId") Integer userId,
+ @Param("queryStatus") String queryStatus,
+ @Param("createOrderUser") Integer createOrderUser);
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleMapper.java
new file mode 100644
index 0000000..0b1fb82
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleMapper.java
@@ -0,0 +1,137 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.dto.InsOrderPlanDTO;
+import com.ruoyi.inspect.dto.SampleProductDto;
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.inspect.pojo.InsSample;
+import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo;
+import com.ruoyi.inspect.vo.InsOrderPlanVO;
+import com.ruoyi.inspect.vo.SampleVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_sample(妫�楠屾牱鍝�)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-03-14 17:14:57
+* @Entity com.yuanchu.mom.pojo.InsSample
+*/
+public interface InsSampleMapper extends BaseMapper<InsSample> {
+
+ IPage<InsOrderPlanVO> findInsSampleAndOrder(Page page,
+ @Param("ew") QueryWrapper<InsOrderPlanDTO> ew,
+ @Param("userName") String userName ,
+ @Param("userId") Integer userId,
+ @Param("sonLaboratory") String sonLaboratory,
+ @Param("laboratory") String laboratory,
+ @Param("isCheck") Integer isCheck);
+
+ IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, @Param("ew") QueryWrapper<InsOrderPlanDTO> ew, @Param("userId") Integer userId, @Param("sonLaboratory") String sonLaboratory, @Param("laboratory") String laboratory);
+
+ List<SampleProductDto> selectSampleProductListByOrderId(@Param("id") Integer id);
+
+ List<SampleProductDto> selectSampleProductListByOrderId2(@Param("id") Integer id);
+
+ Map<String,Object> selectInsOrder(@Param("id") Integer id);
+
+ List<SampleProductDto> getInsOrderAndSample(@Param("id") Integer id, @Param("laboratory") String laboratory);
+
+ String getSampleEn(@Param("sample") String sample);
+
+ /**
+ * 鍙兘娌℃湁浜у搧鐩存帴灏辨槸瀵硅薄
+ * @param sample
+ * @return
+ */
+ String getSampleEnByObject(@Param("sample") String sample);
+
+ /**
+ * 鏍峰搧
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ List<InsProduct> getInsProduct1(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("cableTag") String cableTag, @Param("repetitionTag") String repetitionTag);
+
+
+ /**
+ * 鍘熸潗鏂�
+ * @param id
+ * @param laboratory
+ * @param rawMaterialTag
+ * @return
+ */
+ List<InsProduct> getInsProduct6(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("rawMaterialTag") String rawMaterialTag);
+
+ SampleVo getDetailById(@Param("sampleId") Integer sampleId);
+
+ String selMethodById(@Param("sampleId") Integer sampleId);
+
+ /**
+ * 鐢电紗閰嶇疆鏌ョ湅閰嶇疆鏍囪瘑
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ List<Map<String, Object>> getCableTag(@Param("id") Integer id, @Param("laboratory") String laboratory);
+
+ /**
+ * 鍘熸潗鏂欐煡鐪嬮厤缃爣璇�
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ List<Map<String, Object>> getRawMaterialTag(@Param("id") Integer id, @Param("laboratory") String laboratory);
+
+ /**
+ * 鏌ョ湅閲嶅鏍囪瘑
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ List<Map<String, Object>> getRepetitionTag(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("cableTag") String cableTag);
+
+
+ List<SampleProductDto> selectExemptionByOrderId(@Param("id") Integer id);
+
+ /**
+ * 鏌ヨ鍘傚瀵嗗害(鏈夊瀷鍙�)
+ * @param sample
+ * @param production
+ * @return
+ */
+ String selectSupplierDensityModel(@Param("sample") String sample, @Param("production") String production, @Param("model") String model);
+
+ /**
+ * 鏌ヨ鍘傚瀵嗗害(娌″瀷鍙�)
+ * @param sample
+ * @param production
+ * @return
+ */
+ String selectSupplierDensity(@Param("sample") String sample, @Param("production") String production);
+
+
+ /**
+ * 鏌ヨ妫�楠岄」妫�楠岀粨鏋�
+ * @param itemIds
+ * @return
+ */
+ List<InsProduct> selectProductResult(@Param("itemIds") List<Integer> itemIds);
+
+ /**
+ * 鏍规嵁璁㈠崟id鏌ヨ鏍峰搧
+ * @param insOrderId
+ * @return
+ */
+ List<InsSample> getSampleByOrderId(Integer insOrderId);
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleReceiptMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleReceiptMapper.java
new file mode 100644
index 0000000..efb4c8e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleReceiptMapper.java
@@ -0,0 +1,26 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.dto.SampleReceiptPageDto;
+import com.ruoyi.inspect.dto.SampleReceiptQueryDto;
+import com.ruoyi.inspect.pojo.InsSampleReceipt;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface InsSampleReceiptMapper extends BaseMapper<InsSampleReceipt> {
+
+ IPage<SampleReceiptPageDto> selectPage(Page<?> page, @Param("query") SampleReceiptQueryDto query);
+
+ SampleReceiptPageDto selectDetail(@Param("id") Integer id);
+
+ InsSampleReceipt selectForUpdate(@Param("id") Integer id);
+
+ int insertIgnore(@Param("orderId") Integer orderId, @Param("sampleId") Integer sampleId);
+
+ List<SampleReceiptPageDto> selectExportList(@Param("query") SampleReceiptQueryDto query);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java
new file mode 100644
index 0000000..ae3a445
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java
@@ -0,0 +1,21 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsSampleUser;
+import com.ruoyi.inspect.vo.InsSampleUserVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_sample_user(鏍峰搧璐熻矗浜鸿褰�)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-03-14 17:12:02
+* @Entity com.yuanchu.mom.pojo.InsSampleUser
+*/
+public interface InsSampleUserMapper extends BaseMapper<InsSampleUser> {
+
+ InsSampleUserVO selectUserNameByOrderId(@Param("orderId") Integer orderId);
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedHandlerFileMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedHandlerFileMapper.java
new file mode 100644
index 0000000..49c401b
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedHandlerFileMapper.java
@@ -0,0 +1,20 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandlerFile;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑ns_unqualified_handler_file(涓嶅悎鏍煎鐞嗛檮浠惰褰曡〃)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-07-31 13:38:38
+* @Entity com.yuanchu.mom.pojo.InsUnqualifiedHandlerFile
+*/
+@Mapper
+public interface InsUnqualifiedHandlerFileMapper extends BaseMapper<InsUnqualifiedHandlerFile> {
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedHandlerMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedHandlerMapper.java
new file mode 100644
index 0000000..21b6a65
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedHandlerMapper.java
@@ -0,0 +1,29 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ruoyi.inspect.dto.UnqualifiedHandlerDto;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandler;
+import com.ruoyi.inspect.vo.UnqualifiedHandlerVO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑ns_unqualified_handler(涓嶅悎鏍煎鐞嗚〃)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-07-31 13:38:14
+* @Entity com.yuanchu.mom.pojo.InsUnqualifiedHandler
+*/
+@Mapper
+public interface InsUnqualifiedHandlerMapper extends BaseMapper<InsUnqualifiedHandler> {
+
+ IPage<UnqualifiedHandlerVO> selectPageList(IPage<UnqualifiedHandlerVO> page, @Param("ew")QueryWrapper<UnqualifiedHandlerDto> ew);
+
+ UnqualifiedHandlerVO findById(@Param("id") Long id);
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestProductMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestProductMapper.java
new file mode 100644
index 0000000..c3a25c8
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestProductMapper.java
@@ -0,0 +1,33 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 涓嶅悎鏍兼楠岄」鐩娴�
+ * @author 榉�
+ * @since 2024-09-03
+ */
+@Mapper
+public interface InsUnqualifiedRetestProductMapper extends BaseMapper<InsUnqualifiedRetestProduct> {
+
+ /**
+ * 鏌ヨ涓嶅悎鏍煎唴瀹�
+ * @param ids
+ * @return
+ */
+ List<InsUnqualifiedRetestProduct> selectRetestProduct(@Param("ids") List<Integer> ids);
+
+ // 鏍峰搧
+ List<InsProduct> getInsProductUnqualifiedRetest1(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("cableTag") String cableTag, @Param("repetitionTag") String repetitionTag, @Param("retestTag") String retestTag);
+
+
+ // 鍘熸潗鏂欎笅鍗�
+ List<InsProduct> getInsProductUnqualifiedRetest6(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("rawMaterialTag") String rawMaterialTag , @Param("retestTag") String retestTag);
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestResultMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestResultMapper.java
new file mode 100644
index 0000000..0a6caba
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestResultMapper.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.InsUnqualifiedRetestResult;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 涓嶅悎鏍煎娴嬫楠岄」鐩殑缁撴灉
+ *
+ * @author zhuo
+ * @since 2024-09-03
+ */
+@Mapper
+public interface InsUnqualifiedRetestResultMapper extends BaseMapper<InsUnqualifiedRetestResult> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/RawMaterialOrderTemplateMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/RawMaterialOrderTemplateMapper.java
new file mode 100644
index 0000000..cd455ed
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/RawMaterialOrderTemplateMapper.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.RawMaterialOrderTemplate;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 鍘熸潗鏂欎笅鍗曟ā鏉�
+ *
+ * @author zhuo
+ * @since 2024-08-05
+ */
+@Mapper
+public interface RawMaterialOrderTemplateMapper extends BaseMapper<RawMaterialOrderTemplate> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckQuarterItemMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckQuarterItemMapper.java
new file mode 100644
index 0000000..82d1085
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckQuarterItemMapper.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.SpotCheckQuarterItem;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 瀛e害鎶芥牱璁″垝璇︽儏琛�
+ *
+ * @author zhuo
+ * @since 2024-10-09
+ */
+@Mapper
+public interface SpotCheckQuarterItemMapper extends BaseMapper<SpotCheckQuarterItem> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckQuarterMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckQuarterMapper.java
new file mode 100644
index 0000000..2bd8b27
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckQuarterMapper.java
@@ -0,0 +1,39 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.dto.SpotCheckQuarterDto;
+import com.ruoyi.inspect.pojo.SpotCheckQuarter;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 瀛e害鎶芥牱璁″垝
+ *
+ * @author zhuo
+ * @since 2024-10-09
+ */
+@Mapper
+public interface SpotCheckQuarterMapper extends BaseMapper<SpotCheckQuarter> {
+
+ /**
+ * 瀛e害鎶芥牱鍒嗛〉鏌ヨ
+ * @param page
+ * @param ew
+ * @return
+ */
+ IPage<SpotCheckQuarterDto> getQuarterPage(Page page, @Param("ew") QueryWrapper<SpotCheckQuarterDto> ew);
+
+ /**
+ * 鎴愬搧涓嬪崟鐣岄潰鏌ヨ瀛e害淇℃伅
+ * @return
+ */
+ List<Map<String, Object>> getQuarterOnOrder();
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckYearItemMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckYearItemMapper.java
new file mode 100644
index 0000000..241deef
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckYearItemMapper.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.SpotCheckYearItem;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 骞村害鎶芥牱璁″垝璇︽儏琛�
+ *
+ * @author zhuo
+ * @since 2024-10-10
+ */
+@Mapper
+public interface SpotCheckYearItemMapper extends BaseMapper<SpotCheckYearItem> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckYearMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckYearMapper.java
new file mode 100644
index 0000000..c72196d
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckYearMapper.java
@@ -0,0 +1,30 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.dto.SpotCheckYearDto;
+import com.ruoyi.inspect.pojo.SpotCheckYear;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 骞村害鎶芥牱璁″垝
+ *
+ * @author zhuo
+ * @since 2024-10-10
+ */
+@Mapper
+public interface SpotCheckYearMapper extends BaseMapper<SpotCheckYear> {
+
+ /**
+ * 鏌ヨ骞村害鎶芥牱鍒楄〃
+ * @param page
+ * @param ew
+ * @return
+ */
+ IPage<SpotCheckYearDto> getSpotCheckYearPage(Page page, @Param("ew") QueryWrapper<SpotCheckYearDto> ew);
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseCellMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseCellMapper.java
new file mode 100644
index 0000000..e15fd4e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseCellMapper.java
@@ -0,0 +1,23 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.dto.WarehouseCellAndSampleDto;
+import com.ruoyi.inspect.pojo.WarehouseCell;
+
+import java.util.List;
+
+/**
+* @author z1292
+* @description 閽堝琛ㄣ�恮arehouse_cell(璐ф灦鍗曞厓鏍�)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-04-06 12:12:12
+* @Entity com.yuanchu.mom.pojo.WarehouseCell
+*/
+public interface WarehouseCellMapper extends BaseMapper<WarehouseCell> {
+
+ List<WarehouseCellAndSampleDto> getWarehouse(Integer shelfId);
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseHistoryMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseHistoryMapper.java
new file mode 100644
index 0000000..6c647c7
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseHistoryMapper.java
@@ -0,0 +1,25 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.dto.HistoryDto;
+import com.ruoyi.inspect.pojo.WarehouseHistory;
+
+import java.util.List;
+
+/**
+* @author z1292
+* @description 閽堝琛ㄣ�恮arehouse_history(鍑哄叆搴撹褰�)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-04-06 12:12:12
+* @Entity com.yuanchu.mom.pojo.WarehouseHistory
+*/
+public interface WarehouseHistoryMapper extends BaseMapper<WarehouseHistory> {
+
+ String getUserNameById(Integer userId);
+
+ List<HistoryDto> getHistoryListBySampleId(Integer sampleId);
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseMapper.java
new file mode 100644
index 0000000..b6d91f0
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseMapper.java
@@ -0,0 +1,23 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.dto.WarehouseDto;
+import com.ruoyi.inspect.pojo.Warehouse;
+
+import java.util.List;
+
+/**
+* @author z1292
+* @description 閽堝琛ㄣ�恮arehouse(浠撳簱)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-04-06 12:12:12
+* @Entity com.yuanchu.mom.pojo.Warehouse
+*/
+public interface WarehouseMapper extends BaseMapper<Warehouse> {
+
+ List<WarehouseDto> selectWarehouseList();
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseShelfMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseShelfMapper.java
new file mode 100644
index 0000000..964c2b1
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/WarehouseShelfMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.inspect.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.inspect.pojo.WarehouseShelf;
+
+/**
+* @author z1292
+* @description 閽堝琛ㄣ�恮arehouse_shelf(璐ф灦)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-04-06 12:12:12
+* @Entity com.yuanchu.mom.pojo.WarehouseShelf
+*/
+public interface WarehouseShelfMapper extends BaseMapper<WarehouseShelf> {
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/IfsPartPropsRecord.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/IfsPartPropsRecord.java
new file mode 100644
index 0000000..d9fbf70
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/IfsPartPropsRecord.java
@@ -0,0 +1,67 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * ifs璁㈠崟闆朵欢灞炴�ц褰曡〃
+ * @TableName ifs_part_props_record
+ */
+@TableName(value ="ifs_part_props_record")
+@Data
+public class IfsPartPropsRecord implements Serializable {
+ /**
+ * 涓婚敭id
+ */
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * ifs璁㈠崟id
+ */
+ private Long ifsInventoryId;
+
+ /**
+ * 杞藉叿缂栧彿
+ */
+ private String drumNo;
+
+ /**
+ * 璧峰绫虫爣
+ */
+ private BigDecimal startMeterMark;
+
+ /**
+ * 鎴绫虫爣
+ */
+ private BigDecimal endMeterMark;
+
+ /**
+ * 缁濈紭棰滆壊
+ */
+ private String insulationColor;
+
+ /**
+ * 澶栨姢棰滆壊
+ */
+ private String outerColor;
+
+ /**
+ * 鍗板瓧淇℃伅
+ */
+ private String letteringInfo;
+
+ /**
+ * ifs闆朵欢灞炴�ф洿鏂版爣璇�
+ */
+ private Boolean partPropsFlag;
+
+ @TableField(exist = false)
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/IfsSplitOrderRecord.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/IfsSplitOrderRecord.java
new file mode 100644
index 0000000..f2d6ac3
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/IfsSplitOrderRecord.java
@@ -0,0 +1,161 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * ifs鍘熸潗鏂欒鍗曟媶鍒嗚褰曡〃
+ * @TableName ifs_split_order_record
+ */
+@TableName(value ="ifs_split_order_record")
+@Data
+public class IfsSplitOrderRecord implements Serializable {
+
+ @TableField(exist = false)
+ private static final long serialVersionUID = 1L;
+
+ public static final int DIGIT = 6;//绯荤粺缂栧彿鐢熸垚浣嶆暟
+
+ public static final String PREFIX ="WG";//绯荤粺缂栧彿鐢熸垚鍓嶇紑
+
+ /**
+ * 涓婚敭id
+ */
+ @Schema(description = "涓婚敭id")
+ @TableId
+ private Long id;
+
+ /**
+ * 閿�鍞鍗曞彿
+ */
+ @Schema(description = "閿�鍞鍗曞彿")
+ private String orderNo;
+
+ /**
+ * 琛屽彿
+ */
+ @Schema(description = "琛屽彿")
+ private String lineNo;
+
+ /**
+ * 涓嬭揪鍙�
+ */
+ @Schema(description = "涓嬭揪鍙�")
+ private String releaseNo;
+
+ /**
+ * 鎺ユ敹鍙�
+ */
+ @Schema(description = "鎺ユ敹鍙�")
+ private Integer receiptNo;
+
+ /**
+ * 闆朵欢鍙�
+ */
+ @Schema(description = "闆朵欢鍙�")
+ private String partNo;
+
+ /**
+ * 绯荤粺缂栧彿
+ */
+ @Schema(description = "绯荤粺缂栧彿")
+ private String systemNo;
+
+ /**
+ * 瑙勬牸
+ */
+ @Schema(description = "瑙勬牸")
+ private String spec;
+
+ /**
+ * 闆朵欢鎵瑰彿
+ */
+ @Schema(description = "闆朵欢鎵瑰彿")
+ private String lotBatchNo;
+
+ /**
+ * 搴撳瓨鏁伴噺1锛堢敤浜庡鎺es鍒嗙洏璁$畻锛�
+ */
+ @Schema(description = "搴撳瓨鏁伴噺1锛堢敤浜庡鎺es鍒嗙洏璁$畻锛�")
+ private BigDecimal length;
+
+ /**
+ * 搴撳瓨鏁伴噺2锛坕fs瀵逛簬鐨勫簱瀛樻暟閲忥級
+ */
+ @Schema(description = "搴撳瓨鏁伴噺2锛坕fs瀵逛簬鐨勫簱瀛樻暟閲忥級")
+ private BigDecimal qtyStock;
+
+ /**
+ * 缁濈紭棰滆壊
+ */
+ @Schema(description = "缁濈紭棰滆壊")
+ private String insulationColor;
+
+ /**
+ * 澶栨姢棰滆壊
+ */
+ @Schema(description = "澶栨姢棰滆壊")
+ private String outerColor;
+
+ /**
+ * 鍗板瓧淇℃伅
+ */
+ @Schema(description = "鍗板瓧淇℃伅")
+ private String letteringInfo;
+
+ /**
+ * 鐩樺彿
+ */
+ @Schema(description = "鐩樺彿")
+ private String drumNo;
+
+ /**
+ * 搴撲綅鍙�
+ */
+ @Schema(description = "搴撲綅鍙�")
+ private String locationNo;
+
+ /**
+ * 搴撲綅鏉ユ簮
+ */
+ @Schema(description = "搴撲綅鏉ユ簮")
+ private String stockSource;
+
+ /**
+ * 澶囨敞
+ */
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ /**
+ * 鍚屾鐘舵�侊紙0锛氭湭鍚屾锛�1锛氬凡鍚屾锛�
+ */
+ @Schema(description = "鍚屾鐘舵�侊紙0锛氭湭鍚屾锛�1锛氬凡鍚屾锛�")
+ private Integer syncStatus;
+
+ @Schema(description = "鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+}
\ No newline at end of file
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrder.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrder.java
new file mode 100644
index 0000000..9558674
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrder.java
@@ -0,0 +1,262 @@
+package com.ruoyi.inspect.pojo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+* 妫�楠屼笅鍗�
+* @TableName ins_order
+*/
+@Data
+@TableName("ins_order")
+@ExcelIgnoreUnannotated
+public class InsOrder implements Serializable {
+
+
+ @Schema(description = "涓婚敭")
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ @ExcelProperty(index = 0, value = "濮旀墭缂栧彿")
+ @Schema(description = "濮旀墭缂栧彿")
+ private String entrustCode;
+
+ @Schema(description = "澶栭儴濮旀墭缂栧彿")
+ private String outEntrustCode;
+
+ @Schema(description = "妫�楠岀被鍒�")
+ private String orderType;
+
+ @Schema(description = "涓嬪崟瀹㈡埛")
+ private String custom;
+
+ @ExcelProperty(index = 1, value = "濮旀墭鍗曚綅")
+ @Schema(description = "濮旀墭鍗曚綅")
+ private String company;
+
+ @Schema(description = "鑱旂郴鏂瑰紡")
+ private String phone;
+
+ @Schema(description = "宸ュ巶鍩�")
+ private String code;
+
+ @Schema(description = "绱ф�ョ▼搴� 锛�0鏅�� 1浼樺厛 2绱ф�ワ級")
+ private Integer type;
+
+ @ExcelProperty(index = 9, value = "绾﹀畾鏃堕棿%")
+ @Schema(description = "绾﹀畾鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate appointed;
+
+ @Schema(description = "妫�楠岀粨鏋�, 0 涓嶅悎鏍�, 1鍚堟牸")
+ private Integer insResult;
+
+ @Schema(description = "鏍峰搧澶勭悊鏂瑰紡")
+ private Integer processing;
+
+ @Schema(description = "鏄惁鐣欐牱")
+ private Integer isLeave;
+
+ @Schema(description = "鐘舵��:-1:鍘熸潗鏂欐挙鍥� 0:寰呭鏍� 1:鏍峰搧鎺ユ敹/妫�楠屽鐞� 2:閫�鍥� 3:鎾ら攢 4:宸叉楠� 5:浣滃簾")
+ private Integer state;
+
+ @ExcelProperty(index = 7, value = "澶囨敞")
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ @Schema(description = "澶囨敞鑻辨枃")
+ private String remarkEn;
+
+ @Schema(description = "OTC璁㈠崟鍙�")
+ private String otcCode;
+
+ @Schema(description = "涓嬪崟浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "涓嬪崟鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "涓嬪彂鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime sendTime;
+
+ @Schema(description = "")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ @Schema(description = "涓嬪崟浜篿d")
+ private Integer userId;
+
+ @Schema(description = "鏄惁鏈夐厤濂楁牱鍝�")
+ private Integer mating;
+
+ @Schema(description = "妫�楠岀姸鎬�(0锛氬緟妫�楠� 1:妫�楠屼腑 2:宸叉楠� 3锛氬緟澶嶆牳 4锛氬鏍告湭閫氳繃 5锛氬鏍搁�氳繃)")
+ private Integer insState;
+
+ @Schema(description = "妫�楠屽伐鍘�")
+ private String factory;
+
+ @Schema(description = "瀹為獙瀹ゅ悕绉�")
+ private String laboratory;
+
+ @Schema(description = "鏍峰搧绫诲瀷")
+ private String sampleType;
+
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sample;
+
+ @Schema(description = "妫�楠屾椂闂�")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime insTime;
+
+ @Schema(description = "閫�鍥炵悊鐢�")
+ private String tell;
+
+ @Schema(description = "鎶ュ憡鍙戦�佹柟寮� 1: 鑷彇, 0:鍏朵粬")
+ private Integer send;
+
+ @Schema(description = "鏉ユ牱鏂瑰紡")
+ private String formType;
+
+ @Schema(description = "瀹℃牳鏃堕棿")
+ private LocalDateTime examineTime;
+
+ @Schema(description = "宸ョ▼鍚嶇О")
+ private String engineering;
+
+ @Schema(description = "宸ョ▼鍚嶇О鑻辨枃")
+ private String engineeringEn;
+
+ @Schema(description = "鐢熶骇鍗曚綅")
+ private String production;
+
+ @Schema(description = "鐢熶骇鍗曚綅鑻辨枃")
+ private String productionEn;
+
+ @Schema(description = "瀹㈡埛鍗曚綅id")
+ private Long companyId;
+
+ @Schema(description = "濮旀墭浜篿d")
+ private Integer prepareUserId;
+
+ @ExcelProperty(index = 12, value = "濮旀墭浜�")
+ @Schema(description = "濮旀墭浜�")
+ private String prepareUser;
+
+ @Schema(description = "濮旀墭浜鸿嫳鏂�")
+ private String prepareUserEn;
+
+ @Schema(description = "濮旀墭浜哄伐鍙�")
+ private String prepareCode;
+
+ @Schema(description = "鏄惁瀹℃牳鎾ら攢")
+ private Integer isRevocation;
+
+ @Schema(description = "瀹℃牳鎾ら攢鐨勯」鐩甶d")
+ private String revocationInsProductIds;
+
+ @Schema(description = "鏄惁涓哄師鏉愭枡 1 鏄� 0 鍚�")
+ private Integer typeSource;
+
+ @Schema(description = "鍘熸潗鏂檌d")
+ private Long ifsInventoryId;
+
+ @Schema(description = "鎶芥煡鏁伴噺")
+ private String testQuantity;
+
+ @Schema(description = "闆朵欢鎻忚堪")
+ private String partDetail;
+
+ @Schema(description = "鏄惁鏄厤妫�, 0鍚� 1鏄�")
+ private Integer isExemption;
+
+ @Schema(description = "娓╁害")
+ private String temperature;
+
+ @Schema(description = "婀垮害")
+ private String humidity;
+
+ @TableField(exist = false)
+ @Schema(description = "褰撳墠濉啓鐜鏉′欢鐨勬ā鏉縄D")
+ private Integer templateId;
+
+ @Schema(description = "鏍峰搧鐘舵��")
+ private String sampleStatus;
+
+ @Schema(description = "閫佹牱鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate sampleDate;
+
+ @Schema(description = "鐢熶骇鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate productionDate;
+
+ @Schema(description = "鐢熶骇鎵瑰彿")
+ private String productionBatch;
+
+ @Schema(description = "瀛e害鎶芥牱椤圭洰id")
+ private Integer quarterItemId;
+
+ @Schema(description = "鏍峰搧鍚嶇О(鎶ュ憡灞曠ず瀛楁)")
+ private String sampleView;
+
+ @Schema(description = "鏍峰搧鍚嶇О寮曟枃(鎶ュ憡灞曠ず瀛楁)")
+ private String sampleViewEn;
+
+ @Schema(description = "鏄惁鏄涓�娆℃彁浜�0鍚�1鏄�")
+ private Integer isFirstSubmit;
+
+ @Schema(description = "绗竴娆℃彁浜ゆ椂闂�")
+ private LocalDateTime firstSubmitDate;
+
+ @Schema(description = "棣栨淇濆瓨妫�楠屾ā鏉垮�兼椂闂�")
+ private LocalDateTime firstInspectDate;
+
+ @Schema(description = "鍒嗗寘鍐呭 0鏃� 1鏈�")
+ private Integer subcontractType;
+
+ @Schema(description = "鍒嗗寘鍗曚綅淇℃伅")
+ private String subcontractCompany;
+
+ @Schema(description = "鏍峰搧澶勭疆 1濮旀墭鏂瑰彇鍥� 2妫�娴嬫柟澶勭疆")
+ private Integer sampleDisposal;
+
+ @Schema(description = "瀵圭粨鏋滆瘎浠� 0鍚� 1鏄�")
+ private Integer resultEvaluation;
+
+ @Schema(description = "鎶ュ憡浜や粯鏂瑰紡 1鑷彇 2蹇�� 3鐢靛瓙浼犻��")
+ private Integer reportDelivery;
+
+ @Schema(description = "鎶ュ憡瀵勯�佸湴鍧�")
+ private String reportAddress;
+
+ @Schema(description = "鏀朵欢浜哄強鐢佃瘽")
+ private String reportReceiver;
+
+ @Schema(description = "鏍锋満鍛�(闄や簡鍏朵粬鎴愬搧澶栬繖涓瓧娈靛繀閫�,鐢ㄤ簬浼佷笟寰俊鎺ㄩ��)")
+ @TableField(exist = false)
+ private Integer issueUser;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderDeviceRecord.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderDeviceRecord.java
new file mode 100644
index 0000000..a3e7571
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderDeviceRecord.java
@@ -0,0 +1,64 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * cnas璁惧浣跨敤璁板綍琛�(DeviceRecord)$desc
+ *
+ * @author makejava
+ * @since 2024-12-21 11:11:01
+ */
+@Data
+@TableName("device_record")
+public class InsOrderDeviceRecord {
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @Schema(description = "璁惧id")
+ private Integer deviceId;
+
+ @Schema(description = "璁㈠崟id")
+ private Integer insOrderId;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+
+ @Schema(description = "娓╁害")
+ private String temperature;
+
+ @Schema(description = "婀垮害")
+ private String humidity;
+
+ @Schema(description = "浣跨敤鍓�0浠h〃涓嶆甯�1浠h〃姝e父")
+ private Integer useBefore;
+
+ @Schema(description = "浣跨敤鍚�0浠h〃涓嶆甯�1浠h〃姝e父")
+ private Integer useAfter;
+
+ @Schema(description = "寮傚父鎯呭喌")
+ private String abnormal;
+
+ @Schema(description = "浣跨敤浜篿d")
+ private Integer usePersonId;
+
+ @Schema(description = "浣跨敤浜�")
+ private String usePerson;
+
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ @Schema(description = "浣跨敤寮�濮嬫棩鏈�")
+ private LocalDateTime useStartDate;
+
+ @Schema(description = "浣跨敤缁撴潫鏃ユ湡")
+ private LocalDateTime useEndDate;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerify.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerify.java
new file mode 100644
index 0000000..25c2f12
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerify.java
@@ -0,0 +1,100 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 鍘熸潗鏂欏巶瀹惰繘璐ч獙璇�
+ *
+ * @author zhuo
+ * @since 2024-09-26
+ */
+@Data
+@TableName("ins_order_factory_verify")
+public class InsOrderFactoryVerify {
+
+ @Schema(description = "涓婚敭")
+ @TableId(type = IdType.AUTO)
+ private Integer factoryVerifyId;
+
+ @Schema(description = "澶栭敭: ins_order琛� id")
+ private Integer insOrderId;
+
+ @Schema(description = "濮旀墭缂栧彿")
+ private String entrustCode;
+
+ @Schema(description = "鏉愭枡鍘傚")
+ private String supplierName;
+
+ @Schema(description = "鍒拌揣鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime declareDate;
+
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sample;
+
+ @Schema(description = "瑙勬牸鍨嬪彿")
+ private String model;
+
+ @Schema(description = "鏉愭枡鎵瑰彿")
+ private String updateBatchNo;
+
+ @Schema(description = "楠岃瘉鏂囦欢缂栧彿")
+ private String verifyFileCode;
+
+ @Schema(description = "1鏉愭枡鍚嶇О")
+ private String basicName;
+
+ @Schema(description = "2瑙勬牸鍨嬪彿")
+ private String basicModel;
+
+ @Schema(description = "3鏉愭枡鎵瑰彿")
+ private String basicBatchNo;
+
+ @Schema(description = "4鎵ц鏍囧噯")
+ private String basicStandard;
+
+ @Schema(description = "5鐢熶骇鏃ユ湡")
+ private String basicDate;
+
+ @Schema(description = "6渚涜揣鏁伴噺")
+ private String basicNumber;
+
+ @Schema(description = "7鏉愭枡棰滆壊")
+ private String basicColor;
+
+ @Schema(description = "8鍏朵粬(鍚嶇О)")
+ private String basicOtherValue;
+
+ @Schema(description = "8鍏朵粬")
+ private String basicOther;
+
+ @Schema(description = "鍒涘缓浜篿d")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "淇敼浜篿d")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ @TableField(exist = false,select = false)
+ @Schema(description = "楠岃瘉椤圭洰闆嗗悎")
+ private List<InsOrderFactoryVerifyItem> factoryVerifyItemList;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerifyItem.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerifyItem.java
new file mode 100644
index 0000000..e724c52
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerifyItem.java
@@ -0,0 +1,57 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * 鍘熸潗鏂欏巶瀹惰繘璐ч獙璇佹楠岄」
+ *
+ * @author zhuo
+ * @since 2024-09-26
+ */
+@Data
+@TableName("ins_order_factory_verify_item")
+public class InsOrderFactoryVerifyItem {
+
+
+ @Schema(description = "涓婚敭")
+ @TableId(type = IdType.AUTO)
+ private Integer factoryVerifyItemId;
+
+ @Schema(description = "澶栭敭: 杩涘巶楠岃瘉琛� id")
+ private Integer factoryVerifyId;
+
+ @Schema(description = "楠岃瘉椤圭洰")
+ private String inspectionItem;
+
+ @Schema(description = "楠岃瘉缁撴灉")
+ private String result;
+
+ @Schema(description = "鎺掑簭")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer sort;
+
+ @Schema(description = "鍒涘缓浜篿d")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "淇敼浜篿d")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFile.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFile.java
new file mode 100644
index 0000000..d7df673
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFile.java
@@ -0,0 +1,56 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 妫�楠屽崟涓嬬殑闄勪欢鍒楄〃
+ * </p>
+ *
+ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
+ * @since 2024-06-06 10:08:21
+ */
+@Getter
+@Setter
+@TableName("ins_order_file")
+@Schema(description = "妫�楠屽崟涓嬬殑闄勪欢鍒楄〃")
+public class InsOrderFile implements Serializable {
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @Schema(description = "鍏宠仈 妫�楠屽崟澶栭敭id")
+ private Integer insOrderId;
+
+ @Schema(description = "绫诲瀷")
+ private Integer type;
+
+ @Schema(description = "闄勪欢璺緞")
+ private String fileUrl;
+
+ @Schema(description = "闄勪欢鍚嶇О")
+ private String fileName;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "涓婁紶浜�")
+ @TableField(exist = false, select = false)
+ private String name;
+
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description = "涓婁紶鏃堕棿")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderRates.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderRates.java
new file mode 100644
index 0000000..2b55956
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderRates.java
@@ -0,0 +1,72 @@
+package com.ruoyi.inspect.pojo;
+
+import java.time.LocalDateTime;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 璁㈠崟璐圭敤琛�
+ *
+ * @author zhuo
+ * @since 2025-02-28
+ */
+@Data
+@TableName("ins_order_rates")
+public class InsOrderRates {
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @Schema(description = "璁㈠崟id")
+ private Integer insOrderId;
+
+ @Schema(description = "鏍峰搧id")
+ private Integer insSampleId;
+
+ @Schema(description = "妫�楠岄」id")
+ private Integer insProductId;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String entrustCode;
+
+ @Schema(description = "妫�楠岄」鍒嗙被")
+ private String inspectionItemClass;
+
+ @Schema(description = "妫�娴嬮」鐩�")
+ private String inspectionItem;
+
+ @Schema(description = "妫�楠岄」瀛愮被")
+ private String inspectionItemSubclass;
+
+ @Schema(description = "鐢电紗鏍囪瘑")
+ private String cableTag;
+
+ @Schema(description = "鏍囧噯浠锋牸")
+ private String rates;
+
+ @Schema(description = "鍒嗙粍")
+ private String manHourGroup;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ @Schema(description = "鍒涘缓浜篿d")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "淇敼浜篿d")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java
new file mode 100644
index 0000000..f2c2ec1
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java
@@ -0,0 +1,82 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.time.LocalDate;
+import java.util.Date;
+
+/**
+ * 璁㈠崟鏍囧噯妯℃澘澶嶅埗
+ *
+ * @author zhuo
+ * @since 2024-11-05
+ */
+@Data
+@TableName(value = "ins_order_standard_template")
+public class InsOrderStandardTemplate {
+
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ @Schema(description = "妯℃澘id")
+ private Integer templateId;
+
+ @Schema(description = "璁㈠崟id")
+ private Integer insOrderId;
+
+ @Schema(description = "妯℃澘鍚嶇О")
+ private String name;
+
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ @Schema(description = "妯℃澘缁撴瀯")
+ private String thing;
+
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description = "鍒涘缓浜�")
+ private Integer createUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @Schema(description = "淇敼浜�")
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description = "鍒涘缓鏃堕棿")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @Schema(description = "淇敼鏃堕棿")
+ private LocalDateTime updateTime;
+
+ @Schema(description = "妯℃澘缂栧彿")
+ private String number;
+
+ @Schema(description = "妯℃澘灞曠ず鍙婄敓鎴愰『搴�")
+ private Integer sort;
+
+ @Schema(description = "鍘熷璁板綍宸插~鍐欏崟鍏冩牸锛屾寜鍧愭爣淇濆瓨")
+ private String recordValues;
+
+ @Schema(description = "璇ユā鏉挎楠屾椂鐨勬俯搴�")
+ private String temperature;
+
+ @Schema(description = "璇ユā鏉挎楠屾椂鐨勬箍搴�")
+ private String humidity;
+
+ @Schema(description = "妫�娴嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate detectionTime;
+
+ @Schema(description = "妫�娴嬪湴鐐�")
+ private String detectionPlace;
+
+ @Schema(description = "妯℃澘妫�楠岀粨璁猴細0涓嶅悎鏍硷紝1鍚堟牸")
+ private Integer insResult;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderState.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderState.java
new file mode 100644
index 0000000..59d4d10
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderState.java
@@ -0,0 +1,67 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *
+ * @TableName ins_order_state
+ */
+@TableName(value ="ins_order_state")
+@Data
+public class InsOrderState implements Serializable {
+ /**
+ *
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 澶栭敭锛歩ns_order琛╥d
+ */
+ @TableField(value = "ins_order_id")
+ private Integer insOrderId;
+
+ /**
+ * 瀹為獙瀹�
+ */
+ @TableField(value = "laboratory")
+ private String laboratory;
+
+ /**
+ * 妫�楠岀姸鎬�(0锛氬緟妫�楠�1:妫�楠屼腑 2:宸叉楠�3锛氬緟澶嶆牳4锛氬鏍告湭閫氳繃 5锛氬鏍搁�氳繃)
+ */
+ @TableField(value = "ins_state")
+ private Integer insState;
+
+ @Schema(description = "妫�楠屾椂闂�")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime insTime;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ @Schema(description = "澶嶆牳浜�")
+ private Integer verifyUser;
+
+ @Schema(description = "澶嶆牳鐞嗙敱")
+ private String verifyTell;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplate.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplate.java
new file mode 100644
index 0000000..4c3d455
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplate.java
@@ -0,0 +1,48 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *
+ * @TableName ins_order_template
+ */
+@TableName(value ="ins_order_template")
+@Data
+public class InsOrderTemplate implements Serializable {
+ /**
+ *
+ */
+ @Schema(description = "涓婚敭")
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 妯℃澘鍚嶇О
+ */
+ @Schema(description = "妯℃澘鍚嶇О")
+ private String name;
+
+ /**
+ * 妯℃澘鍐呭
+ */
+ @Schema(description = "妯℃澘鍐呭")
+ private String thing;
+
+ @Schema(description = "缁戝畾鐨勬爣鍑嗗簱浜岀骇鏍囧噯ID")
+ private Integer standardTreeId;
+
+ @Schema(description = "鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplateDevice.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplateDevice.java
new file mode 100644
index 0000000..22624de
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplateDevice.java
@@ -0,0 +1,28 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/** 璁㈠崟妯℃澘涓庢楠岃澶囧叧绯汇�� */
+@Data
+@TableName("ins_order_template_device")
+public class InsOrderTemplateDevice {
+
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ @Schema(description = "璁㈠崟ID")
+ private Integer insOrderId;
+
+ @Schema(description = "妯℃澘ID")
+ private Integer templateId;
+
+ @Schema(description = "璁惧ID")
+ private Integer deviceId;
+
+ @Schema(description = "灞曠ず椤哄簭")
+ private Integer sort;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProduct.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProduct.java
new file mode 100644
index 0000000..573cd98
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProduct.java
@@ -0,0 +1,225 @@
+package com.ruoyi.inspect.pojo;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 妫�楠岄」鐩�
+ *
+ * @TableName ins_product
+ */
+@TableName(value = "ins_product")
+@Data
+public class InsProduct implements Serializable {
+ /**
+ * 涓婚敭id
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ @Schema(description = "椤圭洰鍙傛暟id")
+ private Integer structureItemParameterId;
+
+ @TableField(exist = false,select = false)
+ private String sampleCode;
+
+ @Schema(description = "妫�楠岄」")
+ private String inspectionItem;
+
+ @Schema(description = "妫�楠岄」鑻辨枃")
+ private String inspectionItemEn;
+
+ @Schema(description = "妫�楠岄」鍒嗙被")
+ private String inspectionItemClass;
+
+ @Schema(description = "妫�楠岄」鍒嗙被EN")
+ private String inspectionItemClassEn;
+
+ @Schema(description = "妫�楠岄」瀛愮被")
+ private String inspectionItemSubclass;
+
+ @Schema(description = "妫�楠岄」瀛愮被鑻辨枃")
+ private String inspectionItemSubclassEn;
+
+ @Schema(description = "宸ュ巶")
+ private String factory;
+
+ @Schema(description = "瀹為獙瀹�")
+ private String laboratory;
+
+ @Schema(description = "鏍峰搧鍒嗙被")
+ private String sampleType;
+
+ @Schema(description = "鏍峰搧")
+ private String sample;
+
+ @Schema(description = "鍨嬪彿")
+ private String model;
+
+ @Schema(description = "鏂规硶")
+ private String methodS;
+
+ @Schema(description = "瀛愬疄楠屽")
+ private String sonLaboratory;
+
+ @Schema(description = "璁¢噺鍗曚綅")
+ private String unit;
+
+ @Schema(description = "鍗曚环(鍏�)")
+ private BigDecimal price;
+
+ @Schema(description = "宸ユ椂(H)")
+ private BigDecimal manHour;
+
+ @Schema(description = "宸ユ椂鍒嗙粍")
+ private String manHourGroup;
+
+ @Schema(description = "妫�楠岄」绫诲瀷")
+ private String inspectionItemType;
+
+ @Schema(description = "妫�楠屽�肩被鍨�")
+ private String inspectionValueType;
+
+ @Schema(description = "璁惧缁�")
+ private String deviceGroup;
+
+ @Schema(description = "妫�楠屾鏁�")
+ private Integer checkoutNumber;
+
+ @Schema(description = "鍖洪棿")
+ private String section;
+
+ @Schema(description = "鍙栧�肩被鍨�")
+ private String valueType;
+
+ @Schema(description = "鏂规硶")
+ private String method;
+
+ @Schema(description = "棰勮鏃堕棿(h)")
+ private Integer manDay;
+
+ @Schema(description = "鐗规畩鏍囪瘑")
+ private String bsm;
+
+ @Schema(description = "瑕佹眰鍊�")
+ private String ask;
+
+ @Schema(description = "瑕佹眰鎻忚堪")
+ private String tell;
+
+ @Schema(description = "鏈�缁堝��")
+ @TableField("`last_value`")
+ private String lastValue;
+
+ @Schema(description = "鍚堟牸鐘舵��: 1锛氬悎鏍� 0锛氫笉鍚堟牸, 3涓嶅垽瀹�")
+ private Integer insResult;
+
+
+ @Schema(description = "1锛氭湁鏁� 0锛氭棤鏁�")
+ private Integer state;
+
+ @Schema(description = "澶栭敭锛歩ns_sample琛╥d")
+ private Integer insSampleId;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ @Schema(description = "澶栭敭锛歴tandard_template琛╥d")
+ private Integer templateId;
+
+ @Schema(description = "鍘熷璁板綍妯℃澘涓殑妫�楠岄」琛屽彿")
+ private Integer templateRowIndex;
+
+ @TableField(exist = false)
+ @Schema(description = "妯℃澘鍐呭")
+ private List<JSONObject> template;
+
+ @TableField(exist = false)
+ @Schema(description = "妯℃澘鍐呭棰滆壊")
+ private Map<String, Object> style;
+
+ @TableField(exist = false)
+ @Schema(description = "妫�楠岀粨鏋滃璞�")
+ private InsProductResult insProductResult;
+
+ @TableField(exist = false)
+ @Schema(description = "妯℃澘鍚嶇О")
+ private String templateName;
+
+ @TableField(exist = false)
+ @Schema(description = "璁㈠崟妯℃澘椤电椤哄簭")
+ private Integer templateSort;
+
+ @TableField(exist = false)
+ @Schema(description = "璁㈠崟妯℃澘宸插~鍐欏崟鍏冩牸锛屾寜鍧愭爣淇濆瓨")
+ private String recordValues;
+
+ @Schema(description = "瀛楀吀绫诲瀷")
+ private String dic;
+
+ //娓╁害
+ private String temperature;
+ //婀垮害
+ private String humidity;
+
+ private Integer insFiberId;
+
+ private Integer insFibersId;
+
+ private Integer insBushId;
+
+ @Schema(description = "鏍囧噯鏂规硶id")
+ private Integer standardMethodListId;
+
+ //杩斿洖鐨�20搴﹀父娓╃殑璁$畻鍊�(娓╁害寰幆)
+ @TableField(exist = false ,select = false)
+ private String complue;
+
+ @Schema(description = "鏉′欢")
+ private String radius;
+
+ @Schema(description = "鏀惰垂鏍囧噯(鍏�/娆�)")
+ private String rates;
+
+ @Schema(description = "鐢电紗閰嶇疆鏍囪瘑")
+ private String cableTag;
+
+ @Schema(description = "鍘熸潗鏂欓厤缃爣璇�")
+ private String rawMaterialTag;
+
+ @Schema(description = "閲嶅鏍囪瘑(涓�涓楠岄」鍙兘浼氬瓨鍦ㄥ娆�)")
+ private String repetitionTag;
+
+ @Schema(description = "鎺掑簭")
+ private Integer sort;
+
+ // 缁戝畾鍊间笉鍙傚姞灞曠ず, 鍙弬鍔犺绠�
+ @Schema(description = "鏄惁鏄粦瀹氬��, 0鍚�, 1鏄�")
+ private Integer isBinding;
+
+ @Schema(description = "鑷叧鑱�(缁戝畾id)")
+ private Integer bindingProductId;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarning.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarning.java
new file mode 100644
index 0000000..dbf523d
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarning.java
@@ -0,0 +1,66 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 妫�楠岄」鍋忓樊棰勮涓昏〃
+ * </p>
+ *
+ * @author
+ * @since 2025-03-28 02:18:02
+ */
+@Getter
+@Setter
+@TableName("ins_product_deviation_warning")
+@Schema(description = "妫�楠岄」鍋忓樊棰勮涓昏〃")
+public class InsProductDeviationWarning implements Serializable {
+
+ @TableId(value = "deviation_warning_id", type = IdType.AUTO)
+ private Integer deviationWarningId;
+
+ @Schema(description = "璁㈠崟id")
+ private Integer insOrderId;
+
+ @Schema(description = "鏍峰搧id")
+ private Integer insSampleId;
+
+ @Schema(description = "妫�楠岄」id")
+ private Integer insProductId;
+
+ @Schema(description = "璁㈠崟缂栧彿")
+ private String entrustCode;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+
+ @Schema(description = "渚涘簲鍟�")
+ private String supplierName;
+
+ @Schema(description = "鍋忓樊鍊�")
+ private String deviationValue;
+
+ @Schema(description = "妫�娴嬫椂闂�")
+ private LocalDateTime detectionTime;
+
+ @TableField(fill = FieldFill.INSERT)
+ private String createUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private String updateUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarningDetail.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarningDetail.java
new file mode 100644
index 0000000..ede2781
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarningDetail.java
@@ -0,0 +1,75 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 妫�楠岄」鍋忓樊棰勮璇︽儏琛�
+ * </p>
+ *
+ * @author
+ * @since 2025-03-28 02:18:58
+ */
+@Getter
+@Setter
+@TableName("ins_product_deviation_warning_detail")
+@Schema(description = "妫�楠岄」鍋忓樊棰勮璇︽儏琛�")
+public class InsProductDeviationWarningDetail implements Serializable {
+
+ @TableId(value = "deviation_warning_detail_id", type = IdType.AUTO)
+ private Integer deviationWarningDetailId;
+
+ @Schema(description = "涓昏〃id")
+ private Integer deviationWarningId;
+
+ @Schema(description = "璁㈠崟id")
+ private Integer insOrderId;
+
+ @Schema(description = "鏍峰搧id")
+ private Integer insSampleId;
+
+ @Schema(description = "妫�楠岄」id")
+ private Integer insProductId;
+
+ @Schema(description = "璁㈠崟缂栧彿")
+ private String entrustCode;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ private String sampleCode;
+
+ @Schema(description = "渚涘簲鍟�")
+ private String supplierName;
+
+ @Schema(description = "妫�娴嬪��")
+ private String testValue;
+
+ @Schema(description = "妫�娴嬫椂闂�")
+ private LocalDateTime detectionTime;
+
+ @Schema(description = "鏄惁鏄棶棰樻暟鎹� 0: 鍚�, 1: 鏄�(骞冲潎鍊艰幏鍙�)")
+ private Integer isIssue;
+
+ @Schema(description = "鏄惁鏄棶棰樻暟鎹� 0: 鍚�, 1: 鏄紙瑕佹眰鍊艰幏鍙栵級")
+ private Integer isIssueAsked;
+
+ @TableField(fill = FieldFill.INSERT)
+ private String createUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private String updateUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductResult.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductResult.java
new file mode 100644
index 0000000..0a00ad3
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductResult.java
@@ -0,0 +1,52 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 妫�楠岄」鐩殑缁撴灉
+ * @TableName ins_product_result
+ */
+@TableName(value ="ins_product_result")
+@Data
+public class InsProductResult implements Serializable {
+
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ @Schema(description = "澶栭敭锛氭楠岄」鐩甶d")
+ private Integer insProductId;
+
+ @Schema(description = "妫�楠屽��")
+ private String insValue;
+
+ @Schema(description = "璁$畻鍊�")
+ private String comValue;
+
+ @Schema(description = "璁惧鍊�")
+ private String equipValue;
+
+ @Schema(description = "璁惧鍚嶇О")
+ private String equipName;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductUser.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductUser.java
new file mode 100644
index 0000000..7576fab
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductUser.java
@@ -0,0 +1,40 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 妫�楠岄」鐩殑浜哄憳妫�楠岃褰�
+ * @TableName ins_product_user
+ */
+@TableName(value ="ins_product_user")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class InsProductUser implements Serializable {
+ /**
+ *
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ /**
+ * 澶栭敭锛歩ns_product琛╥d
+ */
+ private Integer insProductId;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsReport.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsReport.java
new file mode 100644
index 0000000..17bc669
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsReport.java
@@ -0,0 +1,138 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 妫�楠屾姤鍛�
+ * @TableName ins_report
+ */
+@TableName(value ="ins_report")
+@Data
+public class InsReport implements Serializable {
+ /**
+ *
+ */
+ @Schema(description = "涓婚敭")
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ @Schema(description = "鎶ュ憡缂栧彿")
+ private String code;
+
+ /**
+ * 澶栭敭锛氭楠屽崟id
+ */
+ @Schema(description = "妫�楠屽崟id")
+ private Integer insOrderId;
+
+ /** 0锛氭娴嬫姤鍛婏紙浠呮娴嬫暟鎹級锛�1锛氭楠屾姤鍛婏紙鍚垽瀹氱粨鏋滐級 */
+ @Schema(description = "鎶ュ憡绫诲瀷锛�0锛氭娴嬫姤鍛婏紝1锛氭楠屾姤鍛�")
+ private Integer reportType;
+
+ /**
+ * 绯荤粺鐢熸垚鎶ュ憡鍦板潃
+ */
+ @Schema(description = "绯荤粺鐢熸垚鎶ュ憡鍦板潃")
+ private String url;
+
+ /**
+ * 绯荤粺鐢熸垚鐨勬楠屾姤鍛婂湴鍧�锛涗笌 url 瀵瑰簲鐨勬娴嬫姤鍛婂叡鐢ㄥ悓涓�鏉″鎵硅褰曘��
+ */
+ @Schema(description = "妫�楠屾姤鍛婂湴鍧�")
+ private String inspectionUrl;
+
+ /**
+ * 鎵嬪姩涓婁紶鎶ュ憡鍦板潃
+ */
+ @Schema(description = "鎵嬪姩涓婁紶鎶ュ憡鍦板潃")
+ private String urlS;
+
+ /**
+ * 涓存椂鎶ュ憡鍦板潃
+ */
+ @Schema(description = "涓存椂鎶ュ憡鍦板潃")
+ private String tempUrlPdf;
+
+ /**
+ * 1锛氭壒鍑� 0锛氫笉鎵瑰噯
+ */
+ @Schema(description = "鎵瑰噯鐘舵��")
+ private Integer isRatify;
+
+ @Schema(description = "鎵瑰噯澶囨敞")
+ private String ratifyTell;
+
+ /**
+ * 1锛氬鏍搁�氳繃 0锛氬鏍镐笉閫氳繃
+ */
+ @Schema(description = "瀹℃牳鐘舵��")
+ private Integer isExamine;
+
+ @Schema(description = "瀹℃牳澶囨敞")
+ private String examineTell;
+
+ /**
+ * 澶栭敭锛氱敤鎴穒d锛堟彁浜や汉锛�
+ */
+ @Schema(description = "鎻愪氦浜虹敤鎴穒d")
+ private Integer writeUserId;
+
+ /**
+ * 澶栭敭锛氱敤鎴穒d锛堟壒鍑嗕汉锛�
+ */
+ @Schema(description = "鎵瑰噯浜虹敤鎴穒d")
+ private Integer ratifyUserId;
+
+ /**
+ * 澶栭敭锛氱敤鎴穒d锛堝鏍镐汉锛�
+ */
+ @Schema(description = "瀹℃牳浜虹敤鎴穒d")
+ private Integer examineUserId;
+
+ @Schema(description = "鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "鏇存柊浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ /**
+ * 1锛氬凡鎻愪氦 0锛氬緟鎻愪氦
+ */
+ @Schema(description = "鎻愪氦鐘舵��")
+ private Integer state;
+
+ @Schema(description = "鎻愪氦鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime writeTime;
+
+ @Schema(description = "瀹℃牳鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime examineTime;
+
+ @Schema(description = "鎵瑰噯鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime ratifyTime;
+
+
+ @Schema(description = "鏄惁鏄�氳繃鐨勬姤鍛�, 0:鏈�氳繃, 1:閫氳繃")
+ private Integer isPass;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSample.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSample.java
new file mode 100644
index 0000000..0ec8cb2
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSample.java
@@ -0,0 +1,127 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 妫�楠屾牱鍝�
+ * @TableName ins_sample
+ */
+@TableName(value ="ins_sample")
+@Data
+public class InsSample implements Serializable {
+ /**
+ *
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 1锛氬悎鏍� 0锛氫笉鍚堟牸
+ */
+ private Integer insResult;
+
+ /**
+ * 澶栭敭锛歩ns_order琛╥d
+ */
+ private Integer insOrderId;
+
+ /**
+ * 閰嶅鏍峰搧鍨嬪彿
+ */
+ private String joinModel;
+
+ /**
+ * 閰嶅鏍峰搧鍚嶇О
+ */
+ private String joinName;
+
+ /**
+ * 閰嶅鏍峰搧鏁伴噺
+ */
+ private Integer joinNum;
+
+ /**
+ * 鏍峰搧缂栫爜
+ */
+ private String sampleCode;
+
+ /**
+ * 妫�楠屽伐鍘�
+ */
+ private String factory;
+
+ /**
+ * 瀹為獙瀹ゅ悕绉�
+ */
+ private String laboratory;
+
+ /**
+ * 鏍峰搧绫诲瀷
+ */
+ private String sampleType;
+
+ /**
+ * 鏍峰搧鍚嶇О
+ */
+ private String sample;
+
+ /**
+ * 瑙勬牸鍨嬪彿
+ */
+ private String model;
+
+ /**
+ * 妫�楠岀姸鎬�(0锛氬緟妫�楠�1:妫�楠屼腑 2:宸叉楠�3锛氬緟澶嶆牳4锛氬鏍告湭閫氳繃5锛氬鏍搁�氳繃)
+ */
+ private Integer insState;
+
+ /**
+ * 澶囨敞
+ */
+ private String remark;
+
+ private Integer standardMethodListId;
+
+ @Schema(description = "鏍峰搧鍗曚綅")
+ private String unit;
+
+ private Integer cellId;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ private Integer parentId;
+
+ @Schema(description = "鏁伴噺")
+ private Integer quantity;
+
+ @Schema(description = "鐗规畩鏍囧噯鏂规硶")
+ private String specialStandardMethod;
+
+ @TableField(select = false,exist = false)
+ private Integer num=1;
+
+ @Schema(description = "鏍囧噯鏂规硶鍚嶇О")
+ @TableField(select = false,exist = false)
+ private String standardMethodName;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSampleReceipt.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSampleReceipt.java
new file mode 100644
index 0000000..525630a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSampleReceipt.java
@@ -0,0 +1,42 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@TableName("ins_sample_receipt")
+public class InsSampleReceipt {
+
+ @Schema(description = "涓婚敭")
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+ @Schema(description = "濮旀墭鍗旾D")
+ private Integer insOrderId;
+ @Schema(description = "鏍峰搧ID")
+ private Integer insSampleId;
+ @Schema(description = "鏍峰搧鎺ユ敹鐘舵�� 0寰呮帴鏀� 1宸叉彁浜ゆ楠� 2宸叉嫆鏀� 3宸插彇娑�")
+ private Integer status;
+ @Schema(description = "涓绘楠屼汉ID")
+ private Integer mainInspectorId;
+ @Schema(description = "鎺ユ敹澶勭悊浜篒D")
+ private Integer receiveUserId;
+ @Schema(description = "鎺ユ敹澶勭悊鏃堕棿")
+ private LocalDateTime receiveTime;
+ @Schema(description = "鎻愪氦妫�楠屾椂闂�")
+ private LocalDateTime submitTime;
+ @Schema(description = "鎷掓敹澶囨敞")
+ private String rejectRemark;
+ @Schema(description = "鍒涘缓浜�")
+ private Integer createUser;
+ @Schema(description = "鍒涘缓鏃堕棿")
+ private LocalDateTime createTime;
+ @Schema(description = "鏇存柊浜�")
+ private Integer updateUser;
+ @Schema(description = "鏇存柊鏃堕棿")
+ private LocalDateTime updateTime;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSampleUser.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSampleUser.java
new file mode 100644
index 0000000..641e956
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSampleUser.java
@@ -0,0 +1,72 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 鏍峰搧璐熻矗浜鸿褰�
+ * @TableName ins_sample_user
+ */
+@TableName(value ="ins_sample_user")
+@Data
+@NoArgsConstructor
+public class InsSampleUser implements Serializable {
+ /**
+ *
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 澶栭敭锛氭槸璁㈠崟insOrder琛╥d (????)
+ */
+ private Integer insSampleId;
+
+ /**
+ * 澶栭敭锛氱敤鎴穒d 璐熻矗浜�
+ */
+ private Integer userId;
+
+ /**
+ * 1锛氱‘璁� 0锛氭湭纭
+ */
+ //1鏄鏍镐汉 0鏄楠屼汉
+ private Integer state;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ /**
+ * 瀛愯瘯楠屽
+ * @param insSampleId
+ * @param userId
+ * @param state
+ */
+ private String sonLaboratory;
+
+ public InsSampleUser(Integer insSampleId, Integer userId, Integer state,String sonLaboratory) {
+ this.insSampleId = insSampleId;
+ this.userId = userId;
+ this.state = state;
+ this.sonLaboratory = sonLaboratory;
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandler.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandler.java
new file mode 100644
index 0000000..0e2f811
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandler.java
@@ -0,0 +1,113 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+
+/**
+ * 涓嶅悎鏍煎鐞嗚〃
+ * @TableName ins_unqualified_handler
+ */
+@TableName(value ="ins_unqualified_handler")
+@Data
+public class InsUnqualifiedHandler implements Serializable {
+ /**
+ * 涓婚敭id
+ */
+ @Schema(description = "涓婚敭id")
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 缂栧彿
+ */
+ @Schema(description = "缂栧彿")
+ private String no;
+
+ /**
+ * 鏍囬
+ */
+ @Schema(description = "鏍囬")
+ private String headline;
+
+ /**
+ * 鐗╂枡鍚嶇О
+ */
+ @Schema(description = "鐗╂枡鍚嶇О")
+ private String materialName;
+
+ /**
+ * 鐢熶骇鎵规
+ */
+ @Schema(description = "鐢熶骇鎵规")
+ private String productionBatch;
+
+ /**
+ * 鍒拌揣鏁伴噺
+ */
+ @Schema(description = "鍒拌揣鏁伴噺")
+ private String cargoQuantity;
+
+ /**
+ * 瑙勬牸鍨嬪彿
+ */
+ @Schema(description = "瑙勬牸鍨嬪彿")
+ private String specsModels;
+
+ /**
+ * 鎶ユ鏃ユ湡
+ */
+ @Schema(description = "鎶ユ鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate inspectTime;
+
+ /**
+ * 鍙嶉浜�
+ */
+ @Schema(description = "鍙嶉浜�")
+ private String feedbackUser;
+
+ /**
+ * 鍙嶉鏃ユ湡
+ */
+ @Schema(description = "鍙嶉鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate feedbackTime;
+
+ /**
+ * 鍒嗙被
+ */
+ @Schema(description = "")
+ private String classification;
+
+ /**
+ * 涓嶅悎鏍煎綊灞�
+ */
+ @Schema(description = "涓嶅悎鏍煎綊灞�")
+ private String offGradeAscription;
+
+ /**
+ * 涓嶅悎鏍兼弿杩�
+ */
+ @Schema(description = "涓嶅悎鏍兼弿杩�")
+ private String unqualifiedDesc;
+
+ /**
+ * 鍘熸潗鏂欐楠宨d
+ */
+ @Schema(description = "鍘熸潗鏂欐楠宨d")
+ private Integer inventoryQuantityId;
+
+ /**
+ * 鍘熸潗鏂欐楠宨d
+ */
+ @Schema(description = "璁㈠崟id")
+ private Integer insOrderId;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandlerFile.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandlerFile.java
new file mode 100644
index 0000000..187a74a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandlerFile.java
@@ -0,0 +1,79 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 涓嶅悎鏍煎鐞嗛檮浠惰褰曡〃
+ * @TableName ins_unqualified_handler_file
+ */
+@TableName(value ="ins_unqualified_handler_file")
+@Data
+public class InsUnqualifiedHandlerFile implements Serializable {
+ /**
+ * 涓婚敭id
+ */
+ @Schema(description = "涓婚敭id")
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 涓嶅悎鏍煎鐞唅d
+ */
+ @Schema(description = "涓嶅悎鏍煎鐞唅d")
+ private Long unqualifiedId;
+
+ /**
+ * 鏂囦欢绫诲瀷(1:鍥剧墖 2:鏂囦欢)
+ */
+ @Schema(description = "鏂囦欢绫诲瀷(1:鍥剧墖 2:鏂囦欢)")
+ private Integer type;
+
+ /**
+ * 鏂囦欢涓婁紶璺緞
+ */
+ @Schema(description = "鏂囦欢涓婁紶璺緞")
+ private String fileUrl;
+
+ /**
+ * 鏂囦欢鍚嶇О
+ */
+ @Schema(description = "鏂囦欢鍚嶇О")
+ private String fileName;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @Schema(description = "鍒涘缓浜�")
+ @TableField(fill= FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @TableField(fill= FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ /**
+ * 鏇存柊浜�
+ */
+ @Schema(description = "鏇存柊浜�")
+ @TableField(fill= FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ @Schema(description = "鏇存柊鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @TableField(fill= FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedRetestProduct.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedRetestProduct.java
new file mode 100644
index 0000000..9302586
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedRetestProduct.java
@@ -0,0 +1,148 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 涓嶅悎鏍兼楠岄」鐩娴�
+ *
+ * @author zhuo
+ * @since 2024-09-03
+ */
+@TableName(value = "ins_unqualified_retest_product")
+@Data
+public class InsUnqualifiedRetestProduct implements Serializable {
+ /**
+ * 涓婚敭id
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+ //澶栭敭锛歩ns_product琛╥d
+ private Integer insProductId;
+
+ @Schema(description = "椤圭洰鍙傛暟id")
+ private Integer structureItemParameterId;
+ //妫�楠岄」
+ private String inspectionItem;
+ //妫�楠岄」瀛愮被
+ private String inspectionItemSubclass;
+ //宸ュ巶
+ private String factory;
+ //瀹為獙瀹�
+ private String laboratory;
+ //鏍峰搧鍒嗙被
+ private String sampleType;
+ //鏍峰搧
+ private String sample;
+ //鍨嬪彿
+ private String model;
+ //瀛愬疄楠屽
+ private String sonLaboratory;
+ //璁¢噺鍗曚綅
+ private String unit;
+ //鍗曚环(鍏�)
+ private Double price;
+ //宸ユ椂(H)
+ private Double manHour;
+ //宸ユ椂鍒嗙粍
+ private String manHourGroup;
+ //妫�楠岄」绫诲瀷
+ private String inspectionItemType;
+ //妫�楠屽�肩被鍨�
+ private String inspectionValueType;
+ //璁惧缁�
+ private String deviceGroup;
+ //妫�楠屾鏁�
+ private Integer checkoutNumber;
+ //鍖洪棿
+ private String section;
+ //鍙栧�肩被鍨�
+ private String valueType;
+ //鏂规硶
+ private String method;
+ //棰勮鏃堕棿(澶�)
+ private Integer manDay;
+ //鐗规畩鏍囪瘑
+ private String bsm;
+ //瑕佹眰鍊�
+ private String ask;
+ //瑕佹眰鎻忚堪
+ private String tell;
+ //鏈�缁堝��
+ @TableField("`last_value`")
+ private String lastValue;
+ //1锛氬悎鏍� 0锛氫笉鍚堟牸 3: 涓嶅垽瀹�
+ private Integer insResult;
+ //1锛氭湁鏁� 0锛氭棤鏁�
+ private Integer state;
+ //澶栭敭锛歩ns_sample琛╥d
+ private Integer insSampleId;
+
+ // 鍒涘缓浜�
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ //鍒涘缓鏃堕棿
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ // 淇敼浜�
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ // 淇敼鏃堕棿
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+ //澶栭敭锛歴tandard_template琛╥d
+ private Integer templateId;
+ //瀛楀吀绫诲瀷
+ private String dic;
+ //鏂规硶
+ private String methodS;
+ //澶栭敭
+ private Integer insFiberId;
+ //澶栭敭
+ private Integer insFibersId;
+ //妫�楠岄」EN
+ private String inspectionItemEn;
+ //妫�楠岄」灏忕被EN
+ private String inspectionItemSubclassEn;
+ //妫�楠岄」鍒嗙被
+ private String inspectionItemClass;
+ //妫�楠岄」鍒嗙被EN
+ private String inspectionItemClassEn;
+ //澶栭敭锛氭爣鍑嗘柟娉昳d
+ private Integer standardMethodListId;
+ //娓╁害
+ private String temperature;
+ //婀垮害
+ private String humidity;
+ //澶栭敭(鐩墠鍙湁鏉惧绠¢」鐩娇鐢�)
+ private Integer insBushId;
+ //鑼冨洿
+ private String radius;
+ //鐢电紗鏍囪瘑
+ private String cableTag;
+ // 閲嶅鏍囪瘑
+ private String repetitionTag;
+ //鍘熸潗鏂欐壒閲忔爣璇�
+ private String rawMaterialTag;
+ //澶嶆祴娆℃暟鏍囪瘑
+ private String retestTag;
+ //鎺掑簭
+ private Integer sort;
+ // 缁戝畾鍊间笉鍙傚姞灞曠ず, 鍙弬鍔犺绠�
+ @Schema(description = "鏄惁鏄粦瀹氬��, 0鍚�, 1鏄�")
+ private Integer isBinding;
+
+ @Schema(description = "鑷叧鑱�(缁戝畾id)")
+ private Integer bindingProductId;
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedRetestResult.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedRetestResult.java
new file mode 100644
index 0000000..553e6e2
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedRetestResult.java
@@ -0,0 +1,51 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 涓嶅悎鏍煎娴嬫楠岄」鐩殑缁撴灉
+ *
+ * @author zhuo
+ * @since 2024-09-03
+ */
+@TableName(value = "ins_unqualified_retest_result")
+@Data
+public class InsUnqualifiedRetestResult implements Serializable {
+
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+ //澶栭敭锛氫笉鍚堟牸妫�楠岄」鐩甶d
+ private Integer retestProductId;
+ //妫�楠屽��
+ private String insValue;
+ //璁$畻鍊�
+ private String comValue;
+ //璁惧缂栫爜
+ private String equipValue;
+ //璁惧鍚嶇О
+ private String equipName;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/RawMaterialOrderTemplate.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/RawMaterialOrderTemplate.java
new file mode 100644
index 0000000..9fc4702
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/RawMaterialOrderTemplate.java
@@ -0,0 +1,52 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * 鍘熸潗鏂欎笅鍗曟ā鏉�
+ *
+ * @author zhuo
+ * @since 2024-08-05
+ */
+@TableName(value = "raw_material_order_template")
+@Data
+public class RawMaterialOrderTemplate {
+
+ /**
+ *
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 妯℃澘鍚嶇О
+ */
+ @Schema(description = "妯℃澘鍚嶇О")
+ private String name;
+
+ /**
+ * 妯℃澘鍚嶇О
+ */
+ @Schema(description = "闆朵欢缂栧彿")
+ private String partNo;
+
+ /**
+ * 妯℃澘鍐呭
+ */
+ @Schema(description = "妯℃澘鍐呭")
+ private String thing;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarter.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarter.java
new file mode 100644
index 0000000..d90bdc8
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarter.java
@@ -0,0 +1,67 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 瀛e害鎶芥牱璁″垝
+ *
+ * @author zhuo
+ * @since 2024-10-09
+ */
+@TableName(value = "spot_check_quarter")
+@Data
+public class SpotCheckQuarter implements Serializable {
+
+ @TableId(type = IdType.AUTO)
+ private Integer quarterId;
+
+ @Schema(description = "缂栧彿")
+ private String quarterNo;
+
+ @Schema(description = "鎶ュ憡鐢熸垚鍦板潃")
+ private String fileUrl;
+
+ @Schema(description = "瀛e害瀹屾垚鐘舵��")
+ private Integer quarterStatus;
+
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ @Schema(description = "缂栧埗浜�")
+ private Integer writeUser;
+
+ @Schema(description = "浼氱浜�")
+ private String countersignUser;
+
+ @Schema(description = "瀹℃牳浜�")
+ private Integer examineUser;
+
+ @Schema(description = "鎵瑰噯浜�")
+ private Integer ratifyUser;
+
+ @Schema(description = "鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "淇敼浜篿d")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarterItem.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarterItem.java
new file mode 100644
index 0000000..4ad0bad
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarterItem.java
@@ -0,0 +1,69 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * 瀛e害鎶芥牱璁″垝璇︽儏琛�
+ *
+ * @author makejava
+ * @since 2024-10-09
+ */
+@TableName(value ="spot_check_quarter_item")
+@Data
+public class SpotCheckQuarterItem {
+
+ @TableId(type = IdType.AUTO)
+ private Integer quarterItemId;
+
+ @Schema(description = "涓昏〃id")
+ private Integer quarterId;
+
+ @Schema(description = "浜у搧绫诲瀷")
+ private String productType;
+
+ @Schema(description = "浜у搧鍨嬪彿")
+ private String productModel;
+
+ @Schema(description = "璐d换浜�")
+ private String dutyUser;
+
+ @Schema(description = "鎶芥牱鏁伴噺")
+ private String spotCheckNumber;
+
+ @Schema(description = "鎶芥牱鏃堕棿")
+ private String spotCheckTime;
+
+ @Schema(description = "璇曟牱缁撹")
+ private String result;
+
+ @Schema(description = "鍙栨牱浜哄憳")
+ private String samplingUser;
+
+ @Schema(description = "澶囨敞")
+ private String itemRemark;
+
+ @Schema(description = "鍒涘缓浜篿d")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "淇敼浜篿d")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYear.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYear.java
new file mode 100644
index 0000000..0e63cfa
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYear.java
@@ -0,0 +1,67 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 骞村害鎶芥牱璁″垝
+ *
+ * @author zhuo
+ * @since 2024-10-10
+ */
+@TableName(value ="spot_check_year")
+@Data
+public class SpotCheckYear implements Serializable {
+
+ @TableId(type = IdType.AUTO)
+ private Integer yearId;
+
+ @Schema(description = "鍚嶇О")
+ private String yearHead;
+
+ @Schema(description = "鎶ュ憡鐢熸垚鍦板潃")
+ private String fileUrl;
+
+ @Schema(description = "琛ㄦ牸鍐呭娉�")
+ private String tableRemark;
+
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ @Schema(description = "缂栧埗浜�")
+ private Integer writeUser;
+
+ @Schema(description = "浼氱浜�")
+ private String countersignUser;
+
+ @Schema(description = "鎵瑰噯浜�")
+ private Integer examineUser;
+
+ @Schema(description = "鎵瑰噯浜�")
+ private Integer ratifyUser;
+
+ @Schema(description = "鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "淇敼浜篿d")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYearItem.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYearItem.java
new file mode 100644
index 0000000..6fa969e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYearItem.java
@@ -0,0 +1,84 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * 骞村害鎶芥牱璁″垝璇︽儏琛�
+ *
+ * @author zhuo
+ * @since 2024-10-10
+ */
+@TableName(value = "spot_check_year_item")
+@Data
+public class SpotCheckYearItem {
+
+ @TableId(type = IdType.AUTO)
+ private Integer yearItemId;
+ //涓昏〃id
+ @Schema(description = "涓昏〃id")
+ private Integer yearId;
+
+ @Schema(description = "绫诲埆")
+ private String yearType;
+
+ @Schema(description = "涓�鏈�")
+ private String january;
+
+ @Schema(description = "浜屾湀")
+ private String february;
+
+ @Schema(description = "涓夋湀")
+ private String march;
+
+ @Schema(description = "鍥涙湀")
+ private String april;
+
+ @Schema(description = "浜旀湀")
+ private String may;
+
+ @Schema(description = "鍏湀")
+ private String june;
+
+ @Schema(description = "涓冩湀")
+ private String july;
+
+ @Schema(description = "鍏湀")
+ private String august;
+
+ @Schema(description = "涔濇湀")
+ private String september;
+
+ @Schema(description = "鍗佹湀")
+ private String october;
+
+ @Schema(description = "鍗佷竴鏈�")
+ private String november;
+
+ @Schema(description = "鍗佷簩鏈�")
+ private String december;
+
+ @Schema(description = "鍒涘缓浜篿d")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "淇敼浜篿d")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/Warehouse.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/Warehouse.java
new file mode 100644
index 0000000..741b65c
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/Warehouse.java
@@ -0,0 +1,44 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 浠撳簱
+ * @TableName warehouse
+ */
+@TableName(value ="warehouse")
+@Data
+public class Warehouse implements Serializable {
+ /**
+ *
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 浠撳簱鍚嶇О
+ */
+ private String name;
+
+ /**
+ *
+ */
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseCell.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseCell.java
new file mode 100644
index 0000000..4f0a9b3
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseCell.java
@@ -0,0 +1,61 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 璐ф灦鍗曞厓鏍�
+ * @TableName warehouse_cell
+ */
+@TableName(value ="warehouse_cell")
+@Data
+public class WarehouseCell implements Serializable {
+ /**
+ *
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 琛�
+ */
+ @TableField("`row`")
+ private Integer row;
+
+ /**
+ * 鍒�
+ */
+ @TableField("`col`")
+ private Integer col;
+
+ /**
+ *
+ */
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ /**
+ * 鏄惁鏈夋晥 1锛氭湁鏁� 0锛氭棤鏁�
+ */
+ private Integer state;
+
+ /**
+ * 澶栨锛氳揣鏋秈d
+ */
+ private Integer shelfId;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseHistory.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseHistory.java
new file mode 100644
index 0000000..0164d63
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseHistory.java
@@ -0,0 +1,56 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 鍑哄叆搴撹褰�
+ * @TableName warehouse_history
+ */
+@TableName(value ="warehouse_history")
+@Data
+public class WarehouseHistory implements Serializable {
+ /**
+ *
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private String warehouseCode;
+
+ /**
+ * 澶栭敭锛氭牱鍝乮d
+ */
+ private Integer insSampleId;
+
+ /**
+ * 鐘舵�侊細1锛氬叆搴� 2锛氬嚭搴�
+ */
+ private Integer state;
+
+ /**
+ *
+ */
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ /**
+ * 澶栭敭锛氬崟鍏冩牸id
+ */
+ private Integer cellId;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseShelf.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseShelf.java
new file mode 100644
index 0000000..670d95a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/WarehouseShelf.java
@@ -0,0 +1,61 @@
+package com.ruoyi.inspect.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 璐ф灦
+ * @TableName warehouse_shelf
+ */
+@TableName(value ="warehouse_shelf")
+@Data
+public class WarehouseShelf implements Serializable {
+ /**
+ *
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 璐ф灦鍚嶇О
+ */
+ private String name;
+
+ /**
+ * 琛�
+ */
+ @TableField("`row`")
+ private Integer row;
+
+ /**
+ * 鍒�
+ */
+ @TableField("`col`")
+ private Integer col;
+
+ /**
+ *
+ */
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ /**
+ * 澶栭敭锛氫粨搴搃d
+ */
+ private Integer warehouseId;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/DataAnalysisService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/DataAnalysisService.java
new file mode 100644
index 0000000..20e4a0c
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/DataAnalysisService.java
@@ -0,0 +1,77 @@
+package com.ruoyi.inspect.service;
+
+
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.inspect.dto.DataAnalysisDto;
+import com.ruoyi.inspect.vo.DeviationAnalyzeVo;
+import com.ruoyi.inspect.vo.RawProductAnalysisVo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鏁版嵁鍒嗘瀽
+ *
+ * @Author zhuo
+ * @Date 2024/10/16
+ */
+public interface DataAnalysisService {
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欐煴鐘剁粺璁�
+ * @return
+ */
+ List<Map<String, Object>> getRawPassRateByBarChart(DataAnalysisDto dataAnalysisDto);
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欏悎鏍肩巼楗肩姸鍥�
+ * @param dataAnalysisDto
+ * @return
+ */
+ Map<String, Object> getRawPassRateByCake(DataAnalysisDto dataAnalysisDto);
+
+
+ /**
+ * 鏌ヨ妫�楠岄」鍚嶇О
+ * @param dataAnalysisDto
+ * @return
+ */
+ List<String> getRawItemNames(DataAnalysisDto dataAnalysisDto);
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓」妫�鍒嗘瀽
+ * @param dataAnalysisDto
+ * @return
+ */
+ RawProductAnalysisVo getRawProductAnalysis(DataAnalysisDto dataAnalysisDto);
+
+ /**
+ * 鏌ヨ妫�娴嬮」鍒嗘瀽鍒楄〃
+ * @param dataAnalysisDto
+ * @return
+ */
+ List<IfsInventoryQuantitySupplierDto> getRawProductAnalysisAllList(DataAnalysisDto dataAnalysisDto);
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓」妫�鍒嗘瀽鍚堟牸鐜�
+ * @param dataAnalysisDto
+ * @return
+ */
+ RawProductAnalysisVo getRawProductAnalysisRawPass(DataAnalysisDto dataAnalysisDto);
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓」妫�鍜屽巶瀹舵暟鎹姣�
+ * @param dataAnalysisDto
+ * @return
+ */
+ DeviationAnalyzeVo getRawSupplierCompare(DataAnalysisDto dataAnalysisDto);
+
+ /**
+ * 鏌ヨ鏈湀涓庝笂鏈堝悎鏍肩巼瀵规瘮
+ * @param dataAnalysisDto
+ * @return
+ */
+ List<Map<String, Object>> getRawUpMonth(DataAnalysisDto dataAnalysisDto);
+
+ Map<String, Object> getOrderTypeCookie(DataAnalysisDto dataAnalysisDto);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/FinishProductSpotCheckService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/FinishProductSpotCheckService.java
new file mode 100644
index 0000000..71fa44a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/FinishProductSpotCheckService.java
@@ -0,0 +1,126 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.IfsStockQueryDTO;
+import com.ruoyi.inspect.dto.SpotCheckQuarterDto;
+import com.ruoyi.inspect.dto.SpotCheckYearDto;
+
+import jakarta.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鎴愬搧鎶芥牱
+ *
+ * @Author zhuo
+ * @Date 2024/9/29
+ */
+public interface FinishProductSpotCheckService {
+
+ /**
+ * 鏌ヨifs鎴愬搧搴撳瓨
+ *
+ * @return
+ */
+ Result getIfsStockReport(IfsStockQueryDTO ifsStockQueryDTO);
+
+
+ /******************************************************* 瀛e害鎶芥牱 *******************************************************/
+
+ /**
+ * 鏂板瀛e害鎶芥
+ * @param spotCheckQuarterDto
+ * @return
+ */
+ boolean addQuarter(SpotCheckQuarterDto spotCheckQuarterDto);
+
+ /**
+ * 鏌ヨ瀛e害鎶芥牱璇︽儏
+ * @param quarterId
+ * @return
+ */
+ SpotCheckQuarterDto getQuarter(Integer quarterId);
+
+ /**
+ * 瀛e害鎶芥牱鍒嗛〉鏌ヨ
+ * @param page
+ * @param spotCheckQuarter
+ * @return
+ */
+ IPage<SpotCheckQuarterDto> getQuarterPage(Page page, SpotCheckQuarterDto spotCheckQuarter);
+
+ /**
+ * 鍒犻櫎瀛e害鎶芥牱
+ * @param quarterId
+ * @return
+ */
+ boolean deleteQuarter(Integer quarterId);
+
+ /**
+ * 鎴愬搧涓嬪崟鐣岄潰鏌ヨ瀛e害淇℃伅
+ * @return
+ */
+ List<Map<String, Object>> getQuarterOnOrder();
+
+ /**
+ * 淇敼瀛e害妫�楠�
+ * @param spotCheckQuarterDto
+ * @return
+ */
+ boolean updateQuarterOnOrder(SpotCheckQuarterDto spotCheckQuarterDto);
+
+ /**
+ * 鐢熸垚鏈�缁堟姤鍛�
+ * @param quarterId
+ * @return
+ */
+ boolean finalReportQuarter(Integer quarterId, HttpServletResponse response);
+
+
+ /******************************************************* 骞村害鎶芥牱 *******************************************************/
+
+ /**
+ * 鏂板骞村害鎶芥牱
+ * @param spotCheckYearDto
+ * @return
+ */
+ boolean addSpotCheckYear(SpotCheckYearDto spotCheckYearDto);
+
+ /**
+ * 鏌ヨ骞村害鎶芥牱璇︽儏
+ * @param yearId
+ * @return
+ */
+ SpotCheckYearDto getSpotCheckYear(Integer yearId);
+
+ /**
+ * 骞村害鎶芥牱鍒楄〃
+ * @param page
+ * @param spotCheckYear
+ * @return
+ */
+ IPage<SpotCheckYearDto> getSpotCheckYearPage(Page page, SpotCheckYearDto spotCheckYear);
+
+ /**
+ * 鍒犻櫎骞村害鎶芥牱
+ * @param yearId
+ * @return
+ */
+ boolean deleteSpotCheckYear(Integer yearId);
+
+ /**
+ * 淇敼骞村害妫�楠�
+ * @param spotCheckYearDto
+ * @return
+ */
+ boolean updateSpotCheckYear(SpotCheckYearDto spotCheckYearDto);
+
+ /**
+ * 鐢熸垚鏈�缁堝勾搴︽姤鍛�
+ * @param yearId
+ * @return
+ */
+ boolean finalReportSpotCheckYear(Integer yearId, HttpServletResponse response);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/IfsOrderInspectionService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/IfsOrderInspectionService.java
new file mode 100644
index 0000000..4400e9b
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/IfsOrderInspectionService.java
@@ -0,0 +1,20 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import org.springframework.stereotype.Component;
+
+@Component
+public interface IfsOrderInspectionService {
+
+ /**
+ * 鏌ヨ宸叉楠�
+ * @param page
+ * @param ifsInventoryQuantityDto
+ * @return
+ */
+ IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto);
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/IfsPartPropsRecordService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/IfsPartPropsRecordService.java
new file mode 100644
index 0000000..1270a13
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/IfsPartPropsRecordService.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.dto.IfsPartPropsRecordDTO;
+import com.ruoyi.inspect.pojo.IfsPartPropsRecord;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑fs_part_props_record(ifs璁㈠崟闆朵欢灞炴�ц褰曡〃)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2025-10-23 15:00:34
+*/
+public interface IfsPartPropsRecordService extends IService<IfsPartPropsRecord> {
+
+ boolean saveOrUpdateProps(IfsPartPropsRecordDTO ifsPartPropsRecord);
+
+ IfsPartPropsRecord getOneByIfsId(Long ifsId);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/IfsSplitOrderRecordService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/IfsSplitOrderRecordService.java
new file mode 100644
index 0000000..1f6767e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/IfsSplitOrderRecordService.java
@@ -0,0 +1,13 @@
+package com.ruoyi.inspect.service;
+
+import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑fs_split_order_record(ifs鍘熸潗鏂欒鍗曟媶鍒嗚褰曡〃)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2025-10-29 16:39:41
+*/
+public interface IfsSplitOrderRecordService extends IService<IfsSplitOrderRecord> {
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderDeviceRecordService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderDeviceRecordService.java
new file mode 100644
index 0000000..84c047a
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderDeviceRecordService.java
@@ -0,0 +1,11 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.InsOrderDeviceRecord;
+
+/**
+ * @Author zhuo
+ * @Date 2024/12/22
+ */
+public interface InsOrderDeviceRecordService extends IService<InsOrderDeviceRecord> {
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFactoryVerifyItemService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFactoryVerifyItemService.java
new file mode 100644
index 0000000..6b87d14
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFactoryVerifyItemService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.InsOrderFactoryVerifyItem;
+
+/**
+ * 鍘熸潗鏂欏巶瀹惰繘璐ч獙璇佹楠岄」
+ *
+ * @author zhuo
+ * @since 2024-09-26
+ */
+public interface InsOrderFactoryVerifyItemService extends IService<InsOrderFactoryVerifyItem> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFileService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFileService.java
new file mode 100644
index 0000000..c4f52aa
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFileService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.InsOrderFile;
+
+/**
+ * <p>
+ * 妫�楠屽崟涓嬬殑闄勪欢鍒楄〃 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
+ * @since 2024-06-06 10:08:21
+ */
+public interface InsOrderFileService extends IService<InsOrderFile> {
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java
new file mode 100644
index 0000000..5c438a0
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java
@@ -0,0 +1,130 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.dto.InsOrderPlanDTO;
+import com.ruoyi.inspect.dto.InsOrderPlanProductDto;
+import com.ruoyi.inspect.dto.SaveInsContextDto;
+import com.ruoyi.inspect.dto.SaveOrderDevicesDto;
+import com.ruoyi.inspect.dto.SaveTemplateContextDto;
+import com.ruoyi.inspect.dto.VerifyPlanDto;
+import com.ruoyi.inspect.pojo.InsOrderFactoryVerify;
+import com.ruoyi.inspect.pojo.InsOrderFile;
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo;
+import com.ruoyi.inspect.vo.InsOrderPlanVO;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 妫�楠屼换鍔�-涓氬姟灞�
+ */
+public interface InsOrderPlanService {
+ IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO);
+
+ IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, InsOrderPlanDTO insOrderPlanDTO);
+
+ boolean claimInsOrderPlan(InsOrderPlanDTO entity);
+
+ void saveInsContext(SaveInsContextDto saveInsContextDto);
+
+ void saveTemplateContext(SaveTemplateContextDto saveTemplateContextDto);
+
+ List<Integer> getOrderDeviceIds(Integer orderId);
+
+ void saveOrderDevices(SaveOrderDevicesDto saveOrderDevicesDto);
+
+ Map<String, Object> doInsOrder(Integer id, String laboratory);
+
+ int upPlanUser(Integer userId, Integer orderId,String sonLaboratory);
+
+ int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode, Boolean registerInsResults);
+
+ List<InsProduct> getInsProduct(InsOrderPlanProductDto insOrderPlanProductDto);
+
+ Map<String,Object> checkSubmitPlan(Integer orderId, String laboratory);
+
+ IPage<InsOrderFile> getFileList(Page page, InsOrderFile insOrderFile);
+
+ int uploadFile(Integer orderId, MultipartFile file);
+
+
+ List<String> upPlanUser2(Integer orderId);
+
+ int rawMaterialVerifyPlan(Integer orderId, String laboratory, Integer type, String tell, Integer userId);
+
+ int rawMaterialVerifyPlan(VerifyPlanDto verifyPlanDto);
+
+ /**
+ * 鎸夊綋鍓嶆楠屾暟鎹噸鏂扮敓鎴愬皻鏈壒鍑嗙殑绯荤粺鎶ュ憡銆�
+ */
+ void regenerateReport(Integer reportId, Integer createOrderUser);
+
+ /**
+ * 鐢电紗閰嶇疆. 鏌ョ湅鏍囪瘑
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ List<Map<String, Object>> getCableTag(Integer id, String laboratory);
+
+ /**
+ * 鍘熸潗鏂欐煡鐪嬫爣璇�
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ List<Map<String, Object>> getRawMaterialTag(Integer id, String laboratory);
+
+ /**
+ * 鏌ョ湅閲嶅鏍囪瘑
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ List<Map<String, Object>> getRepetitionTag(Integer id, String laboratory, String cableTag);
+
+
+ /**
+ * 鏂板涓嶅悎鏍煎娴嬪唴瀹圭粰
+ * @param ids
+ * @return
+ */
+ boolean addDisqualificationRetest(List<InsProduct> insProductsList);
+
+ /**
+ * 鑾峰彇涓嶅悎鏍煎娴嬫暟鎹�
+ * @return
+ */
+ List<InsProduct> getInsProductUnqualifiedRetest(InsOrderPlanProductDto insOrderPlanProductDto);
+
+ /**
+ * 淇濆瓨涓嶅悎鏍煎娴嬫楠屽唴瀹�
+ */
+ void saveUnqualifiedContext(Map<String, Object> insContext,Integer currentTable,Integer currentSampleId,Integer orderId,String sonLaboratory);
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欒繘璐ч獙璇�
+ * @param insOrderId
+ * @return
+ */
+ InsOrderFactoryVerify getFactoryVerify(Integer insOrderId);
+
+ /**
+ * 淇濆瓨鍘熸潗鏂欒繘璐ч獙璇�
+ * @param factoryVerify
+ * @return
+ */
+ boolean addFactoryVerify(InsOrderFactoryVerify factoryVerify);
+
+
+ /**
+ * 鐢熸垚pd涓存椂
+ * @param path
+ * @return
+ */
+ String wordToPdfTemp(String path);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderRatesService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderRatesService.java
new file mode 100644
index 0000000..1e3726f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderRatesService.java
@@ -0,0 +1,34 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.dto.SampleOrderDto;
+import com.ruoyi.inspect.dto.TemplateRateDto;
+import com.ruoyi.inspect.pojo.InsOrderRates;
+
+/**
+ * 璁㈠崟璐圭敤琛�
+ *
+ * @author zhuo
+ * @since 2025-02-28
+ */
+public interface InsOrderRatesService extends IService<InsOrderRates> {
+
+ /**
+ *
+ * @param page
+ * @param sampleOrderDto
+ * @return
+ */
+ IPage<SampleOrderDto> selectInsOrderRates(Page page, SampleOrderDto sampleOrderDto);
+
+ /**
+ * 鏌ヨ璁㈠崟璐圭敤璇︽儏锛堟ā鏉夸环鏍硷級
+ * @param page
+ * @param insOrderId
+ * @return
+ */
+ IPage<TemplateRateDto> selectTemplateRatesDetail(Page page, Integer insOrderId);
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderService.java
new file mode 100644
index 0000000..9677bf7
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderService.java
@@ -0,0 +1,144 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.basic.dto.InventoryDetailDTO;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.pojo.StandardProductList;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsSample;
+import com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct;
+import com.ruoyi.inspect.dto.*;
+import com.ruoyi.inspect.vo.InsOrderPrintingVo;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author gaoaoy
+ * @description 閽堝琛ㄣ�恑ns_order(妫�楠屼笅鍗�)銆戠殑鏁版嵁搴撴搷浣淪ervice
+ * @createDate 2024-03-12 16:17:55
+ */
+public interface InsOrderService extends IService<InsOrder> {
+
+ //鑾峰彇鍗曚綅妫�楠屼笅鍗曟暟鎹�
+ IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto);
+
+
+ //淇敼妫�楠屼笅鍗曟暟鎹�
+ int upInsOrder(Integer orderId,Integer sampleId, String appointed, Integer userId,String sonLaboratory);
+
+ int addInsOrder(List<SampleProductDto> list, InsOrder insOrder);
+
+ int addNewJuInsOrder(InsPlaceOrderDto insPlaceOrderDto);
+
+ Map<String, Object> getInsOrder(Integer id);
+
+ int upInsOrderOfState(InsOrder insOrder);
+
+ Map<String, Object> getInsOrderAndSample(Integer id, String laboratory);
+
+ IPage<SampleProductDto2> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, SampleProductDto2 sampleProductDto);
+
+
+ int updateStatus(Integer id);
+
+
+ // 鑾峰彇ifs搴撳瓨淇℃伅
+ void getIfsOrder(Map<String,Object> objectMap,Boolean isSplitOrder);
+
+ /**
+ * 淇敼璁㈠崟鍗曞彿
+ * @param insOrder
+ */
+ void updateEntrustCode(InsOrder insOrder);
+
+ List<InsUnqualifiedRetestProduct> getRetestResult(Integer insProductId);
+
+
+
+ void updateIfsInventoryQuantity(Long id);
+
+ /**
+ * 閾滄潗涓嬪崟
+ * @param list
+ * @param copperInsOrder
+ * @return
+ */
+ int addRawCopperOrder(List<SampleProductDto> list, CopperInsOrderDto copperInsOrder);
+
+ /**
+ * 淇敼濮旀墭缂栧彿
+ * @param insOrder
+ */
+ void updateOrderEntrustCode(InsOrder insOrder);
+
+
+ /**
+ * 淇敼妫�楠屼笅鍗曞唴瀹�
+ * @param insOrderUpdateDto
+ * @return
+ */
+ Boolean updateInsOrder(InsOrderUpdateDto insOrderUpdateDto);
+
+ /**
+ * 鎴愬搧鏍囩鎵撳嵃
+ * @param ids
+ * @return
+ */
+ List<InsOrderPrintingVo> labelOrderPrinting(List<Integer> ids);
+
+ /**
+ * 澶栬喘浜у搧鏍囩鎵撳嵃
+ * @param ids
+ * @return
+ */
+ List<InventoryDetailDTO> labelOutsideOrderPrinting(List<Integer> ids);
+
+ /**
+ * 鏍规嵁鏍峰搧id鏌ヨ妫�楠岄」鏍�
+ * @param insSampleId
+ * @return
+ */
+ List<StandardProductList> getProductTreeBySampleId(Integer insSampleId);
+
+ /**
+ * 娣诲姞閬楁紡鐨勬楠岄」
+ * @param omitOrderProductDto
+ * @return
+ */
+ boolean addOmitOrderProduct(OmitOrderProductDto omitOrderProductDto);
+
+ /**
+ * 鎴愬搧妫�楠屽崟瀵煎嚭
+ * @param sampleOrderDto
+ * @param response
+ */
+ void rawAllInsOrderExport(SampleOrderDto sampleOrderDto, HttpServletResponse response);
+
+ /**
+ * 淇敼鏍峰搧鍨嬪彿
+ * @param insSample
+ */
+ void updateSampleModel(InsSample insSample);
+
+ /**
+ * 鏌ヨ褰撳墠鏃堕棿鏄惁娌℃湁璇ユ娴嬮」鐨勬娊鏍疯鍒�
+ * @param sampleList
+ * @param insOrder
+ * @return
+ */
+ Result judgeNotSpotCheckOrder(List<SampleProductDto> sampleList, InsOrder insOrder);
+
+ /**
+ * 绉诲簱鎿嶄綔
+ * @param one
+ * @return
+ */
+ String moveRawMaterial(IfsInventoryQuantity one);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderStandardTemplateService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderStandardTemplateService.java
new file mode 100644
index 0000000..5ec6807
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderStandardTemplateService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.InsOrderStandardTemplate;
+
+/**
+ * 璁㈠崟鏍囧噯妯℃澘澶嶅埗
+ *
+ * @author zhuo
+ * @since 2024-11-05
+ */
+public interface InsOrderStandardTemplateService extends IService<InsOrderStandardTemplate> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderStateService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderStateService.java
new file mode 100644
index 0000000..318e631
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderStateService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.InsOrderState;
+
+/**
+ * 妫�楠屼换鍔$姸鎬�
+ *
+ * @author zhuo
+ * @since 2025-02-28
+ */
+public interface InsOrderStateService extends IService<InsOrderState> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderTemplateService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderTemplateService.java
new file mode 100644
index 0000000..3dc7f9f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderTemplateService.java
@@ -0,0 +1,24 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.InsOrderTemplate;
+import com.ruoyi.inspect.vo.InsOrderTemplateDetailVo;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_order_template銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-03-18 14:14:54
+*/
+public interface InsOrderTemplateService extends IService<InsOrderTemplate> {
+
+ int addInsOrderTemplate(InsOrderTemplate insOrderTemplate);
+
+ List<InsOrderTemplate> selectInsOrderTemplate(String company);
+
+ InsOrderTemplateDetailVo selectInsOrderTemplateById(Integer id);
+
+ int delInsOrderTemplate(Integer id);
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningDetailService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningDetailService.java
new file mode 100644
index 0000000..bdd2750
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningDetailService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.inspect.service;
+
+import com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 妫�楠岄」鍋忓樊棰勮璇︽儏琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author
+ * @since 2025-03-28 02:18:58
+ */
+public interface InsProductDeviationWarningDetailService extends IService<InsProductDeviationWarningDetail> {
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningService.java
new file mode 100644
index 0000000..f057fdd
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningService.java
@@ -0,0 +1,27 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.inspect.dto.InsProductDeviationWarningDto;
+import com.ruoyi.inspect.pojo.InsProductDeviationWarning;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 妫�楠岄」鍋忓樊棰勮涓昏〃 鏈嶅姟绫�
+ * </p>
+ *
+ * @author
+ * @since 2025-03-28 02:18:02
+ */
+public interface InsProductDeviationWarningService extends IService<InsProductDeviationWarning> {
+
+ /**
+ * 鏌ヨ棰勮鍒楄〃
+ * @param page
+ * @param deviationWarningDto
+ * @return
+ */
+ IPage<InsProductDeviationWarningDto> selectDeviationWarningPage(Page page, InsProductDeviationWarningDto deviationWarningDto);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductService.java
new file mode 100644
index 0000000..f0b55fb
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductService.java
@@ -0,0 +1,55 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.dto.InsProductBindingDto;
+import com.ruoyi.inspect.dto.WriteInspectionConditionDto;
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_product(妫�楠岄」鐩�)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-03-17 23:57:39
+*/
+public interface InsProductService extends IService<InsProduct> {
+
+ int selectOrderManDay(Integer orderId);
+
+ int updateInspected(Integer id,String ids);
+
+ boolean write(WriteInspectionConditionDto dto);
+
+ IPage<InsProduct> selectNoProducts(Page page, InsProduct insProduct, Integer orderId, String ids);
+
+ void checkUpdate(Integer orderId,Integer state);
+
+
+ /**
+ * 鏍规嵁妫�楠岄」id鏌ヨ妫�楠岄」鏍戜俊鎭�
+ * @param productId
+ * @return
+ */
+ List<InsProduct> getProductTreeByProductId(Integer productId);
+
+
+ /**
+ * 鐗规畩妫�楠岄」缁戝畾
+ * @param insProductBindingDto
+ * @return
+ */
+ boolean bindingProductTreeByProductId(InsProductBindingDto insProductBindingDto);
+
+ /**
+ * 鍒犻櫎鐗规畩妫�楠岄」缁戝畾淇℃伅
+ * @param productId
+ * @return
+ */
+ boolean removeBindingProductTree(Integer productId);
+
+ List<InsProduct> getRevocationInsProductList(Integer orderId);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsReportService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsReportService.java
new file mode 100644
index 0000000..1b9e75e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsReportService.java
@@ -0,0 +1,74 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.inspect.dto.ReportPageDto;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsReport;
+import org.springframework.web.multipart.MultipartFile;
+
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Map;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_report(妫�楠屾姤鍛�)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-03-17 22:10:02
+*/
+public interface InsReportService extends IService<InsReport> {
+
+ Map<String,Object> pageInsReport(Page page, ReportPageDto reportPageDto);
+
+ void wordToPdf(String path,String sealUrl, boolean isRawMater);
+
+ int inReport(String url, Integer id);
+
+ int upReportUrl(Integer id);
+
+ //鎻愪氦
+ int writeReport(Integer id, Integer userId, Integer submitUserId);
+
+ //瀹℃牳
+ int examineReport(Integer id, Integer isExamine, String examineTell, Integer userId);
+
+ //鎵瑰噯
+ int ratifyReport(Integer id, Integer isRatify, String ratifyTell);
+
+ int wordInsertUrl(Map<String, Object> map, String url);
+
+ String downAll(String ids);
+
+ /**
+ * 鍗曚唤鎶ュ憡 Word 涓嬭浇锛宺eportType锛�0妫�娴嬫姤鍛婏紝1妫�楠屾姤鍛婏紱createOrderUser 鐢ㄤ簬澶嶇敤鎶ュ憡缂栧埗鐨勬暟鎹寖鍥淬��
+ */
+ void download(Integer id, Integer reportType, Integer createOrderUser, HttpServletResponse response);
+
+ int upAll(MultipartFile file) throws IOException;
+
+ /**
+ *
+ * @param insOrder 妫�楠屽崟淇℃伅
+ * @param registerInsResults 鏄惁鐧昏妫�楠岀粨鏋�
+ * @param hasExemption 鏄惁鍏嶆
+ */
+ void isRawMaterial(InsOrder insOrder,Boolean registerInsResults,Boolean hasExemption);
+
+ Long getUnqualifiedCount(InsOrder insOrder);
+
+ /**
+ * 閫�鍥炲埌妫�楠屼换鍔�
+ * @param id
+ * @return
+ */
+ boolean sendBackTask(Integer id);
+
+ /**
+ * 鎶ュ憡瀵煎嚭
+ * @param dto
+ * @param response
+ */
+ void reportAllExport(ReportPageDto dto, HttpServletResponse response) throws UnsupportedEncodingException;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleReceiptService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleReceiptService.java
new file mode 100644
index 0000000..3571023
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleReceiptService.java
@@ -0,0 +1,24 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.dto.SampleReceiptActionDto;
+import com.ruoyi.inspect.dto.SampleReceiptPageDto;
+import com.ruoyi.inspect.dto.SampleReceiptQueryDto;
+import com.ruoyi.inspect.pojo.InsSampleReceipt;
+
+import jakarta.servlet.http.HttpServletResponse;
+
+public interface InsSampleReceiptService extends IService<InsSampleReceipt> {
+
+ IPage<SampleReceiptPageDto> page(Page<?> page, SampleReceiptQueryDto query);
+
+ SampleReceiptPageDto detail(Integer id);
+
+ void submit(SampleReceiptActionDto dto);
+
+ void reject(SampleReceiptActionDto dto);
+
+ void export(SampleReceiptQueryDto query, HttpServletResponse response);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleService.java
new file mode 100644
index 0000000..207effc
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleService.java
@@ -0,0 +1,21 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.InsSample;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_sample(妫�楠屾牱鍝�)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-03-14 17:14:57
+*/
+public interface InsSampleService extends IService<InsSample> {
+
+ /**
+ * 鏍规嵁璁㈠崟id鏌ヨ鏍峰搧
+ * @param insOrderId
+ * @return
+ */
+ List<InsSample> getSampleByOrderId(Integer insOrderId);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedHandlerFileService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedHandlerFileService.java
new file mode 100644
index 0000000..bd7d1e1
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedHandlerFileService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandlerFile;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑ns_unqualified_handler_file(涓嶅悎鏍煎鐞嗛檮浠惰褰曡〃)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-07-31 13:38:38
+*/
+public interface InsUnqualifiedHandlerFileService extends IService<InsUnqualifiedHandlerFile> {
+
+ InsUnqualifiedHandlerFile uploadFile(Long handlerId, MultipartFile file);
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedHandlerService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedHandlerService.java
new file mode 100644
index 0000000..7c38c0e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedHandlerService.java
@@ -0,0 +1,26 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.dto.UnqualifiedHandlerDto;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandler;
+import com.ruoyi.inspect.vo.UnqualifiedHandlerVO;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑ns_unqualified_handler(涓嶅悎鏍煎鐞嗚〃)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-07-31 13:38:14
+*/
+public interface InsUnqualifiedHandlerService extends IService<InsUnqualifiedHandler> {
+
+ IPage<UnqualifiedHandlerVO> pageList(Page page, UnqualifiedHandlerDto unqualifiedHandlerDto);
+
+ boolean addUnqualifiedHandler(UnqualifiedHandlerDto unqualifiedHandlerDto);
+
+ boolean updateUnqualifiedHandler(UnqualifiedHandlerDto unqualifiedHandlerDto);
+
+ UnqualifiedHandlerDto getUnqualifiedHandler(Integer id);
+
+ boolean deleteUnqualifiedHandler(Integer id);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedRetestProductService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedRetestProductService.java
new file mode 100644
index 0000000..6a13254
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsUnqualifiedRetestProductService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct;
+
+/**
+ * 涓嶅悎鏍兼楠岄」鐩娴�
+ *
+ * @author zhuo
+ * @since 2024-09-03
+ */
+public interface InsUnqualifiedRetestProductService extends IService<InsUnqualifiedRetestProduct> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/OutsourcingFinishProductInspectionService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/OutsourcingFinishProductInspectionService.java
new file mode 100644
index 0000000..efa78d6
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/OutsourcingFinishProductInspectionService.java
@@ -0,0 +1,38 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.IfsInventoryQuantityDto;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
+import org.springframework.stereotype.Component;
+
+@Component
+public interface OutsourcingFinishProductInspectionService {
+
+ /**
+ * 鎶ユ鏌ヨ
+ * @param page
+ * @param ifsInventoryQuantity
+ * @return
+ */
+ IPage<IfsInventoryQuantityVO> getWarehouseSubmit(Page page, IfsInventoryQuantity ifsInventoryQuantity);
+
+ /**
+ * 鏌ヨ宸叉楠�
+ * @param page
+ * @param ifsInventoryQuantityDto
+ * @return
+ */
+ IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto);
+
+ /**
+ * 鏌ヨ妫�楠屽��
+ * @param page
+ * @param ifsInventoryQuantityDto
+ * @return
+ */
+ IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto);
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderService.java
new file mode 100644
index 0000000..031d54f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderService.java
@@ -0,0 +1,161 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.IfsInventoryQuantityCheckDto;
+import com.ruoyi.basic.dto.IfsInventoryQuantityDto;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.inspect.dto.CopperInsOrderDto;
+import com.ruoyi.inspect.dto.OrderSplitDTO;
+import com.ruoyi.inspect.dto.SampleProductDto;
+import com.ruoyi.inspect.pojo.InsOrder;
+import org.springframework.web.multipart.MultipartFile;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
+/**
+ * @Author zhuo
+ * @Date 2024/7/31
+ */
+public interface RawMaterialOrderService {
+
+ Result selectStandardTreeListByPartNo(String partNo);
+
+ /**
+ * 鎶ユ鏌ヨ
+ * @param page
+ * @param ifsInventoryQuantity
+ * @return
+ */
+ IPage<IfsInventoryQuantityVO> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity);
+
+ /**
+ * 鏌ヨ妫�楠屽��
+ * @param page
+ * @param ifsInventoryQuantityDto
+ * @return
+ */
+ IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto);
+
+ int inspectionReport(List<Long> ids,String orderType,String materialProp);
+
+ int revokeInspectionReport(Long id);
+
+ List<IfsInventoryQuantityDto> printLabel(List<Integer> ids);
+
+ int inspectionReportOne(IfsInventoryQuantity ifsInventoryQuantity);
+
+ String getIndustryChain(Integer id);
+
+ /**
+ * 鍘熸潗鏂欐挙閿�涓嬪崟
+ * @param ifsInventoryId
+ * @return
+ */
+ boolean repealRawOrder(Long ifsInventoryId);
+
+ /**
+ * 娣诲姞鍏嶆璁㈠崟
+ * @param list
+ * @param insOrder
+ * @return
+ */
+ int addExemptionOrder(List<SampleProductDto> list, InsOrder insOrder);
+
+ IPage<IfsInventoryQuantityCheckDto> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, IfsInventoryQuantityCheckDto ifsInventoryQuantity);
+
+ /**
+ * 鏌ヨ宸叉楠�
+ * @param page
+ * @param ifsInventoryQuantityDto
+ * @return
+ */
+ IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto);
+
+ int delIfsInventory(Integer id);
+
+ /**
+ * 鍘熸潗鏂欐斁琛屽厤妫�
+ * @param ifsInventoryId
+ * @return
+ */
+ boolean rawOrderRelease(Long ifsInventoryId, String partDetail);
+
+ /**
+ * 鍘熸潗鏂欎笅鍗曢�氱煡鍏嶆鎴栬�呭娆℃楠�
+ * @param ifsInventoryId
+ * @return
+ */
+ int notificationRawOrder(Long ifsInventoryId);
+
+ /**
+ * 鎵嬪姩娣诲姞鍘熸潗淇℃伅
+ * @param ifsInventoryQuantity
+ */
+ void addIfsInventoryQuantity(IfsInventoryQuantity ifsInventoryQuantity);
+
+
+ /**
+ * 閾滃崟涓濅笅鍗曞厤妫�
+ * @param list
+ * @param copperInsOrder
+ */
+ int addRawCopperOrderExemptionOrder(List<SampleProductDto> list, CopperInsOrderDto copperInsOrder);
+
+ /**
+ * 璁╂u鏀捐
+ * @param ifsInventoryId
+ * @return
+ */
+ boolean concessionRelease(Long ifsInventoryId);
+
+ /**
+ * 鍘熸潗鏂欒繘鍘傛挙閿�涓嬪崟
+ * @param enterOrderId
+ * @return
+ */
+ boolean repealEnterRawOrder(Integer enterOrderId);
+
+ /**
+ * 鍘熸潗鏂欏搴︽挙閿�涓嬪崟
+ * @param quarterOrderId
+ * @return
+ */
+ boolean repealQuarterRawOrder(Integer quarterOrderId);
+
+ /**
+ * 鍘熸潗鏂欐姤妫�鍏ㄩ儴淇℃伅瀵煎嚭
+ * @param dto
+ * @param response
+ */
+ void rawAllExport(IfsInventoryQuantitySupplierDto dto, HttpServletResponse response) throws UnsupportedEncodingException;
+
+ /**
+ * 鍘熸潗鏂欐煡璇㈠彲浠ュ搴︽楠岀殑鍐呭
+ * @param page
+ * @param ifsInventoryQuantityDto
+ * @return
+ */
+ IPage<IfsInventoryQuantitySupplierDto> getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto);
+
+ /**
+ * advancedGodown
+ * @param ifsInventoryId
+ * @return
+ */
+ boolean advancedGodown(Long ifsInventoryId);
+
+ void downloadTemplate(HttpServletResponse response);
+
+ Result importSplitOrderData(MultipartFile file, Long ifsId, HttpServletRequest request);
+
+ boolean confirmSplitOrder(OrderSplitDTO orderSplitDTO);
+
+ Long getOrderCountByIfsId(Long ifsId);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderTemplateService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderTemplateService.java
new file mode 100644
index 0000000..0f3ee5b
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderTemplateService.java
@@ -0,0 +1,25 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.RawMaterialOrderTemplate;
+
+import java.util.List;
+
+/**
+ * 鍘熸潗鏂欎笅鍗曟ā鏉�
+ *
+ * @author zhuo
+ * @since 2024-08-05
+ */
+public interface RawMaterialOrderTemplateService extends IService<RawMaterialOrderTemplate> {
+
+ int addRawMaterOrderTemplate(RawMaterialOrderTemplate rawMaterialOrderTemplate);
+
+ List<RawMaterialOrderTemplate> selectRawMaterOrderTemplate(String partNo);
+
+ String selectRawMaterOrderTemplateById(Integer id);
+
+ int delRawMaterOrderTemplate(Integer id);
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/ReportService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/ReportService.java
new file mode 100644
index 0000000..57e2fc5
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/ReportService.java
@@ -0,0 +1,13 @@
+package com.ruoyi.inspect.service;
+
+import com.ruoyi.performance.dto.AuxiliaryAllDto;
+import com.ruoyi.performance.dto.AuxiliaryOriginalHoursLookDto;
+
+import java.util.Map;
+
+public interface ReportService {
+ //棣栭〉-->鏃ュ巻浠诲姟鍥�
+ Map<String, Object> calendarWorkByWeek();
+
+ AuxiliaryAllDto currentUserWorkHourCount(AuxiliaryOriginalHoursLookDto dto);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/SpotCheckQuarterItemService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/SpotCheckQuarterItemService.java
new file mode 100644
index 0000000..9490f3d
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/SpotCheckQuarterItemService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.SpotCheckQuarterItem;
+
+/**
+ * 瀛e害鎶芥牱璁″垝璇︽儏琛�
+ *
+ * @author zhuo
+ * @since 2024-10-09
+ */
+public interface SpotCheckQuarterItemService extends IService<SpotCheckQuarterItem> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/SpotCheckYearItemService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/SpotCheckYearItemService.java
new file mode 100644
index 0000000..c9086d0
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/SpotCheckYearItemService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.SpotCheckYearItem;
+
+/**
+ * 骞村害鎶芥牱璁″垝璇︽儏琛�
+ *
+ * @author zhuo
+ * @since 2024-10-10
+ */
+public interface SpotCheckYearItemService extends IService<SpotCheckYearItem> {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/WarehouseCellService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/WarehouseCellService.java
new file mode 100644
index 0000000..75f77b9
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/WarehouseCellService.java
@@ -0,0 +1,13 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.pojo.WarehouseCell;
+
+/**
+* @author z1292
+* @description 閽堝琛ㄣ�恮arehouse(浠撳簱)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-04-06 12:13:57
+*/
+public interface WarehouseCellService extends IService<WarehouseCell> {
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/WarehouseService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/WarehouseService.java
new file mode 100644
index 0000000..9b7db73
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/WarehouseService.java
@@ -0,0 +1,42 @@
+package com.ruoyi.inspect.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.inspect.dto.WarehouseCellAndSampleDto;
+import com.ruoyi.inspect.dto.WarehouseDto;
+import com.ruoyi.inspect.pojo.Warehouse;
+import com.ruoyi.inspect.pojo.WarehouseShelf;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+* @author z1292
+* @description 閽堝琛ㄣ�恮arehouse(浠撳簱)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-04-06 12:13:57
+*/
+public interface WarehouseService extends IService<Warehouse> {
+
+ int addWarehouse(Warehouse warehouse);
+
+ List<WarehouseDto> selectWarehouse();
+
+ int addShelf(WarehouseShelf warehouseShelf);
+
+ int delWarehouse(Integer id);
+
+ int upWarehouse(Warehouse warehouse);
+
+ int delShelf(Integer id);
+
+ int upShelf(WarehouseShelf warehouseShelf);
+
+ List<WarehouseCellAndSampleDto> getWarehouse(Integer shelfId);
+
+ int inWarehouse(String trees, String sampleCode);
+
+ int outWarehouse(String sampleCode);
+
+ Map<String, Object> getSampleRecord(Integer id);
+
+ int searchSampleId(String sampleCode);
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/DataAnalysisServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/DataAnalysisServiceImpl.java
new file mode 100644
index 0000000..33b9b28
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/DataAnalysisServiceImpl.java
@@ -0,0 +1,613 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.common.constant.InsOrderTypeConstants;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.DataAnalysisDto;
+import com.ruoyi.inspect.dto.SampleProductRawAnalysisDto;
+import com.ruoyi.inspect.mapper.DataAnalysisMapper;
+import com.ruoyi.inspect.mapper.InsProductMapper;
+import com.ruoyi.inspect.service.DataAnalysisService;
+import com.ruoyi.inspect.vo.DeviationAnalyzeVo;
+import com.ruoyi.inspect.vo.RawMaterialSupplierVo;
+import com.ruoyi.inspect.vo.RawProductAnalysisVo;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 鏁版嵁鍒嗘瀽
+ *
+ * @Author zhuo
+ * @Date 2024/10/16
+ */
+@Service
+@AllArgsConstructor
+public class DataAnalysisServiceImpl implements DataAnalysisService {
+
+ private DataAnalysisMapper dataAnalysisMapper;
+
+ private InsProductMapper insProductMapper;
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欐煴鐘剁粺璁�
+ * @return searchTime 鏃堕棿
+ * @return passRate 鍚堟牸鐜�
+ * @return sum 鎬绘暟
+ */
+ @Override
+ public List<Map<String, Object>> getRawPassRateByBarChart(DataAnalysisDto dataAnalysisDto) {
+ // 鏍煎紡鍖栧瓧娈�, 閬垮厤鎶ラ敊
+ this.formatDataAnalysisDto(dataAnalysisDto);
+ // 鑾峰彇褰撳墠鏃ユ湡
+ DateTime now = DateUtil.date();
+ if (StrUtil.isNotBlank(dataAnalysisDto.getBeginDate()) && StrUtil.isNotBlank(dataAnalysisDto.getEndDate())) {
+ return dataAnalysisMapper.getRawPassRateByBarChartByDay(dataAnalysisDto);
+ } else if (dataAnalysisDto.getDateType().equals("1")) {
+ // 鑾峰彇鏈懆鐨勫紑濮嬫椂闂达紙鍛ㄤ竴 00:00:00锛�
+ DateTime beginOfWeek = DateUtil.beginOfWeek(now);
+ // 鑾峰彇鏈懆鐨勭粨鏉熸椂闂达紙鍛ㄦ棩 23:59:59锛�
+ // 鑾峰彇鏈懆鐨勭粨鏉熸椂闂达紙鍛ㄦ棩 23:59:59锛�
+ DateTime endOfWeek = DateUtil.endOfWeek(now);
+ dataAnalysisDto.setBeginDate(DateUtil.format(beginOfWeek, "yyyy-MM-dd HH:mm:ss"));
+ dataAnalysisDto.setEndDate(DateUtil.format(endOfWeek, "yyyy-MM-dd HH:mm:ss"));
+ return dataAnalysisMapper.getRawPassRateByBarChartByWeek(dataAnalysisDto);
+ } else if (dataAnalysisDto.getDateType().equals("2")) {
+ // 鑾峰彇褰撳墠鏈堢殑寮�濮嬫椂闂达紙姣忔湀1鍙� 00:00:00锛�
+ DateTime beginOfMonth = DateUtil.beginOfMonth(now);
+ // 鑾峰彇褰撳墠鏈堢殑缁撴潫鏃堕棿锛堟湰鏈堟渶鍚庝竴澶� 23:59:59锛�
+ DateTime endOfMonth = DateUtil.endOfMonth(now);
+ dataAnalysisDto.setBeginDate(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss"));
+ dataAnalysisDto.setEndDate(DateUtil.format(endOfMonth, "yyyy-MM-dd HH:mm:ss"));
+ return dataAnalysisMapper.getRawPassRateByBarChartByDay(dataAnalysisDto);
+ } else if (dataAnalysisDto.getDateType().equals("3")) {
+ // 鑾峰彇褰撳墠骞寸殑寮�濮嬫椂闂达紙姣忓勾1鏈�1鏃� 00:00:00锛�
+ DateTime beginOfYear = DateUtil.beginOfYear(now);
+ // 鑾峰彇褰撳墠骞寸殑缁撴潫鏃堕棿锛堟瘡骞�12鏈�31鏃� 23:59:59锛�
+ DateTime endOfYear = DateUtil.endOfYear(now);
+ dataAnalysisDto.setBeginDate(DateUtil.format(beginOfYear, "yyyy-MM-dd HH:mm:ss"));
+ dataAnalysisDto.setEndDate(DateUtil.format(endOfYear, "yyyy-MM-dd HH:mm:ss"));
+ return dataAnalysisMapper.getRawPassRateByBarChartByYear(dataAnalysisDto);
+ }
+
+ return null;
+ }
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓ゼ鐘跺浘
+ * @param dataAnalysisDto
+ * @return
+ * sum : 鎬绘暟
+ * unQualified : 涓嶅悎鏍兼暟閲�
+ * qualified : 鍚堟牸鏁伴噺
+ * passRate : 鍚堟牸鐜�
+ */
+ @Override
+ public Map<String, Object> getRawPassRateByCake(DataAnalysisDto dataAnalysisDto) {
+ // 鏍煎紡鍖栧瓧娈�, 閬垮厤鎶ラ敊
+ this.formatDataAnalysisDto(dataAnalysisDto);
+ // 鑾峰彇褰撳墠鏃ユ湡
+ DateTime now = DateUtil.date();
+ if (StrUtil.isNotBlank(dataAnalysisDto.getBeginDate()) && StrUtil.isNotBlank(dataAnalysisDto.getEndDate())) {
+
+ } else if (dataAnalysisDto.getDateType().equals("1")) {
+ // 鑾峰彇鏈懆鐨勫紑濮嬫椂闂达紙鍛ㄤ竴 00:00:00锛�
+ DateTime beginOfWeek = DateUtil.beginOfWeek(now);
+ // 鑾峰彇鏈懆鐨勭粨鏉熸椂闂达紙鍛ㄦ棩 23:59:59锛�
+ DateTime endOfWeek = DateUtil.endOfWeek(now);
+ dataAnalysisDto.setBeginDate(DateUtil.format(beginOfWeek, "yyyy-MM-dd HH:mm:ss"));
+ dataAnalysisDto.setEndDate(DateUtil.format(endOfWeek, "yyyy-MM-dd HH:mm:ss"));
+ } else if (dataAnalysisDto.getDateType().equals("2")) {
+ // 鑾峰彇褰撳墠鏈堢殑寮�濮嬫椂闂达紙姣忔湀1鍙� 00:00:00锛�
+ DateTime beginOfMonth = DateUtil.beginOfMonth(now);
+ // 鑾峰彇褰撳墠鏈堢殑缁撴潫鏃堕棿锛堟湰鏈堟渶鍚庝竴澶� 23:59:59锛�
+ DateTime endOfMonth = DateUtil.endOfMonth(now);
+ dataAnalysisDto.setBeginDate(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss"));
+ dataAnalysisDto.setEndDate(DateUtil.format(endOfMonth, "yyyy-MM-dd HH:mm:ss"));
+ } else if (dataAnalysisDto.getDateType().equals("3")) {
+ // 鑾峰彇褰撳墠骞寸殑寮�濮嬫椂闂达紙姣忓勾1鏈�1鏃� 00:00:00锛�
+ DateTime beginOfYear = DateUtil.beginOfYear(now);
+ // 鑾峰彇褰撳墠骞寸殑缁撴潫鏃堕棿锛堟瘡骞�12鏈�31鏃� 23:59:59锛�
+ DateTime endOfYear = DateUtil.endOfYear(now);
+ dataAnalysisDto.setBeginDate(DateUtil.format(beginOfYear, "yyyy-MM-dd HH:mm:ss"));
+ dataAnalysisDto.setEndDate(DateUtil.format(endOfYear, "yyyy-MM-dd HH:mm:ss"));
+ }
+ return dataAnalysisMapper.getRawPassRateByCake(dataAnalysisDto);
+ }
+
+
+ /**
+ * 鏌ヨ妫�楠岄」鍚嶇О
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Override
+ public List<String> getRawItemNames(DataAnalysisDto dataAnalysisDto) {
+ // 鏍煎紡鍖栧瓧娈�, 閬垮厤鎶ラ敊
+ this.formatDataAnalysisDto(dataAnalysisDto);
+ List<IfsInventoryQuantitySupplierDto> analysisList = dataAnalysisMapper.getRawProductAnalysisAllSample(dataAnalysisDto);
+ // 鏍规嵁鏍峰搧id鏌ヨ妫�娴嬪弬鏁�
+ if (CollectionUtils.isEmpty(analysisList)) {
+ return null;
+ }
+ List<Integer> sampleIds = analysisList.stream().map(IfsInventoryQuantitySupplierDto::getSampleId).collect(Collectors.toList());
+ // 鏌ヨ妫�楠岄」鐩�
+
+ return insProductMapper.selectItemNameBySampleIds(sampleIds);
+ }
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欓」妫�鍒嗘瀽
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Override
+ public RawProductAnalysisVo getRawProductAnalysis(DataAnalysisDto dataAnalysisDto) {
+ // 鏍煎紡鍖栧瓧娈�, 閬垮厤鎶ラ敊
+ this.formatDataAnalysisDto(dataAnalysisDto);
+ List<IfsInventoryQuantitySupplierDto> analysisList = dataAnalysisMapper.getRawProductAnalysisAllSample(dataAnalysisDto);
+ // 鏍规嵁鏍峰搧id鏌ヨ妫�娴嬪弬鏁�
+ if (CollectionUtils.isEmpty(analysisList)) {
+ return null;
+ }
+ List<Integer> sampleIds = analysisList.stream().map(IfsInventoryQuantitySupplierDto::getSampleId).collect(Collectors.toList());
+ // 鏌ヨ妫�楠岄」鐩�
+ List<SampleProductRawAnalysisDto> sampleProductList = insProductMapper.selectListBySampleIds(sampleIds);
+
+ List<String> itemNames = new ArrayList<>();
+ if (CollectionUtils.isNotEmpty(dataAnalysisDto.getItemNames())) {
+ itemNames = dataAnalysisDto.getItemNames();
+ } else {
+ itemNames = insProductMapper.selectItemNameBySampleIds(sampleIds);
+ }
+
+ // 鏍规嵁鏍峰搧鍒嗙粍
+ List<Map<String, Object>> productList = new ArrayList<>();
+
+ Map<Integer, List<SampleProductRawAnalysisDto>> collect = sampleProductList.stream().collect(Collectors.groupingBy(SampleProductRawAnalysisDto::getInsSampleId));
+ List<String> finalItemNames = itemNames;
+ collect.forEach((integer, rawAnalysisDtos) -> {
+ // 妫�楠岄」鐩悕绉拌浆鎹㈡垚map
+ Map<String, Object> itemMap = new HashMap<>();
+ for (String itemName : finalItemNames) {
+ itemMap.put(itemName, null);
+ }
+ // 閬嶅巻妫�楠岄」
+ for (SampleProductRawAnalysisDto rawAnalysisDto : rawAnalysisDtos) {
+ itemMap.put(rawAnalysisDto.getInspectionItem(), rawAnalysisDto.getLastValue());
+ }
+ itemMap.put("product", rawAnalysisDtos.get(0).getSampleCode());
+ productList.add(itemMap);
+ });
+
+ RawProductAnalysisVo rawProductAnalysisVo = new RawProductAnalysisVo();
+ rawProductAnalysisVo.setItemNames(itemNames);
+ rawProductAnalysisVo.setProductList(productList);
+
+ return rawProductAnalysisVo;
+ }
+
+ /**
+ * 鏌ヨ妫�娴嬮」鍒嗘瀽鍒楄〃
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Override
+ public List<IfsInventoryQuantitySupplierDto> getRawProductAnalysisAllList(DataAnalysisDto dataAnalysisDto) {
+ // 鏍煎紡鍖栧瓧娈�, 閬垮厤鎶ラ敊
+ this.formatDataAnalysisDto(dataAnalysisDto);
+ return dataAnalysisMapper.getRawProductAnalysisList(dataAnalysisDto);
+ }
+
+ /**
+ * 鏌ヨ椤规鍒嗘瀽鍚堟牸鐜�
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Override
+ public RawProductAnalysisVo getRawProductAnalysisRawPass(DataAnalysisDto dataAnalysisDto) {
+ // 鏍煎紡鍖栧瓧娈�, 閬垮厤鎶ラ敊
+ this.formatDataAnalysisDto(dataAnalysisDto);
+ List<IfsInventoryQuantitySupplierDto> analysisList = dataAnalysisMapper.getRawProductAnalysisAllSample(dataAnalysisDto);
+ // 鏍规嵁鏍峰搧id鏌ヨ妫�娴嬪弬鏁�
+ if (CollectionUtils.isEmpty(analysisList)) {
+ return null;
+ }
+ List<Integer> sampleIds = analysisList.stream().map(IfsInventoryQuantitySupplierDto::getSampleId).collect(Collectors.toList());
+ // 鏌ヨ妫�楠岄」鐩�
+ List<SampleProductRawAnalysisDto> sampleProductList = insProductMapper.selectListBySampleIds(sampleIds);
+ List<String> itemNames = new ArrayList<>();
+ List<String> finalItemNames = itemNames;
+ if (CollectionUtils.isNotEmpty(dataAnalysisDto.getItemNames())) {
+ itemNames = dataAnalysisDto.getItemNames();
+ } else {
+ itemNames = insProductMapper.selectItemNameBySampleIds(sampleIds);
+ }
+ // 鍒嗙粍
+ List<Map<String, Object>> productList = new ArrayList<>();
+
+ Map<String, List<SampleProductRawAnalysisDto>> groupList = new HashMap<>();
+
+ switch (dataAnalysisDto.getGroupType()) {
+ case "0": // 榛樿鏍峰搧鍖哄垎
+ groupList = sampleProductList.stream()
+ .collect(Collectors.groupingBy(SampleProductRawAnalysisDto::getSample));
+
+ break;
+ case "1": // 鎵规鍙峰尯鍒�
+ groupList = sampleProductList.stream()
+ .collect(Collectors.groupingBy(SampleProductRawAnalysisDto::getUpdateBatchNo));
+
+ break;
+ case "2": // 鍘傚鍖哄垎
+ groupList = sampleProductList.stream()
+ .collect(Collectors.groupingBy(SampleProductRawAnalysisDto::getSupplierName));
+
+ break;
+ }
+
+ groupList.forEach((groupName, rawAnalysisDtos) -> {
+ // 鎸夌収妫�楠岄」鍖哄垎
+ // 妫�楠岄」鐩悕绉拌浆鎹㈡垚map
+ Map<String, Object> itemMap = new HashMap<>();
+
+ for (String itemName : finalItemNames) {
+ itemMap.put(itemName, null);
+ }
+
+ Map<String, List<SampleProductRawAnalysisDto>> groupItemList = rawAnalysisDtos.stream().collect(Collectors.groupingBy(SampleProductRawAnalysisDto::getInspectionItem));
+
+
+ groupItemList.forEach((itemName, dtos) -> {
+ // 缁熻鍚堟牸鎬绘暟
+ long qualifiedCount = dtos.stream()
+ .filter(dto -> dto.getInsResult() != null && dto.getInsResult().equals(1))
+ .count();
+ long totalCount = dtos.size();
+ BigDecimal passRate = new BigDecimal(qualifiedCount).divide(new BigDecimal(totalCount), 4, RoundingMode.HALF_UP)
+ .multiply(new BigDecimal(100))
+ .setScale(2, RoundingMode.HALF_UP);
+ itemMap.put(itemName, passRate);
+ });
+
+ itemMap.put("product", groupName);
+ productList.add(itemMap);
+ });
+
+
+ RawProductAnalysisVo rawProductAnalysisVo = new RawProductAnalysisVo();
+ rawProductAnalysisVo.setItemNames(itemNames);
+ rawProductAnalysisVo.setProductList(productList);
+
+ return rawProductAnalysisVo;
+ }
+
+ @Override
+ public DeviationAnalyzeVo getRawSupplierCompare(DataAnalysisDto dataAnalysisDto) {
+ // 鍒ゆ柇璁㈠崟id鏄惁鏈変簲涓�
+ if (CollectionUtils.isEmpty(dataAnalysisDto.getOrderIds()) || dataAnalysisDto.getOrderIds().size() != 5) {
+ throw new ErrorException("璇烽�夋嫨浜旀潯鏁版嵁");
+ }
+ if (CollectionUtils.isEmpty(dataAnalysisDto.getItemNames()) || dataAnalysisDto.getItemNames().size() != 1) {
+ throw new ErrorException("璇烽�夋嫨涓�涓楠岄」妫�楠岄」");
+ }
+ if (CollectionUtils.isNotEmpty(dataAnalysisDto.getSupplierDataList())) {
+ if (dataAnalysisDto.getSupplierDataList().size() != 5) {
+ throw new ErrorException("鍘傚鏁版嵁璇疯緭鍏ュ畬鏁�5鏉�");
+ }
+ }
+
+ List<RawMaterialSupplierVo> rawMaterialSupplierVoList = dataAnalysisMapper.getItemValueByOrderIds(dataAnalysisDto.getOrderIds(), dataAnalysisDto.getItemNames().get(0));
+ // 鍒ゆ柇鍘傚鏉愭枡鍚嶇О瑙勬牸鍨嬪彿鏄惁鏄竴鏍风殑
+ RawMaterialSupplierVo rawMaterialSupplierVo = rawMaterialSupplierVoList.get(0);
+ for (RawMaterialSupplierVo materialSupplierVo : rawMaterialSupplierVoList) {
+ if (!materialSupplierVo.getSupplierName().equals(rawMaterialSupplierVo.getSupplierName()) ||
+ !materialSupplierVo.getSample().equals(rawMaterialSupplierVo.getSample()) ||
+ !materialSupplierVo.getModel().equals(rawMaterialSupplierVo.getModel())) {
+ throw new ErrorException("閫夋嫨鐨勬楠屼俊鎭笉鍖归厤");
+ }
+ }
+
+ List<String> lastValues = rawMaterialSupplierVoList.stream().map(RawMaterialSupplierVo::getLastValue).collect(Collectors.toList());
+
+ // 璁$畻鏈湴鏁版嵁
+ Map<String, List<Object>> localData = dataCompute(lastValues);
+
+
+ DeviationAnalyzeVo deviationAnalyzeVo = new DeviationAnalyzeVo();
+ deviationAnalyzeVo.setLocalData(localData.get("data"));
+ deviationAnalyzeVo.setLocalULC(localData.get("uclData"));
+ deviationAnalyzeVo.setLocalLCL(localData.get("lclData"));
+ deviationAnalyzeVo.setLocalAverage(localData.get("averageData"));
+ deviationAnalyzeVo.setLocalRange(localData.get("rangeData"));
+
+
+ // 鍒ゆ柇鏄惁鏈夊巶瀹舵暟鎹�
+ if (CollectionUtils.isNotEmpty(dataAnalysisDto.getSupplierDataList())) {
+ List<String> supplierValues = dataAnalysisDto.getSupplierDataList();
+ List<Object> absoluteDeviation = new ArrayList<>();
+ List<Object> averageList = new ArrayList<>();
+
+ for (int i = 0; i < lastValues.size(); i++) {
+ // 鍒ゆ柇鏈夊�兼槸鍚︿负绌�
+ if (StringUtils.isNotBlank(lastValues.get(i)) ||
+ StringUtils.isNotBlank(supplierValues.get(i))) {
+ BigDecimal laseValue = new BigDecimal(lastValues.get(i));
+ BigDecimal supplierValue = new BigDecimal(supplierValues.get(i));
+
+ // 璁$畻 (B3 - B2)
+ BigDecimal result = laseValue.subtract(supplierValue)
+ .divide(laseValue, 10, RoundingMode.HALF_UP)
+ .abs()
+ .setScale(2, RoundingMode.HALF_UP);
+
+ absoluteDeviation.add(result);
+ } else {
+ absoluteDeviation.add(null);
+ }
+ }
+ // 璁$畻骞冲潎鍊�
+ List<String> stringList = absoluteDeviation.stream()
+ .map(obj -> obj == null ? "null" : obj.toString())
+ .collect(Collectors.toList());
+ BigDecimal average = computeAverage(stringList);
+ absoluteDeviation.add(average);
+ for (int i = 0; i < 5; i++) {
+ averageList.add(average);
+ }
+
+ // 璁$畻鍘傚鏁版嵁
+ Map<String, List<Object>> supplierData = dataCompute(supplierValues);
+ deviationAnalyzeVo.setSupplierData(supplierData.get("data"));
+ deviationAnalyzeVo.setSupplierULC(supplierData.get("uclData"));
+ deviationAnalyzeVo.setSupplierLCL(supplierData.get("lclData"));
+ deviationAnalyzeVo.setSupplierAverage(supplierData.get("averageData"));
+ deviationAnalyzeVo.setSupplierRange(supplierData.get("rangeData"));
+ deviationAnalyzeVo.setAbsoluteDeviation(absoluteDeviation);
+ deviationAnalyzeVo.setAverage(averageList);
+ }
+
+
+ return deviationAnalyzeVo;
+ }
+
+ /**
+ * 鏌ヨ鏈湀涓庝笂鏈堝悎鏍肩巼瀵规瘮
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Override
+ public List<Map<String, Object>> getRawUpMonth(DataAnalysisDto dataAnalysisDto) {
+ return dataAnalysisMapper.getRawUpMonth();
+ }
+
+ /**
+ * 鏌ヨ妫�楠岄」绫诲瀷楗煎浘
+ * @param dataAnalysisDto
+ * @return
+ */
+ @Override
+ public Map<String, Object> getOrderTypeCookie(DataAnalysisDto dataAnalysisDto) {
+ return dataAnalysisMapper.getOrderTypeCookie();
+ }
+
+ /**
+ * 璁$畻杩斿洖鏁版嵁
+ * @param lastValues
+ * @return
+ */
+ private static Map<String, List<Object>> dataCompute(List<String> lastValues) {
+ // 骞冲潎鍊�
+ BigDecimal average = computeAverage(lastValues);
+
+ // 鏍囧噯鍋忓樊
+ BigDecimal standardDeviation = computeStandardDeviation(lastValues);
+
+ // 鐩稿鍋忓樊
+ BigDecimal relativeDeviation = standardDeviation.divide(average, 2, RoundingMode.HALF_UP);
+
+ // 骞冲潎鐩稿鍋忓樊
+ BigDecimal sqrt5 = BigDecimal.valueOf(Math.sqrt(5));
+ BigDecimal averageRelativeDeviation = standardDeviation.divide(sqrt5, 2, RoundingMode.HALF_UP);
+
+ // ucl
+ BigDecimal ucl = average.add(new BigDecimal("3").multiply(standardDeviation)).setScale(2, RoundingMode.HALF_UP);
+
+ // lcl
+ BigDecimal lcl = average.subtract(new BigDecimal("3").multiply(standardDeviation)).setScale(2, RoundingMode.HALF_UP);
+
+ // 鏋佸樊
+ BigDecimal range = computeRange(lastValues);
+
+ // 鏁版嵁鎷兼帴
+ // 妫�娴嬫暟鎹�
+ List<Object> data = new ArrayList<>();
+ for (String lastValue : lastValues) {
+ data.add(lastValue);
+ }
+ data.add(average);
+ data.add(standardDeviation);
+ data.add(relativeDeviation);
+ data.add(averageRelativeDeviation);
+
+ //ucl
+ List<Object> uclData = new ArrayList<>();
+
+ //lcl
+ List<Object> lclData = new ArrayList<>();
+
+ //骞冲潎鍊�
+ List<Object> averageData = new ArrayList<>();
+
+ //鏋佸樊
+ List<Object> rangeData = new ArrayList<>();
+ for (int i = 0; i < 5; i++) {
+ uclData.add(ucl);
+ lclData.add(lcl);
+ averageData.add(average);
+ rangeData.add(range);
+ }
+ Map<String, List<Object>> map = new HashMap<>();
+ map.put("data", data);
+ map.put("uclData", uclData);
+ map.put("lclData", lclData);
+ map.put("averageData", averageData);
+ map.put("rangeData", rangeData);
+
+ return map;
+ }
+
+
+ /**
+ * 璁$畻鏋佸樊
+ * @param lastValues
+ * @return
+ */
+ public static BigDecimal computeRange(List<String> lastValues) {
+ int count = 0;
+
+ BigDecimal min = null;
+ BigDecimal max = null;
+
+ for (String value : lastValues) {
+ if (StrUtil.isNotBlank(value)) {
+ BigDecimal bigDecimalValue = new BigDecimal(value);
+
+ if (min == null || bigDecimalValue.compareTo(min) < 0) {
+ min = bigDecimalValue;
+ }
+
+ if (max == null || bigDecimalValue.compareTo(max) > 0) {
+ max = bigDecimalValue;
+ }
+ count++;
+ }
+
+ }
+
+ if (count == 0 || min == null || max == null) {
+ return BigDecimal.ZERO;
+ }
+
+ BigDecimal range = max.subtract(min);
+
+ return range.setScale(2, RoundingMode.HALF_UP);
+ }
+
+ /**
+ * 璁$畻骞冲潎鍊�
+ * @param values
+ * @return
+ */
+ private static BigDecimal computeAverage(List<String> values) {
+ BigDecimal sum = BigDecimal.ZERO;
+ int count = 0;
+
+ for (String value : values) {
+ if (StrUtil.isNotBlank(value)) {
+
+ BigDecimal number = new BigDecimal(value);
+ sum = sum.add(number);
+ count++;
+
+ }
+ }
+
+ return count == 0 ? BigDecimal.ZERO : sum.divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
+ }
+
+ /**
+ * 璁$畻鏍囧噯鍋忓樊
+ * @return
+ */
+ private static BigDecimal computeStandardDeviation(List<String> lastValues) {
+ int count = 0;
+
+ // 灏嗗瓧绗︿覆杞崲涓� BigDecimal 鍒楄〃
+ List<BigDecimal> values = new ArrayList<>();
+ for (String value : lastValues) {
+ if (StrUtil.isNotBlank(value)) {
+ values.add(new BigDecimal(value));
+ count++;
+ }
+ }
+
+ if (count == 0) {
+ return BigDecimal.ZERO;
+ }
+
+ // 璁$畻骞冲潎鍊�
+ BigDecimal sum = BigDecimal.ZERO;
+ for (BigDecimal value : values) {
+ sum = sum.add(value);
+ }
+ BigDecimal mean = sum.divide(new BigDecimal(values.size()), MathContext.DECIMAL128);
+
+ // 璁$畻姣忎釜鏁板�间笌骞冲潎鍊肩殑宸殑骞虫柟
+ BigDecimal squaredDifferenceSum = BigDecimal.ZERO;
+ for (BigDecimal value : values) {
+ BigDecimal difference = value.subtract(mean);
+ BigDecimal squaredDifference = difference.multiply(difference);
+ squaredDifferenceSum = squaredDifferenceSum.add(squaredDifference);
+ }
+
+ // 璁$畻鏍囧噯宸紝娉ㄦ剰杩欓噷浣跨敤鐨勬槸鏍锋湰鏍囧噯宸绠楀叕寮�
+ BigDecimal variance = squaredDifferenceSum.divide(new BigDecimal(values.size() - 1), MathContext.DECIMAL128);
+ BigDecimal stddev = sqrt(variance);
+
+ // 淇濈暀涓や綅灏忔暟
+ return stddev.setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private static BigDecimal sqrt(BigDecimal value) {
+ // 浣跨敤 Heron's method 璁$畻骞虫柟鏍�
+ BigDecimal x = value;
+ BigDecimal tolerance = new BigDecimal("1E-10");
+ BigDecimal guess = value.divide(BigDecimal.valueOf(2), MathContext.DECIMAL128);
+
+ while (x.subtract(guess).abs().compareTo(tolerance) > 0) {
+ x = guess;
+ guess = x.add(value.divide(x, MathContext.DECIMAL128)).divide(new BigDecimal("2"), MathContext.DECIMAL128);
+ }
+
+ return guess;
+ }
+
+ /**
+ * *****鏍煎紡鍖栧瓧娈�****
+ * @param dataAnalysisDto
+ */
+ private void formatDataAnalysisDto(DataAnalysisDto dataAnalysisDto) {
+ // 鏍煎紡璇濆瓧娈�, 閬垮厤鎶ラ敊
+ if (StrUtil.isBlank(dataAnalysisDto.getOrderType())) {
+ dataAnalysisDto.setOrderType("1");
+ }
+ if (dataAnalysisDto.getOrderType().equals("2")) {
+ // 瀛e害妫�楠�
+ dataAnalysisDto.setOrderType(InsOrderTypeConstants.QUARTERLY_TEST);
+ } else {
+ // 杩涘巶妫�楠�
+ dataAnalysisDto.setOrderType(InsOrderTypeConstants.ENTER_THE_FACTORY);
+ }
+ if (StrUtil.isBlank(dataAnalysisDto.getDateType())) {
+ dataAnalysisDto.setDateType("1");
+ }
+ if (StrUtil.isBlank(dataAnalysisDto.getGroupType())) {
+ dataAnalysisDto.setGroupType("0");
+ }
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java
new file mode 100644
index 0000000..207ca01
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java
@@ -0,0 +1,677 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.config.Configure;
+import com.deepoove.poi.config.ConfigureBuilder;
+import com.deepoove.poi.data.Pictures;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.utils.DateImageUtil;
+import com.ruoyi.common.utils.api.IfsApiUtils;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.IfsStockQueryDTO;
+import com.ruoyi.inspect.dto.SpotCheckQuarterDto;
+import com.ruoyi.inspect.dto.SpotCheckYearDto;
+import com.ruoyi.inspect.mapper.SpotCheckQuarterMapper;
+import com.ruoyi.inspect.mapper.SpotCheckYearMapper;
+import com.ruoyi.inspect.pojo.SpotCheckQuarter;
+import com.ruoyi.inspect.pojo.SpotCheckQuarterItem;
+import com.ruoyi.inspect.pojo.SpotCheckYear;
+import com.ruoyi.inspect.pojo.SpotCheckYearItem;
+import com.ruoyi.inspect.service.FinishProductSpotCheckService;
+import com.ruoyi.inspect.service.SpotCheckQuarterItemService;
+import com.ruoyi.inspect.service.SpotCheckYearItemService;
+import com.ruoyi.system.mapper.UserMapper;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 鎴愬搧鎶芥牱
+ *
+ * @Author zhuo
+ * @Date 2024/9/29
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class FinishProductSpotCheckServiceImpl implements FinishProductSpotCheckService {
+
+ @Resource
+ private IfsApiUtils ifsApiUtils;
+ @Resource
+ private SpotCheckQuarterMapper spotCheckQuarterMapper;
+ @Resource
+ private SpotCheckQuarterItemService spotCheckQuarterItemService;
+ @Resource
+ private SpotCheckYearMapper spotCheckYearMapper;
+ @Resource
+ private SpotCheckYearItemService spotCheckYearItemService;
+ @Value("${wordUrl}")
+ private String wordUrl;
+ @Value("${file.path}")
+ private String imgUrl;
+ @Resource
+ private UserMapper userMapper;
+
+
+ public Result getIfsStockReport(IfsStockQueryDTO ifsStockQueryDTO) {
+ JSONObject jresult = new JSONObject();
+ jresult.put("count", 0);
+ jresult.put("data", new JSONArray());
+ JSONObject jsonObject = new JSONObject();
+ generateIfsStockQueryParams(jsonObject, ifsStockQueryDTO, ifsStockQueryDTO.getPage(), ifsStockQueryDTO.getLimit());
+ Result result = ifsApiUtils.getIfsStock(jsonObject.toJSONString());
+ if (result.getCode() == 200) {
+ JSONObject data = (JSONObject) JSON.toJSON(result.getData());
+ JSONArray array = new JSONArray();
+ for (int i = 0; i < data.getJSONArray("LIST_INFO").size(); i++) {
+ JSONObject listInfo = data.getJSONArray("LIST_INFO").getJSONObject(i);
+ array.add(listInfo);
+ }
+ //鑾峰彇鎬绘暟閲�
+ int count = data.getIntValue("TOTAL_RECORD");
+ jresult.put("count", count);
+ jresult.put("data", array);
+ }
+ return Result.success(jresult);
+ }
+
+ public void generateIfsStockQueryParams(JSONObject result, IfsStockQueryDTO ifsStockQueryDTO, Long pageNo, Long pageSize) {
+ result.put("PAGE", pageNo);
+ result.put("LIMIT", pageSize);
+ result.put("WAREHOUSE", "鎴愬搧浠撳簱");
+ result.put("QUANTITY_FLAG", ">0");
+ //琛ㄩ噷闈㈢殑OTC琛屽彿
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getCotcOrderNo())) {
+ result.put("C_OTC_ORDER_NO", ifsStockQueryDTO.getCotcOrderNo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getCotcLineNo())) {
+ result.put("C_OTC_LINE_NO", ifsStockQueryDTO.getCotcLineNo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getPartNo())) {
+ result.put("PART_NO", ifsStockQueryDTO.getPartNo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getPartDescription())) {
+ result.put("PART_DESC", "%" + ifsStockQueryDTO.getPartDescription() + "%");
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getLocNo())) {
+ result.put("LOCATION_NO", ifsStockQueryDTO.getLocNo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getLocDesc())) {
+ result.put("LOCATION_DESC", ifsStockQueryDTO.getLocDesc());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getLotBatchNo())) {
+ result.put("LOT_BATCH_NO", ifsStockQueryDTO.getLotBatchNo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getWdrNo())) {
+ result.put("WDR_NO", ifsStockQueryDTO.getWdrNo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getWarehouse())) {
+ result.put("WAREHOUSE", ifsStockQueryDTO.getWarehouse());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getLocationGroup())) {
+ result.put("LOCATION_GROUP", ifsStockQueryDTO.getLocationGroup());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getLocationGroupDesc())) {
+ result.put("LOCATION_GROUP_DESC", ifsStockQueryDTO.getLocationGroupDesc());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getReelNumber())) {
+ result.put("ATTR1", ifsStockQueryDTO.getReelNumber());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getStartMeter())) {
+ result.put("ATTR2", ifsStockQueryDTO.getStartMeter());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getEndMeter())) {
+ result.put("ATTR3", ifsStockQueryDTO.getEndMeter());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getOuterColor())) {
+ result.put("ATTR4", ifsStockQueryDTO.getOuterColor());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getInsulationColor())) {
+ result.put("ATTR5", ifsStockQueryDTO.getInsulationColor());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getOtcOrderNo())) {
+ result.put("ATTR6", ifsStockQueryDTO.getOtcOrderNo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getMpsNo())) {
+ result.put("ATTR7", ifsStockQueryDTO.getMpsNo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getLetteringInfo())) {
+ result.put("ATTR8", ifsStockQueryDTO.getLetteringInfo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getSStockQuantity())) {
+ result.put("ATTR9", ifsStockQueryDTO.getSStockQuantity());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getSAvailableStockQuantity())) {
+ result.put("ATTR10", ifsStockQueryDTO.getSAvailableStockQuantity());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getSunit())) {
+ result.put("ATTR11", ifsStockQueryDTO.getSunit());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getStockSource())) {
+ result.put("ATTR12", ifsStockQueryDTO.getStockSource());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getInspInstorageTime())) {
+ result.put("ATTR13", ifsStockQueryDTO.getInspInstorageTime());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getTestRemark())) {
+ result.put("ATTR14", ifsStockQueryDTO.getTestRemark());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getGrossWeight())) {
+ result.put("ATTR15", ifsStockQueryDTO.getGrossWeight());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getNetWeight())) {
+ result.put("ATTR16", ifsStockQueryDTO.getNetWeight());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getPackingManner())) {
+ result.put("ATTR17", ifsStockQueryDTO.getPackingManner());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getCylinderNumber())) {
+ result.put("ATTR18", ifsStockQueryDTO.getCylinderNumber());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getRemark())) {
+ result.put("ATTR19", ifsStockQueryDTO.getRemark());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getLengthRequirement())) {
+ result.put("ATTR20", ifsStockQueryDTO.getLengthRequirement());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getCustomerName())) {
+ result.put("ATTR21", ifsStockQueryDTO.getCustomerName());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getSystemNo())) {
+ result.put("ATTR22", ifsStockQueryDTO.getSystemNo());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getInSource())) {
+ result.put("ATTR23", ifsStockQueryDTO.getInSource());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getSplitQuality())) {
+ result.put("ATTR24", ifsStockQueryDTO.getSplitQuality());
+ }
+ if (StrUtil.isNotBlank(ifsStockQueryDTO.getReserveQuantity())) {
+ result.put("QTY_RESERVED", ifsStockQueryDTO.getReserveQuantity());
+ }
+ }
+
+ /************************************************* 瀛e害鎶芥牱 ***********************************************************/
+
+ /**
+ * 鏂板瀛e害鎶芥
+ * @param spotCheckQuarterDto
+ * @return
+ */
+ @Override
+ public boolean addQuarter(SpotCheckQuarterDto spotCheckQuarterDto) {
+ // 鏍规嵁缂栧彿鏌ヨ涔嬪墠鐨�
+ SpotCheckQuarter spotCheckQuarter = spotCheckQuarterMapper.selectOne(Wrappers.<SpotCheckQuarter>lambdaQuery()
+ .eq(SpotCheckQuarter::getQuarterNo, spotCheckQuarterDto.getQuarterNo())
+ .orderByDesc(SpotCheckQuarter::getCreateTime)
+ .last("limit 1"));
+ if (spotCheckQuarter == null) {
+ spotCheckQuarterMapper.insert(spotCheckQuarterDto);
+ // 娣诲姞璇︽儏
+ for (SpotCheckQuarterItem quarterItem : spotCheckQuarterDto.getQuarterItems()) {
+ quarterItem.setQuarterId(spotCheckQuarterDto.getQuarterId());
+ }
+ spotCheckQuarterItemService.saveBatch(spotCheckQuarterDto.getQuarterItems());
+ } else {
+ // 绱姞璇︽儏
+ for (SpotCheckQuarterItem quarterItem : spotCheckQuarterDto.getQuarterItems()) {
+ quarterItem.setQuarterId(spotCheckQuarter.getQuarterId());
+ }
+ spotCheckQuarterItemService.saveBatch(spotCheckQuarterDto.getQuarterItems());
+ }
+
+ return true;
+ }
+
+ /**
+ * 鏌ヨ瀛e害鎶芥牱璇︽儏
+ * @param quarterId
+ * @return
+ */
+ @Override
+ public SpotCheckQuarterDto getQuarter(Integer quarterId) {
+ SpotCheckQuarter spotCheckQuarter = spotCheckQuarterMapper.selectById(quarterId);
+
+ // 鏌ヨ璇︽儏
+ List<SpotCheckQuarterItem> list = spotCheckQuarterItemService.list(Wrappers.<SpotCheckQuarterItem>lambdaQuery()
+ .eq(SpotCheckQuarterItem::getQuarterId, spotCheckQuarter.getQuarterId()));
+ SpotCheckQuarterDto spotCheckQuarterDto = new SpotCheckQuarterDto();
+ BeanUtil.copyProperties(spotCheckQuarter, spotCheckQuarterDto);
+ spotCheckQuarterDto.setQuarterItems(list);
+
+ return spotCheckQuarterDto;
+ }
+
+ /**
+ * 瀛e害鎶芥牱鍒嗛〉鏌ヨ
+ * @param page
+ * @param spotCheckQuarter
+ * @return
+ */
+ @Override
+ public IPage<SpotCheckQuarterDto> getQuarterPage(Page page, SpotCheckQuarterDto spotCheckQuarter) {
+ return spotCheckQuarterMapper.getQuarterPage(page, QueryWrappers.queryWrappers(spotCheckQuarter));
+ }
+
+ /**
+ * 鍒犻櫎瀛e害鎶芥牱
+ * @param quarterId
+ * @return
+ */
+ @Override
+ public boolean deleteQuarter(Integer quarterId) {
+ spotCheckQuarterMapper.deleteById(quarterId);
+ spotCheckQuarterItemService.remove(Wrappers.<SpotCheckQuarterItem>lambdaQuery()
+ .eq(SpotCheckQuarterItem::getQuarterId, quarterId));
+ return true;
+ }
+
+ /**
+ * 鎴愬搧涓嬪崟鐣岄潰鏌ヨ瀛e害淇℃伅
+ * @return
+ */
+ @Override
+ public List<Map<String, Object>> getQuarterOnOrder() {
+ List<Map<String, Object>> quarterOnOrder = spotCheckQuarterMapper.getQuarterOnOrder();
+ for (Map<String, Object> stringMap : quarterOnOrder) {
+ List<SpotCheckQuarterItem> list = spotCheckQuarterItemService.list(Wrappers.<SpotCheckQuarterItem>lambdaQuery()
+ .eq(SpotCheckQuarterItem::getQuarterId, (Integer) stringMap.get("value")));
+ List<Map<String, Object>> itemMaps = list.stream().map(spotCheckQuarterItem -> {
+ Map<String, Object> map = new HashMap<>();
+ map.put("value", spotCheckQuarterItem.getQuarterItemId());
+ map.put("label", spotCheckQuarterItem.getProductModel() + " "
+ + spotCheckQuarterItem.getProductType() + " "
+ + spotCheckQuarterItem.getSpotCheckNumber());
+ return map;
+ }).collect(Collectors.toList());
+ stringMap.put("children", itemMaps);
+
+ }
+
+ return quarterOnOrder;
+ }
+
+ /**
+ * 淇敼瀛e害妫�楠�
+ * @param spotCheckQuarterDto
+ * @return
+ */
+ @Override
+ public boolean updateQuarterOnOrder(SpotCheckQuarterDto spotCheckQuarterDto) {
+ if (CollectionUtils.isNotEmpty(spotCheckQuarterDto.getQuarterItems())) {
+ // 娓呴櫎涔嬪墠璇︽儏
+ spotCheckQuarterItemService.remove(Wrappers.<SpotCheckQuarterItem>lambdaQuery()
+ .eq(SpotCheckQuarterItem::getQuarterId, spotCheckQuarterDto.getQuarterId()));
+ // 娣诲姞璇︽儏
+ for (SpotCheckQuarterItem quarterItem : spotCheckQuarterDto.getQuarterItems()) {
+ quarterItem.setQuarterId(spotCheckQuarterDto.getQuarterId());
+ }
+ spotCheckQuarterItemService.saveBatch(spotCheckQuarterDto.getQuarterItems());
+ }
+
+ spotCheckQuarterMapper.updateById(spotCheckQuarterDto);
+ return true;
+ }
+
+ /**
+ * 鐢熸垚鏈�缁堟姤鍛�
+ * @param quarterId
+ * @return
+ */
+ @Override
+ public boolean finalReportQuarter(Integer quarterId, HttpServletResponse response) {
+ // 娣诲姞鎶ュ憡淇℃伅
+ SpotCheckQuarter spotCheckQuarter = spotCheckQuarterMapper.selectById(quarterId);
+
+ // 鏌ヨ璇︽儏
+ List<SpotCheckQuarterItem> itemList = spotCheckQuarterItemService.list(Wrappers.<SpotCheckQuarterItem>lambdaQuery()
+ .eq(SpotCheckQuarterItem::getQuarterId, spotCheckQuarter.getQuarterId()));
+
+ for (SpotCheckQuarterItem spotCheckQuarterItem : itemList) {
+ // 鎷兼帴鍨嬪彿鍜屾暟閲�
+ spotCheckQuarterItem.setSpotCheckNumber((StringUtils.isBlank(spotCheckQuarterItem.getProductModel()) ? "" : spotCheckQuarterItem.getProductModel()) +
+ (StringUtils.isBlank(spotCheckQuarterItem.getSpotCheckNumber()) ? "" : spotCheckQuarterItem.getSpotCheckNumber()));
+ }
+
+ //缂栧埗浜�
+ String writeUrl = null;
+ if (spotCheckQuarter.getWriteUser() != null) {
+ try {
+ writeUrl = userMapper.selectById(spotCheckQuarter.getWriteUser()).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+ if (StrUtil.isBlank(writeUrl)) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+ }
+
+ // 鍒濆鍖栨墍鏈夌殑 countersignUrl 鍙橀噺
+ String[] countersignUrls = new String[7];
+
+ // 濡傛灉 spotCheckQuarter.getCountersignUser() 涓嶆槸绌烘垨绌虹櫧瀛楃涓�
+ if (StrUtil.isNotBlank(spotCheckQuarter.getCountersignUser())) {
+ String[] split = spotCheckQuarter.getCountersignUser().split(",");
+
+ // 閬嶅巻 split 鏁扮粍锛屽苟灏嗗厓绱犱緷娆¤祴鍊肩粰 countersignUrls 鏁扮粍
+ for (int i = 0; i < Math.min(split.length, countersignUrls.length); i++) {
+
+ String countersignUrl = null;
+ try {
+ countersignUrl = userMapper.selectById(Integer.parseInt(split[i])).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+ if (StrUtil.isBlank(countersignUrl)) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+
+ countersignUrls[i] = countersignUrl;
+ }
+ }
+
+ // 灏� countersignUrls 鏁扮粍涓殑鍊间緷娆¤祴鍊肩粰 countersignUrl1 鍒� countersignUrl7
+ String countersignUrl1 = countersignUrls[0];
+ String countersignUrl2 = countersignUrls[1];
+ String countersignUrl3 = countersignUrls[2];
+ String countersignUrl4 = countersignUrls[3];
+ String countersignUrl5 = countersignUrls[4];
+ String countersignUrl6 = countersignUrls[5];
+ String countersignUrl7 = countersignUrls[6];
+
+ //瀹℃牳浜�
+ String examineUrl = null;
+ if (spotCheckQuarter.getExamineUser() != null) {
+ try {
+ examineUrl = userMapper.selectById(spotCheckQuarter.getExamineUser()).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒板鏍镐汉鐨勭鍚�");
+ }
+ if (StrUtil.isBlank(examineUrl)) {
+ throw new ErrorException("鎵句笉鍒板鏍镐汉鐨勭鍚�");
+ }
+ }
+
+ //鎵瑰噯浜�
+ String ratifyUrl = null;
+ if (spotCheckQuarter.getRatifyUser() != null) {
+ try {
+ ratifyUrl = userMapper.selectById(spotCheckQuarter.getRatifyUser()).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒版壒鍑嗕汉鐨勭鍚�");
+ }
+ if (StrUtil.isBlank(ratifyUrl)) {
+ throw new ErrorException("鎵句笉鍒版壒鍑嗕汉鐨勭鍚�");
+ }
+ }
+
+ String finalWriteUrl = writeUrl;
+ String finalExamineUrl = examineUrl;
+ String finalRatifyUrl = ratifyUrl;
+
+ // 鑾峰彇璺緞
+ InputStream inputStream = this.getClass().getResourceAsStream("/static/spot_check_quarter.docx");
+ ConfigureBuilder builder = Configure.builder();
+ builder.useSpringEL(true);
+
+ XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render(
+ new HashMap<String, Object>() {{
+ put("quarter", spotCheckQuarter);
+ put("quarterItems", itemList);
+ put("writeUrl", StrUtil.isBlank(finalWriteUrl) ? null :
+ Pictures.ofLocal(imgUrl + "/" + finalWriteUrl).create());
+ put("countersignUrl1", StrUtil.isBlank(countersignUrl1) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl1).create());
+ put("countersignUrl2", StrUtil.isBlank(countersignUrl2) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl2).create());
+ put("countersignUrl3", StrUtil.isBlank(countersignUrl3) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl3).create());
+ put("countersignUrl4", StrUtil.isBlank(countersignUrl4) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl4).create());
+ put("countersignUrl5", StrUtil.isBlank(countersignUrl5) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl5).create());
+ put("countersignUrl6", StrUtil.isBlank(countersignUrl6) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl6).create());
+ put("countersignUrl7", StrUtil.isBlank(countersignUrl7) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl7).create());
+ put("examineUrl", StrUtil.isBlank(finalExamineUrl) ? null :
+ Pictures.ofLocal(imgUrl + "/" + finalExamineUrl).create());
+ put("ratifyUrl", StrUtil.isBlank(finalRatifyUrl) ? null :
+ Pictures.ofLocal(imgUrl + "/" + finalRatifyUrl).create());
+ put("createDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(spotCheckQuarter.getCreateTime())).create());
+ }});
+ try {
+ response.setContentType("application/msword");
+ String fileName = URLEncoder.encode(
+ spotCheckQuarter.getQuarterNo() + "鎶芥牱璁″垝", "UTF-8");
+ response.setHeader("Content-disposition",
+ "attachment;filename=" + fileName + ".docx");
+ OutputStream os = response.getOutputStream();
+ template.write(os);
+ os.flush();
+ os.close();
+ inputStream.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException("瀵煎嚭澶辫触");
+ }
+ return true;
+ }
+
+
+ /******************************************************* 骞村害鎶芥牱 *************************************************************/
+
+ @Override
+ public boolean addSpotCheckYear(SpotCheckYearDto spotCheckYearDto) {
+ spotCheckYearMapper.insert(spotCheckYearDto);
+ // 璇︽儏
+ for (SpotCheckYearItem yearItem : spotCheckYearDto.getYearItems()) {
+ yearItem.setYearId(spotCheckYearDto.getYearId());
+ }
+ spotCheckYearItemService.saveBatch(spotCheckYearDto.getYearItems());
+ return true;
+ }
+
+ @Override
+ public SpotCheckYearDto getSpotCheckYear(Integer yearId) {
+ SpotCheckYear spotCheckYear = spotCheckYearMapper.selectById(yearId);
+
+ // 鏌ヨ璇︽儏
+ List<SpotCheckYearItem> list = spotCheckYearItemService.list(Wrappers.<SpotCheckYearItem>lambdaQuery()
+ .eq(SpotCheckYearItem::getYearId, spotCheckYear.getYearId()));
+ SpotCheckYearDto spotCheckYearDto = new SpotCheckYearDto();
+ BeanUtil.copyProperties(spotCheckYear, spotCheckYearDto);
+ spotCheckYearDto.setYearItems(list);
+
+ return spotCheckYearDto;
+ }
+
+ @Override
+ public IPage<SpotCheckYearDto> getSpotCheckYearPage(Page page, SpotCheckYearDto spotCheckYear) {
+ return spotCheckYearMapper.getSpotCheckYearPage(page, QueryWrappers.queryWrappers(spotCheckYear));
+ }
+
+ @Override
+ public boolean deleteSpotCheckYear(Integer yearId) {
+ spotCheckYearMapper.deleteById(yearId);
+ spotCheckYearItemService.remove(Wrappers.<SpotCheckYearItem>lambdaQuery()
+ .eq(SpotCheckYearItem::getYearId, yearId));
+ return true;
+ }
+
+ /**
+ * 淇敼骞村害妫�楠�
+ * @param spotCheckYearDto
+ * @return
+ */
+ @Override
+ public boolean updateSpotCheckYear(SpotCheckYearDto spotCheckYearDto) {
+ spotCheckYearMapper.updateById(spotCheckYearDto);
+
+ // 鍒犻櫎璇︽儏
+ spotCheckYearItemService.remove(Wrappers.<SpotCheckYearItem>lambdaQuery()
+ .eq(SpotCheckYearItem::getYearId, spotCheckYearDto.getYearId()));
+
+ // 閲嶆柊鏂板
+ for (SpotCheckYearItem yearItem : spotCheckYearDto.getYearItems()) {
+ yearItem.setYearId(spotCheckYearDto.getYearId());
+ }
+ spotCheckYearItemService.saveBatch(spotCheckYearDto.getYearItems());
+ return false;
+ }
+
+ @Override
+ public boolean finalReportSpotCheckYear(Integer yearId, HttpServletResponse response) {
+ SpotCheckYear spotCheckYear = spotCheckYearMapper.selectById(yearId);
+
+ // 鏌ヨ璇︽儏
+ List<SpotCheckYearItem> itemList = spotCheckYearItemService.list(Wrappers.<SpotCheckYearItem>lambdaQuery()
+ .eq(SpotCheckYearItem::getYearId, spotCheckYear.getYearId()));
+
+ //缂栧埗浜�
+ String writeUrl = null;
+ if (spotCheckYear.getWriteUser() != null) {
+ try {
+ writeUrl = userMapper.selectById(spotCheckYear.getWriteUser()).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+ if (StrUtil.isBlank(writeUrl)) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+ }
+
+ // 鍒濆鍖栨墍鏈夌殑 countersignUrl 鍙橀噺
+ String[] countersignUrls = new String[7];
+
+ // 濡傛灉涓嶆槸绌烘垨绌虹櫧瀛楃涓�
+ if (StrUtil.isNotBlank(spotCheckYear.getCountersignUser())) {
+ String[] split = spotCheckYear.getCountersignUser().split(",");
+
+ // 閬嶅巻 split 鏁扮粍锛屽苟灏嗗厓绱犱緷娆¤祴鍊肩粰 countersignUrls 鏁扮粍
+ for (int i = 0; i < Math.min(split.length, countersignUrls.length); i++) {
+
+ String countersignUrl = null;
+ try {
+ countersignUrl = userMapper.selectById(Integer.parseInt(split[i])).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+ if (StrUtil.isBlank(countersignUrl)) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+
+ countersignUrls[i] = countersignUrl;
+ }
+ }
+
+ // 灏� countersignUrls 鏁扮粍涓殑鍊间緷娆¤祴鍊肩粰 countersignUrl1 鍒� countersignUrl7
+ String countersignUrl1 = countersignUrls[0];
+ String countersignUrl2 = countersignUrls[1];
+ String countersignUrl3 = countersignUrls[2];
+ String countersignUrl4 = countersignUrls[3];
+ String countersignUrl5 = countersignUrls[4];
+ String countersignUrl6 = countersignUrls[5];
+ String countersignUrl7 = countersignUrls[6];
+
+ //瀹℃牳浜�
+ String examineUrl = null;
+ if (spotCheckYear.getExamineUser() != null) {
+ try {
+ examineUrl = userMapper.selectById(spotCheckYear.getExamineUser()).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒板鏍镐汉鐨勭鍚�");
+ }
+ if (StrUtil.isBlank(examineUrl)) {
+ throw new ErrorException("鎵句笉鍒板鏍镐汉鐨勭鍚�");
+ }
+ }
+
+ //鎵瑰噯浜�
+ String ratifyUrl = null;
+ if (spotCheckYear.getRatifyUser() != null) {
+ try {
+ ratifyUrl = userMapper.selectById(spotCheckYear.getRatifyUser()).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒版壒鍑嗕汉鐨勭鍚�");
+ }
+ if (StrUtil.isBlank(ratifyUrl)) {
+ throw new ErrorException("鎵句笉鍒版壒鍑嗕汉鐨勭鍚�");
+ }
+ }
+
+ String finalWriteUrl = writeUrl;
+ String finalExamineUrl = examineUrl;
+ String finalRatifyUrl = ratifyUrl;
+
+ // 鑾峰彇璺緞
+ InputStream inputStream = this.getClass().getResourceAsStream("/static/spot_check_year.docx");
+ ConfigureBuilder builder = Configure.builder();
+ builder.useSpringEL(true);
+ XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render(
+ new HashMap<String, Object>() {{
+ put("year", spotCheckYear);
+ put("yearItems", itemList);
+ put("writeUrl", StrUtil.isBlank(finalWriteUrl) ? null :
+ Pictures.ofLocal(imgUrl + "/" + finalWriteUrl).create());
+ put("countersignUrl1", StrUtil.isBlank(countersignUrl1) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl1).create());
+ put("countersignUrl2", StrUtil.isBlank(countersignUrl2) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl2).create());
+ put("countersignUrl3", StrUtil.isBlank(countersignUrl3) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl3).create());
+ put("countersignUrl4", StrUtil.isBlank(countersignUrl4) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl4).create());
+ put("countersignUrl5", StrUtil.isBlank(countersignUrl5) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl5).create());
+ put("countersignUrl6", StrUtil.isBlank(countersignUrl6) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl6).create());
+ put("countersignUrl7", StrUtil.isBlank(countersignUrl7) ? null :
+ Pictures.ofLocal(imgUrl + "/" + countersignUrl7).create());
+ put("examineUrl", StrUtil.isBlank(finalExamineUrl) ? null :
+ Pictures.ofLocal(imgUrl + "/" + finalExamineUrl).create());
+ put("ratifyUrl", StrUtil.isBlank(finalRatifyUrl) ? null :
+ Pictures.ofLocal(imgUrl + "/" + finalRatifyUrl).create());
+ put("createDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(spotCheckYear.getCreateTime())).create());
+ }});
+ try {
+ response.setContentType("application/msword");
+ String fileName = URLEncoder.encode(
+ spotCheckYear.getYearHead(), "UTF-8");
+ response.setHeader("Content-disposition",
+ "attachment;filename=" + fileName + ".docx");
+ OutputStream os = response.getOutputStream();
+ template.write(os);
+ os.flush();
+ os.close();
+ inputStream.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return true;
+ }
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsOrderInspectionServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsOrderInspectionServiceImpl.java
new file mode 100644
index 0000000..5b05f88
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsOrderInspectionServiceImpl.java
@@ -0,0 +1,35 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.basic.mapper.StandardTreeMapper;
+import com.ruoyi.common.enums.OrderType;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.inspect.service.IfsOrderInspectionService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 閿�鍞鍗曟姤妫�service
+ */
+@Slf4j
+@Service
+public class IfsOrderInspectionServiceImpl implements IfsOrderInspectionService {
+
+ @Autowired
+ private StandardTreeMapper standardTreeMapper;
+
+ @Override
+ public IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
+ // todo: 鍙湅鎴�
+ String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
+ String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
+ ifsInventoryQuantityDto.setBeginDeclareDate(null);
+ ifsInventoryQuantityDto.setEndDeclareDate(null);
+ IPage<IfsInventoryQuantitySupplierDto> ifsByOver = standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+ ifsByOver.getRecords().forEach(r->r.setOrderTypeName(OrderType.getLabelByValue(r.getOrderType())));
+ return ifsByOver;
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java
new file mode 100644
index 0000000..5f6b8f2
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java
@@ -0,0 +1,122 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.enums.OrderType;
+import com.ruoyi.common.utils.api.IfsApiUtils;
+import com.ruoyi.inspect.dto.IfsPartPropsRecordDTO;
+import com.ruoyi.inspect.mapper.IfsPartPropsRecordMapper;
+import com.ruoyi.inspect.mapper.IfsSplitOrderRecordMapper;
+import com.ruoyi.inspect.pojo.IfsPartPropsRecord;
+import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
+import com.ruoyi.inspect.service.IfsPartPropsRecordService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑fs_part_props_record(ifs璁㈠崟闆朵欢灞炴�ц褰曡〃)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2025-10-23 15:00:34
+*/
+@Slf4j
+@Service
+public class IfsPartPropsRecordServiceImpl extends ServiceImpl<IfsPartPropsRecordMapper, IfsPartPropsRecord>
+ implements IfsPartPropsRecordService{
+
+ @Autowired
+ private IfsApiUtils ifsApiUtils;
+
+ @Autowired
+ private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
+
+ @Autowired
+ private IfsSplitOrderRecordMapper ifsSplitOrderRecordMapper;
+
+ @Value("${ifs.contract:}")
+ public String contract;
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean saveOrUpdateProps(IfsPartPropsRecordDTO ifsPartPropsRecord) {
+ if(Objects.isNull(ifsPartPropsRecord)){
+ throw new RuntimeException("鍙傛暟涓嶈兘涓虹┖");
+ }
+ //鏌ヨ鏄惁宸叉湁鍚屾壒娆″悓闆朵欢鍙风殑鎵规灞炴�э紝娌℃湁鎵嶆洿鏂�
+ Long count = baseMapper.selectCountByPartNoAndLotBatchNo(ifsPartPropsRecord.getPartNo(),ifsPartPropsRecord.getLotBatchNo());
+ if(count==0){
+ //鍒ゆ柇鏄柊澧炶繕鏄洿鏂�
+ String actionType = Objects.isNull(ifsPartPropsRecord.getId())?"New":"Modify";
+ Map<String, Object> inAttrMap = new HashMap<>();
+ inAttrMap.put("RECORD_ID", UUID.randomUUID().toString());
+ inAttrMap.put("SYSCODE", "LIMS");
+ inAttrMap.put("SYSMODEL", "搴撳瓨鐗╂枡鎵规灞炴�т慨鏀�");
+ HashMap<String, Object> batchInfoMap = new HashMap<>();
+ batchInfoMap.put("CONTRACT",contract);//鍩�
+ batchInfoMap.put("PART_NO",ifsPartPropsRecord.getPartNo());//闆朵欢鍙�
+ batchInfoMap.put("LOT_BATCH_NO",ifsPartPropsRecord.getLotBatchNo());//鎵规鍙�
+ batchInfoMap.put("ATTR1",ifsPartPropsRecord.getDrumNo());//杞藉叿缂栧彿
+ batchInfoMap.put("ATTR2",ifsPartPropsRecord.getStartMeterMark().toString());//璧峰绫虫爣
+ batchInfoMap.put("ATTR3",ifsPartPropsRecord.getEndMeterMark().toString());//鎴绫虫爣
+ batchInfoMap.put("ATTR4", ifsPartPropsRecord.getOuterColor());//澶栨姢棰滆壊
+ batchInfoMap.put("ATTR5",ifsPartPropsRecord.getInsulationColor());//缁濈紭棰滆壊
+ batchInfoMap.put("ATTR8",ifsPartPropsRecord.getLetteringInfo());//鍗板瓧淇℃伅
+ batchInfoMap.put("ATTR23","杞﹂棿璁㈠崟");//鍏ュ簱鏉ユ簮
+ batchInfoMap.put("ATTR24","0");//鍒嗗壊棰勭暀鏁伴噺
+ batchInfoMap.put("ACTION_TYPE",actionType);//鎿嶄綔绫诲瀷
+ inAttrMap.put("BATCH_INFO", Collections.singletonList(batchInfoMap));
+ Result result = ifsApiUtils.importPartLotAttr(JSONUtil.toJsonStr(inAttrMap));
+ if(result.getCode()!=200){
+ throw new RuntimeException("搴撳瓨鐗╂枡鎵规灞炴�ф洿鏂板け璐ワ細"+result.getMsg());
+ }
+ }
+ return this.saveOrUpdate(ifsPartPropsRecord);
+ }
+
+ @Override
+ public IfsPartPropsRecord getOneByIfsId(Long ifsId) {
+ //鏌ヨifs璁㈠崟淇℃伅
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsId);
+ if(Objects.isNull(ifsInventoryQuantity)){
+ throw new RuntimeException("鏈壘鍒板搴旂殑IFS璁㈠崟淇℃伅");
+ }
+ //鍒ゆ柇鏄惁鏄媶鍒嗚鍗�
+ if(ifsInventoryQuantity.getIsSplitOrder().equals(1)&& StringUtils.equals(ifsInventoryQuantity.getOrderType(), OrderType.RAW.getValue())){
+ //鏌ヨ鎷嗗垎璁板綍
+ IfsSplitOrderRecord splitRecord = ifsSplitOrderRecordMapper.selectOne(Wrappers.<IfsSplitOrderRecord>lambdaQuery()
+ .eq(IfsSplitOrderRecord::getOrderNo, ifsInventoryQuantity.getOrderNo())
+ .eq(IfsSplitOrderRecord::getPartNo, ifsInventoryQuantity.getPartNo())
+ .eq(IfsSplitOrderRecord::getReleaseNo, ifsInventoryQuantity.getReleaseNo())
+ .eq(IfsSplitOrderRecord::getLineNo, ifsInventoryQuantity.getLineNo())
+ .eq(IfsSplitOrderRecord::getReceiptNo, ifsInventoryQuantity.getReceiptNo())
+ .eq(IfsSplitOrderRecord::getLotBatchNo, ifsInventoryQuantity.getUpdateBatchNo())
+ .eq(IfsSplitOrderRecord::getOrderNo, ifsInventoryQuantity.getOrderNo())
+ );
+ if(Objects.isNull(splitRecord)){
+ throw new RuntimeException("鏈壘鍒伴浂浠剁殑鎷嗗垎淇℃伅");
+ }
+ IfsPartPropsRecord ifsPartPropsRecord = new IfsPartPropsRecord();
+ ifsPartPropsRecord.setDrumNo(splitRecord.getDrumNo());
+ ifsPartPropsRecord.setLetteringInfo(splitRecord.getLetteringInfo());
+ ifsPartPropsRecord.setInsulationColor(splitRecord.getInsulationColor());
+ ifsPartPropsRecord.setOuterColor(splitRecord.getOuterColor());
+ ifsPartPropsRecord.setDrumNo(splitRecord.getDrumNo());
+ ifsPartPropsRecord.setDrumNo(splitRecord.getDrumNo());
+ return ifsPartPropsRecord;
+ }
+ return this.getOne(Wrappers.<IfsPartPropsRecord>lambdaQuery().eq(IfsPartPropsRecord::getIfsInventoryId,ifsId).last("limit 1"));
+ }
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsSplitOrderRecordServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsSplitOrderRecordServiceImpl.java
new file mode 100644
index 0000000..d57e944
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsSplitOrderRecordServiceImpl.java
@@ -0,0 +1,22 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
+import com.ruoyi.inspect.service.IfsSplitOrderRecordService;
+import com.ruoyi.inspect.mapper.IfsSplitOrderRecordMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑fs_split_order_record(ifs鍘熸潗鏂欒鍗曟媶鍒嗚褰曡〃)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2025-10-29 16:39:41
+*/
+@Service
+public class IfsSplitOrderRecordServiceImpl extends ServiceImpl<IfsSplitOrderRecordMapper, IfsSplitOrderRecord>
+ implements IfsSplitOrderRecordService{
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderDeviceRecordServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderDeviceRecordServiceImpl.java
new file mode 100644
index 0000000..4d8b71e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderDeviceRecordServiceImpl.java
@@ -0,0 +1,15 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.InsOrderDeviceRecordMapper;
+import com.ruoyi.inspect.pojo.InsOrderDeviceRecord;
+import com.ruoyi.inspect.service.InsOrderDeviceRecordService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author zhuo
+ * @Date 2024/12/22
+ */
+@Service
+public class InsOrderDeviceRecordServiceImpl extends ServiceImpl<InsOrderDeviceRecordMapper, InsOrderDeviceRecord> implements InsOrderDeviceRecordService {
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFactoryVerifyItemServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFactoryVerifyItemServiceImpl.java
new file mode 100644
index 0000000..9a27146
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFactoryVerifyItemServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.InsOrderFactoryVerifyItemMapper;
+import com.ruoyi.inspect.pojo.InsOrderFactoryVerifyItem;
+import com.ruoyi.inspect.service.InsOrderFactoryVerifyItemService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 鍘熸潗鏂欏巶瀹惰繘璐ч獙璇佹楠岄」
+ *
+ * @author zhuo
+ * @since 2024-09-26
+ */
+@Service
+public class InsOrderFactoryVerifyItemServiceImpl extends ServiceImpl<InsOrderFactoryVerifyItemMapper, InsOrderFactoryVerifyItem> implements InsOrderFactoryVerifyItemService {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFileServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFileServiceImpl.java
new file mode 100644
index 0000000..63ed243
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFileServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.InsOrderFileMapper;
+import com.ruoyi.inspect.pojo.InsOrderFile;
+import com.ruoyi.inspect.service.InsOrderFileService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 妫�楠屽崟涓嬬殑闄勪欢鍒楄〃 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
+ * @since 2024-06-06 10:08:21
+ */
+@Service
+public class InsOrderFileServiceImpl extends ServiceImpl<InsOrderFileMapper, InsOrderFile> implements InsOrderFileService {
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
new file mode 100644
index 0000000..7524220
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -0,0 +1,6033 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.aspose.words.License;
+import com.aspose.words.SaveFormat;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.config.Configure;
+import com.deepoove.poi.config.ConfigureBuilder;
+import com.deepoove.poi.data.*;
+import com.deepoove.poi.data.style.BorderStyle;
+import com.deepoove.poi.data.style.Style;
+import com.deepoove.poi.data.style.TableStyle;
+import com.deepoove.poi.util.TableTools;
+import com.deepoove.poi.util.UnitUtils;
+import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.pojo.StandardTemplate;
+import com.ruoyi.basic.service.StandardTemplateService;
+import com.ruoyi.common.constant.DictDataConstants;
+import com.ruoyi.common.constant.InsOrderTypeConstants;
+import com.ruoyi.common.constant.MenuJumpPathConstants;
+import com.ruoyi.common.core.domain.entity.Custom;
+import com.ruoyi.common.core.domain.entity.InformationNotification;
+import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.common.enums.OrderType;
+import com.ruoyi.common.utils.*;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.*;
+import com.ruoyi.inspect.mapper.*;
+import com.ruoyi.inspect.pojo.*;
+import com.ruoyi.inspect.service.*;
+import com.ruoyi.inspect.util.HackLoopTableRenderPolicy;
+import com.ruoyi.inspect.util.PreserveReportPicturePlaceholderHandler;
+import com.ruoyi.inspect.util.ReportSignaturePictureUtils;
+import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo;
+import com.ruoyi.inspect.vo.InsOrderPlanVO;
+import com.ruoyi.inspect.vo.InsSampleUserVO;
+import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
+import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursService;
+import com.ruoyi.system.mapper.CustomMapper;
+import com.ruoyi.system.mapper.UserMapper;
+import com.ruoyi.system.service.ISysDictTypeService;
+import com.ruoyi.system.service.InformationNotificationService;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.xwpf.usermodel.*;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import jakarta.annotation.Resource;
+import java.io.*;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 妫�楠屼换鍔�-涓氬姟瀹炵幇灞�
+ */
+@Service
+public class InsOrderPlanServiceImpl extends ServiceImpl<InsOrderMapper, InsOrder> implements InsOrderPlanService {
+
+ private static final int DETECTION_REPORT = 0;
+ private static final int INSPECTION_REPORT = 1;
+ private static final String DIRECT_TEMPLATE_LABORATORY = "鏂拌仛";
+
+ @Resource
+ private InsSampleMapper insSampleMapper;
+ @Resource
+ private InsSampleUserMapper insSampleUserMapper;
+ @Resource
+ private InsOrderMapper insOrderMapper;
+ @Resource
+ private InsOrderService insOrderService;
+ @Resource
+ private StandardTemplateService standardTemplateService;
+ @Resource
+ private InsOrderStateMapper insOrderStateMapper;
+ @Resource
+ private InsProductMapper insProductMapper;
+
+ @Value("${wordUrl}")
+ private String wordUrl;
+ @Resource
+ private InsReportMapper insReportMapper;
+ @Resource
+ private InsProductResultMapper insProductResultMapper;
+ @Resource
+ private InsProductUserMapper insProductUserMapper;
+ @Resource
+ private AuxiliaryOutputWorkingHoursService auxiliaryOutputWorkingHoursService;
+ @Resource
+ private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper;
+ @Resource
+ private InformationNotificationService informationNotificationService;
+ @Resource
+ private UserMapper userMapper;
+ @Resource
+ private CustomMapper customMapper;
+ @Value("${file.path}")
+ private String imgUrl;
+ @Resource
+ private InsOrderFileMapper insOrderFileMapper;
+ @Resource
+ private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
+ @Resource
+ private IfsPartPropsRecordMapper ifsPartPropsRecordMapper;
+ @Resource
+ private InsReportService insReportService;
+ @Resource
+ private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper;
+ @Resource
+ private InsUnqualifiedRetestProductService insUnqualifiedRetestProductService;
+ @Resource
+ private InsUnqualifiedRetestResultMapper insUnqualifiedRetestResultMapper;
+ @Resource
+ private ThreadPoolTaskExecutor threadPoolTaskExecutor;
+ @Resource
+ private InsOrderFactoryVerifyMapper insOrderFactoryVerifyMapper;
+ @Resource
+ private InsOrderFactoryVerifyItemService insOrderFactoryVerifyItemService;
+
+ @Resource
+ private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper;
+ @Resource
+ private InsOrderStandardTemplateService insOrderStandardTemplateService;
+ @Resource
+ private InsOrderDeviceRecordMapper insOrderDeviceRecordMapper;
+ @Resource
+ private InsOrderTemplateDeviceMapper insOrderTemplateDeviceMapper;
+ @Resource
+ private InsOrderDeviceRecordService insOrderDeviceRecordService;
+ @Resource
+ private ISysDictTypeService iSysDictTypeService;
+ @Resource
+ private InsOrderRatesService insOrderRatesService;
+ @Resource
+ private InsProductDeviationWarningService insProductDeviationWarningService;
+ @Resource
+ private InsProductDeviationWarningDetailService insProductDeviationWarningDetailService;
+
+
+ @Override
+ public IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
+ // todo: 浠呯湅鑷繁鎴栬�呭疄楠屽
+ //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
+ String laboratory = null;
+ String userName = null;
+ Integer userId = null;
+ if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
+ Integer currentUserId = SecurityUtils.getUserId().intValue();
+ // 绠$悊鍛樺彲浠ユ煡鐪嬪苟澶嶆牳鍏ㄩ儴寰呭鏍镐换鍔★紝鏅�氱敤鎴蜂粛鍙煡鐪嬪垎閰嶇粰鑷繁鐨勪换鍔°��
+ if (!SecurityUtils.isAdmin(currentUserId.longValue())) {
+ userId = currentUserId;
+ userName = userMapper.selectById(userId).getName();
+ }
+ insOrderPlanDTO.setUserId(null);
+ }
+ Integer isCheck = insOrderPlanDTO.getIsCheck();
+ insOrderPlanDTO.setIsCheck(null);
+ String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//璇曢獙瀹�
+ IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page,
+ QueryWrappers.queryWrappers(insOrderPlanDTO),
+ userName,
+ userId,
+ sonLaboratory,
+ laboratory,
+ isCheck);
+ return insOrderPage;
+ }
+
+ @Override
+ public IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, InsOrderPlanDTO insOrderPlanDTO) {
+
+ Integer userId = SecurityUtils.getUserId().intValue();
+ User user = userMapper.selectById(userId);//褰撳墠鐧诲綍鐨勪汉
+ // todo: 浠呯湅鑷繁鎴栬�呭疄楠屽
+ //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
+ String departLimsId = user.getDepartLimsId();
+ String laboratory = null;
+
+ if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
+ insOrderPlanDTO.setUserId(userId.longValue());
+ }
+ String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//璇曢獙瀹�
+ IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory);
+ return insOrderPage;
+ }
+
+ //璁ら浠诲姟
+ @Override
+ public boolean claimInsOrderPlan(InsOrderPlanDTO entity) {
+ if (Objects.isNull(entity)) {
+ return false;
+ }
+ Integer userId = SecurityUtils.getUserId().intValue();
+ InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 0, entity.getSonLaboratory());
+ return insSampleUserMapper.insert(insSampleUser) > 0;
+ }
+
+ @Override
+ public Map<String, Object> doInsOrder(Integer id, String laboratory) {
+ ensureDirectTemplateOrderState(id);
+ InsOrder order = insOrderMapper.selectById(id);
+ Map<String, Object> map = insOrderService.getInsOrderAndSample(id, laboratory);
+ List<SampleProductDto> list = JSON.parseArray(JSON.toJSONString(map.get("sampleProduct")), SampleProductDto.class);
+ map.put("sampleProduct", list);
+
+ // 鏌ヨ鍘傚瀵嗗害
+ String supplierDensity = "";
+ if (CollectionUtils.isNotEmpty(list)) {
+ SampleProductDto sampleProductDto = list.get(0);
+
+ // 鍒ゆ柇鏈夋病鏈夌粦瀹氬瀷鍙�
+ String modelValue = insSampleMapper.selectSupplierDensityModel(sampleProductDto.getSample(),
+ order.getProduction(),
+ sampleProductDto.getModel());
+ if (StringUtils.isNotBlank(modelValue)) {
+ supplierDensity = modelValue;
+ } else {
+ supplierDensity = insSampleMapper.selectSupplierDensity(sampleProductDto.getSample(),
+ order.getProduction());
+ }
+ }
+ map.put("supplierDensity", supplierDensity);
+ return map;
+ }
+
+ @Override
+ public List<InsProduct> getInsProduct(InsOrderPlanProductDto dto) {
+ List<InsProduct> insProducts = new ArrayList<>();
+ switch (dto.getType()) {
+ case 0:
+ case 4:
+ //濮旀墭
+ insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag());
+ break;
+ case 5:
+ //鍘熸潗鏂欎笅鍗�
+ insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag());
+ break;
+ }
+ // 鏌ヨ璁㈠崟Id
+ InsOrder order = insOrderMapper.selectFirstSubmit(dto.getId());
+ if (order == null) {
+ return BeanUtil.isEmpty(insProducts) ? Collections.emptyList() : insProducts;
+ }
+ insProducts = mergeDirectTemplateSnapshots(order, dto.getId(), dto.getLaboratory(), insProducts);
+ if (BeanUtil.isEmpty(insProducts)) {
+ return Collections.emptyList();
+ }
+ getTemplateThing(order, insProducts, dto.getLaboratory());
+ return insProducts;
+ }
+
+ /**
+ * 鐩寸粦妯℃澘璁㈠崟鐨勯〉绛炬潵婧愭槸璁㈠崟妯℃澘蹇収锛岃�屼笉鏄凡鐢熸垚鐨勬楠岄」銆�
+ * <p>
+ * 浠嶄繚鐣欐瘡涓ā鏉夸笅宸叉湁鐨勬楠岄」璁板綍锛涘鏋滄煇涓ā鏉挎病鏈夆�滄楠岄」鈥濇爣璁帮紝琛ヤ竴鏉′粎鐢ㄤ簬
+ * 鎵胯浇妯℃澘鍐呭鐨勮繑鍥炲璞★紝浣垮墠绔篃鑳藉睍绀恒�佸~鍐欒妯℃澘銆�
+ */
+ private List<InsProduct> mergeDirectTemplateSnapshots(InsOrder order, Integer sampleId,
+ String laboratory, List<InsProduct> products) {
+ List<InsProduct> source = products == null ? new ArrayList<>() : products;
+ List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, order.getId())
+ .orderByAsc(InsOrderStandardTemplate::getSort, InsOrderStandardTemplate::getId));
+ if (snapshots.isEmpty()) {
+ return source;
+ }
+ Map<Integer, List<InsProduct>> productsByTemplate = source.stream()
+ .filter(product -> product.getTemplateId() != null)
+ .collect(Collectors.groupingBy(InsProduct::getTemplateId, LinkedHashMap::new, Collectors.toList()));
+ List<InsProduct> result = new ArrayList<>();
+ for (InsOrderStandardTemplate snapshot : snapshots) {
+ List<InsProduct> templateProducts = productsByTemplate.remove(snapshot.getTemplateId());
+ if (CollectionUtils.isNotEmpty(templateProducts)) {
+ templateProducts.forEach(product -> product.setTemplateSort(snapshot.getSort()));
+ result.addAll(templateProducts);
+ continue;
+ }
+ InsProduct templateCarrier = new InsProduct();
+ templateCarrier.setInsSampleId(sampleId);
+ templateCarrier.setTemplateId(snapshot.getTemplateId());
+ templateCarrier.setSonLaboratory(laboratory);
+ templateCarrier.setState(1);
+ templateCarrier.setSort(snapshot.getSort());
+ templateCarrier.setTemplateSort(snapshot.getSort());
+ result.add(templateCarrier);
+ }
+ // 鍏煎鍘嗗彶寮傚父鏁版嵁锛氳鍗曞揩鐓т互澶栫殑妫�楠岄」浠嶇劧杩斿洖锛屼絾鏀惧湪蹇収椤电涔嬪悗銆�
+ for (List<InsProduct> remaining : productsByTemplate.values()) {
+ result.addAll(remaining);
+ }
+ source.stream().filter(product -> product.getTemplateId() == null).forEach(result::add);
+ return result;
+ }
+
+ private boolean isDirectTemplateSample(InsOrder order, InsSample sample) {
+ return sample != null
+ && Objects.equals(sample.getInsOrderId(), order.getId())
+ && sample.getStandardMethodListId() == null
+ && StringUtils.isBlank(sample.getFactory())
+ && StringUtils.isBlank(sample.getSampleType())
+ && StringUtils.isBlank(sample.getModel())
+ && StringUtils.isBlank(order.getFactory())
+ && StringUtils.isBlank(order.getSampleType());
+ }
+
+ @Override
+ public Map<String, Object> checkSubmitPlan(Integer orderId, String laboratory) {
+ Map<String, Object> map = new HashMap<>();
+ List<String> collect = new ArrayList<>();
+ if (isDirectTemplateOrder(orderId)) {
+ List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId)
+ .orderByAsc(InsOrderStandardTemplate::getSort,
+ InsOrderStandardTemplate::getId));
+ for (InsOrderStandardTemplate snapshot : snapshots) {
+ String templateName = StringUtils.defaultIfBlank(snapshot.getName(),
+ "妯℃澘ID " + snapshot.getTemplateId());
+ if (snapshot.getDetectionTime() == null) {
+ collect.add("璇烽�夋嫨鈥�" + templateName + "鈥濈殑妫�娴嬫椂闂�");
+ }
+ if (StringUtils.isBlank(snapshot.getDetectionPlace())) {
+ collect.add("璇峰~鍐欌��" + templateName + "鈥濈殑妫�娴嬪湴鐐�");
+ }
+ }
+ map.put("errorMsg", collect);
+ map.put("missingExportItems", getMissingTemplateExportValues(orderId));
+ map.put("unInsOrderCount", 0L);
+ return map;
+ }
+ map.put("errorMsg", collect);
+ map.put("unInsOrderCount", 0L);
+ return map;
+ }
+
+ @Override
+ public IPage<InsOrderFile> getFileList(Page page, InsOrderFile insOrderFile) {
+ Integer insOrderId = insOrderFile.getInsOrderId();
+ insOrderFile.setInsOrderId(null);
+ IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile), insOrderId);
+ return insOrderFileIPage;
+ }
+
+ @Override
+ public int uploadFile(Integer orderId, MultipartFile file) {
+ String urlString;
+ String pathName;
+ String path;
+ String filename = file.getOriginalFilename();
+ String contentType = file.getContentType();
+ InsOrderFile insOrderFile = new InsOrderFile();
+ insOrderFile.setInsOrderId(orderId);
+ insOrderFile.setFileName(filename);
+ if (contentType != null && contentType.startsWith("image/")) {
+ // 鏄浘鐗�
+ path = imgUrl;
+ insOrderFile.setType(1);
+ } else {
+ // 鏄枃浠�
+ path = wordUrl;
+ insOrderFile.setType(2);
+ }
+ try {
+ File realpath = new File(path);
+ if (!realpath.exists()) {
+ realpath.mkdirs();
+ }
+ pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "_" + file.getOriginalFilename();
+ urlString = realpath + "/" + pathName;
+ file.transferTo(new File(urlString));
+ insOrderFile.setFileUrl(pathName);
+ return insOrderFileMapper.insert(insOrderFile);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.err.println("闄勪欢涓婁紶閿欒");
+ return 0;
+ }
+ }
+
+
+ @Override
+ public List<String> upPlanUser2(Integer orderId) {
+ List<Integer> sampleId = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList());
+ List<String> sonLaboratory = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).in(InsProduct::getInsSampleId, sampleId)).stream().map(InsProduct::getSonLaboratory).distinct().collect(Collectors.toList());
+ return sonLaboratory;
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void saveInsContext(SaveInsContextDto saveInsContextDto) {
+ Map<String, Object> insContext = JSON.parseObject(saveInsContextDto.getParam(), Map.class);
+ Integer userId = SecurityUtils.getUserId().intValue();
+ InsSample insSample = insSampleMapper.selectById(saveInsContextDto.getSampleId());
+ insContext.forEach((k, v) -> {
+ JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
+ InsProduct insProduct = new InsProduct();
+ insProduct.setId(Integer.parseInt(k));
+ InsProduct product = insProductMapper.selectById(insProduct.getId());
+ if (saveInsContextDto.getCurrentTable().equals(product.getTemplateId()) && saveInsContextDto.getSampleId().equals(product.getInsSampleId())) {
+ List<InsProductResult> oldResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
+ .eq(InsProductResult::getInsProductId, insProduct.getId()));
+ InsProductResult newResult = new InsProductResult();
+ if (CollectionUtils.isNotEmpty(oldResults)) {
+ BeanUtil.copyProperties(oldResults.get(0), newResult);
+ }
+ newResult.setInsProductId(Integer.parseInt(k));
+ /*鏍¢獙涓�涓媟esult琛�*/
+ if (oldResults.size() > 1) {
+ for (int i = 1; i < oldResults.size(); i++) {
+ insProductResultMapper.deleteById(oldResults.get(i));
+ }
+ }
+ //妫�楠屽��
+ if (jo.get("insValue") != null) {
+ JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue")));
+ List<Map<String, Object>> iv = new ArrayList<>();
+ for (Object o : jsonArray) {
+ JSONObject insValue = JSON.parseObject(JSON.toJSONString(o));
+ Map<String, Object> map = new HashMap<>();
+ map.put("v", JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v"));
+ map.put("r", JSON.toJSONString(insValue.get("r")));
+ map.put("c", JSON.toJSONString(insValue.get("c")));
+ map.put("w", insValue.get("w"));
+ try {
+ if ((insValue.get("u") == null || insValue.get("u").equals("")) && StrUtil.isNotEmpty(JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v").toString())) {
+ map.put("u", userId + "");
+ } else {
+ map.put("u", insValue.get("u"));
+ }
+ iv.add(map);
+ } catch (Exception e) {
+ }
+ }
+ newResult.setInsValue(JSON.toJSONString(iv));
+ }
+ //璁$畻鍊�
+ if (jo.get("comValue") != null && !Objects.equals(jo.get("comValue"), "")) {
+ JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("comValue")));
+ List<Map<String, Object>> cv = new ArrayList<>();
+ for (Object o : jsonArray2) {
+ JSONObject comValue = JSON.parseObject(JSON.toJSONString(o));
+ Map<String, Object> map = new HashMap<>();
+ map.put("r", JSON.toJSONString(comValue.get("r")));
+ map.put("c", JSON.toJSONString(comValue.get("c")));
+ map.put("v", JSON.parseObject(JSON.toJSONString(comValue.get("v"))).get("v"));
+ cv.add(map);
+ }
+ newResult.setComValue(JSON.toJSONString(cv));
+ }
+ //鏈�缁堝��
+ try {
+ JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue")));
+ if (resValue.get("v") != null) {
+ Object o = JSON.parseObject(JSON.toJSONString(resValue.get("v"))).get("v");
+ insProduct.setLastValue(o.equals("") ? null : (o.toString()));
+ }
+ } catch (Exception e) {
+ insProduct.setLastValue("");//''
+ }
+ //璁惧缂栧彿
+ if (jo.get("equipValue") != null) {
+ JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipValue")));
+ List<Map<String, Object>> ev = new ArrayList<>();
+ for (Object o : jsonArray2) {
+ JSONObject equipValue = JSON.parseObject(JSON.toJSONString(o));
+ Map<String, Object> map = new HashMap<>();
+ map.put("v", JSON.parseObject(JSON.toJSONString(equipValue.get("v"))).get("v"));
+ ev.add(map);
+ }
+ newResult.setEquipValue(JSON.toJSONString(ev));
+ }
+ //璁惧鍚嶇О
+ if (jo.get("equipName") != null) {
+ JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipName")));
+ List<Map<String, Object>> ev = new ArrayList<>();
+ for (Object o : jsonArray2) {
+ JSONObject equipValue = JSON.parseObject(JSON.toJSONString(o));
+ Map<String, Object> map = new HashMap<>();
+ map.put("v", JSON.parseObject(JSON.toJSONString(equipValue.get("v"))).get("v"));
+ ev.add(map);
+ }
+ newResult.setEquipName(JSON.toJSONString(ev));
+ }
+ //缁撹
+ try {
+ JSONObject insResult = JSON.parseObject(JSON.toJSONString(jo.get("insResult")));
+ String ir = JSON.parseObject(JSON.toJSONString(insResult.get("v"))).get("v") + "";
+ insProduct.setInsResult(Integer.parseInt(ir));
+ } catch (Exception e) {
+ insProduct.setInsResult(2);//寰呭畾
+ }
+ if (Objects.isNull(newResult.getId())) {
+ newResult.setCreateUser(userId);
+ newResult.setUpdateUser(userId);
+ insProductResultMapper.insert(newResult);
+ } else {
+ newResult.setUpdateUser(userId);
+ newResult.setUpdateTime(LocalDateTime.now());
+ insProductResultMapper.updateById(newResult);
+ }
+
+ insProduct.setUpdateUser(userId);
+ insProductMapper.updateById(insProduct);
+ insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId()));
+
+ insSample.setInsState(1);
+ Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, insSample.getId()));
+ Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, insSample.getId())
+ .and(wrapper -> wrapper
+ .isNotNull(InsProduct::getInsResult)
+ .or()
+ .ne(InsProduct::getInsResult, 2)
+ ));
+ if (Objects.equals(l, l1)) {
+ insSample.setInsState(2);
+ }
+ insSampleMapper.updateById(insSample);
+ /*鏍¢獙涓�涓媟esult琛�*/
+ List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
+ .eq(InsProductResult::getInsProductId, product.getId()));
+ if (insProductResults.size() > 1) {
+ for (int i = 1; i < insProductResults.size(); i++) {
+ insProductResultMapper.deleteById(insProductResults.get(i));
+ }
+ }
+
+ // 娣诲姞宸ユ椂
+ // 鍒ゆ柇鏄惁鍙槸鍙備笌璁$畻鍊�, 鍙備笌璁$畻鍊煎疄闄呮病鏈夊~鍐�
+ InsProduct finalInsProduct = insProductMapper.selectById(product.getId());
+ InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId());
+ if (StringUtils.isNotBlank(newResult.getInsValue()) && !newResult.getInsValue().equals("[]")) {
+ threadPoolTaskExecutor.execute(() -> {
+ this.addAuxiliary(userId, finalInsProduct, insOrder);
+ });
+ } else {
+ // 鍒ゆ柇鏄惁鏄病鏈夋楠屽�肩殑鍐呭
+ if (saveInsContextDto.getIsNoTestValue() != null && saveInsContextDto.getIsNoTestValue() == 1) {
+ threadPoolTaskExecutor.execute(() -> {
+ this.addAuxiliary(userId, finalInsProduct, insOrder);
+ });
+ }
+ }
+
+ }
+ });
+ String sampleIdStr = insContext.keySet().stream().findFirst().orElse(null);
+ if (sampleIdStr != null) {
+ int count = insProductMapper.selectInsProductCountByOrderId(saveInsContextDto.getOrderId());
+ if (count == 0) {
+ insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, saveInsContextDto.getOrderId())
+ .eq(InsOrderState::getLaboratory, saveInsContextDto.getSonLaboratory())
+ .set(InsOrderState::getInsState, 2));
+ }
+ }
+
+
+ // 娣诲姞璁惧璁板綍
+ threadPoolTaskExecutor.execute(() -> {
+ // 娣诲姞璁惧浣跨敤璁板綍
+ addDeviceRecord(insSample, userId);
+ });
+ }
+
+ /**
+ * 鏂拌仛璁㈠崟鐨勫灞� key 鏄� templateId锛屼笉鏄� ins_product.id锛涘洜姝ゅ崟鐙寜妯℃澘蹇収淇濆瓨銆�
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void saveTemplateContext(SaveTemplateContextDto dto) {
+ if (dto.getOrderId() == null || dto.getSampleId() == null || dto.getTemplateId() == null) {
+ throw new ErrorException("璁㈠崟銆佹牱鍝佸拰妯℃澘涓嶈兘涓虹┖");
+ }
+ InsSample sample = insSampleMapper.selectById(dto.getSampleId());
+ if (sample == null || !Objects.equals(sample.getInsOrderId(), dto.getOrderId())) {
+ throw new ErrorException("鏍峰搧涓嶅睘浜庡綋鍓嶆楠屽崟");
+ }
+ InsOrderStandardTemplate snapshot = insOrderStandardTemplateService.getOne(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, dto.getOrderId())
+ .eq(InsOrderStandardTemplate::getTemplateId, dto.getTemplateId())
+ .last("limit 1"));
+ if (snapshot == null) {
+ throw new ErrorException("鏈壘鍒板綋鍓嶈鍗曠殑鍘熷璁板綍妯℃澘蹇収");
+ }
+ ensureDirectTemplateOrderState(dto.getOrderId());
+ List<InsProduct> products = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, dto.getSampleId())
+ .eq(InsProduct::getTemplateId, dto.getTemplateId())
+ .isNotNull(InsProduct::getTemplateRowIndex)
+ .eq(InsProduct::getState, 1));
+
+ JSONObject values = JSON.parseObject(JSON.toJSONString(dto.getValues() == null
+ ? Collections.emptyMap() : dto.getValues()));
+ // 妫�楠屾湡闂撮〉闈㈠睍绀虹殑鏄爣鍑嗙淮鎶や腑鐨勬渶鏂版ā鏉匡紝淇濆瓨鏍¢獙蹇呴』浣跨敤鍚屼竴浠芥ā鏉匡紝
+ // 閬垮厤妯℃澘鏂板鈥滃鍑哄�尖�濇壒娉ㄥ悗浠嶆寜涓嬪崟鏃剁殑鏃у揩鐓ц鎶ユ湭閰嶇疆銆�
+ String currentTemplateThing = getCurrentTemplateThing(snapshot);
+ List<String> exportValueCoordinates = getExportValueCoordinates(currentTemplateThing).values().stream()
+ .flatMap(Collection::stream)
+ .distinct()
+ .collect(Collectors.toList());
+ if (exportValueCoordinates.isEmpty()) {
+ throw new ErrorException("妯℃澘蹇呴』鑷冲皯閰嶇疆涓�涓鍑哄�兼壒娉�");
+ }
+
+ // 瀵煎嚭鍊兼寜妯℃澘閰嶇疆锛屼笉鍐嶈姹傛瘡涓楠岄」鍖哄潡鍒嗗埆閰嶇疆銆備竴涓ā鏉垮彇绗竴涓鍑哄�间綔涓虹粨鏋溿��
+ String exportValueCoordinate = exportValueCoordinates.get(0);
+ JSONObject exportValueCell = values.getJSONObject(exportValueCoordinate);
+ String exportValue = exportValueCell == null || exportValueCell.get("v") == null
+ ? "" : String.valueOf(exportValueCell.get("v"));
+ Integer userId = SecurityUtils.getUserId().intValue();
+ for (InsProduct product : products) {
+ InsProduct update = new InsProduct();
+ update.setId(product.getId());
+ update.setLastValue(exportValue);
+ update.setUpdateUser(userId);
+ insProductMapper.updateById(update);
+ insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), product.getId()));
+ }
+ snapshot.setRecordValues(values.toJSONString());
+ insOrderStandardTemplateService.updateById(snapshot);
+
+ if (hasSavedTemplateValue(values)) {
+ markInspectionStarted(dto.getOrderId(), products);
+ }
+
+ Long unfinished = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, dto.getSampleId())
+ .isNotNull(InsProduct::getTemplateRowIndex)
+ .eq(InsProduct::getState, 1)
+ .and(w -> w.isNull(InsProduct::getLastValue).or().eq(InsProduct::getLastValue, "")));
+ sample.setInsState(unfinished == 0 ? 2 : 1);
+ insSampleMapper.updateById(sample);
+ }
+
+ /**
+ * 绗竴娆℃垚鍔熶繚瀛樹换鎰忛潪绌烘ā鏉垮�兼椂锛岃褰曠湡瀹炴楠屽紑濮嬫椂闂村苟灏嗕换鍔′粠寰呮鏀逛负鍦ㄦ銆�
+ */
+ private void markInspectionStarted(Integer orderId, List<InsProduct> products) {
+ LocalDateTime now = LocalDateTime.now();
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, orderId)
+ .isNull(InsOrder::getFirstInspectDate)
+ .set(InsOrder::getFirstInspectDate, now)
+ // 淇濈暀鍘熷瓧娈典緵妫�楠屼换鍔″垪琛ㄤ腑鐨勨�滄楠屽紑濮嬫椂闂粹�濈户缁睍绀恒��
+ .set(InsOrder::getInsTime, now));
+
+ Set<String> laboratories = products.stream()
+ .map(InsProduct::getSonLaboratory)
+ .filter(StringUtils::isNotBlank)
+ .collect(Collectors.toSet());
+ if (laboratories.isEmpty() && isDirectTemplateOrder(orderId)) {
+ laboratories.add(DIRECT_TEMPLATE_LABORATORY);
+ }
+ if (!laboratories.isEmpty()) {
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, orderId)
+ .in(InsOrderState::getLaboratory, laboratories)
+ .eq(InsOrderState::getInsState, 0)
+ .set(InsOrderState::getInsTime, now)
+ .set(InsOrderState::getInsState, 1));
+ }
+ }
+
+ private boolean hasSavedTemplateValue(JSONObject values) {
+ if (values == null || values.isEmpty()) {
+ return false;
+ }
+ for (Object rawCell : values.values()) {
+ JSONObject cell = rawCell instanceof JSONObject
+ ? (JSONObject) rawCell
+ : JSON.parseObject(JSON.toJSONString(rawCell));
+ if (cell != null && hasMeaningfulValue(cell.get("v"))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean hasMeaningfulValue(Object value) {
+ if (value == null) {
+ return false;
+ }
+ if (value instanceof CharSequence) {
+ return StringUtils.isNotBlank(value.toString());
+ }
+ if (value instanceof Collection) {
+ return ((Collection<?>) value).stream().anyMatch(this::hasMeaningfulValue);
+ }
+ if (value instanceof Map) {
+ return ((Map<?, ?>) value).values().stream().anyMatch(this::hasMeaningfulValue);
+ }
+ return true;
+ }
+
+ private NavigableMap<Integer, List<String>> getExportValueCoordinates(String compressedThing) {
+ if (StrUtil.isBlank(compressedThing)) {
+ throw new ErrorException("鍘熷璁板綍妯℃澘涓虹┖");
+ }
+ String thing;
+ try {
+ thing = GZipUtil.uncompress(compressedThing);
+ } catch (Exception ignored) {
+ thing = compressedThing;
+ }
+ JSONObject sheet = JSON.parseObject(thing).getJSONArray("data").getJSONObject(0);
+ JSONArray cellData = sheet.getJSONArray("celldata");
+ NavigableMap<Integer, List<String>> result = new TreeMap<>();
+ for (Object item : cellData) {
+ JSONObject cell = JSON.parseObject(JSON.toJSONString(item));
+ JSONObject value = cell.getJSONObject("v");
+ JSONObject ps = value == null ? null : value.getJSONObject("ps");
+ if (ps == null || !"瀵煎嚭鍊�".equals(ps.getString("value"))) {
+ continue;
+ }
+ Integer row = cell.getInteger("r");
+ Integer column = cell.getInteger("c");
+ if (row != null && column != null) {
+ // 鎵规敞鍗曞厓鏍煎彲鑳芥í鍚戝悎骞讹紝鍙充晶缁撴灉鍗曞厓鏍间篃鍙兘绾靛悜鍚堝苟锛涙渶缁堣鍙栫粨鏋滃尯鍩熺殑宸︿笂瑙掑瓨鍌ㄥ潗鏍囥��
+ String coordinate = getRightAdjacentCoordinate(sheet, row, column);
+ result.computeIfAbsent(row, ignored -> new ArrayList<>()).add(coordinate);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 杩斿洖鎸囧畾鍗曞厓鏍硷紙鎴栧叾鎵�鍦ㄥ悎骞跺尯鍩燂級鍙充晶绱ч偦鍒楃殑涓嬫爣銆�
+ * Luckysheet 鐨勫悎骞朵俊鎭�氬父淇濆瓨鍦� config.merge锛涢儴鍒嗗巻鍙叉ā鏉垮彧鍦ㄥ崟鍏冩牸 v.mc 涓繚鐣欙紝
+ * 鍥犳涓ょ缁撴瀯閮借鍏煎銆�
+ */
+ private int getRightAdjacentColumn(JSONObject sheet, int row, int column) {
+ int rightEdge = column;
+ JSONObject config = sheet == null ? null : sheet.getJSONObject("config");
+ JSONObject merges = config == null ? null : config.getJSONObject("merge");
+ if (merges != null) {
+ for (Object rawMerge : merges.values()) {
+ rightEdge = extendMergedRightEdge(rightEdge, row, column, rawMerge);
+ }
+ }
+
+ JSONArray cellData = sheet == null ? null : sheet.getJSONArray("celldata");
+ if (cellData != null) {
+ for (Object rawCell : cellData) {
+ JSONObject cell = JSON.parseObject(JSON.toJSONString(rawCell));
+ JSONObject value = cell == null ? null : cell.getJSONObject("v");
+ JSONObject merge = value == null ? null : value.getJSONObject("mc");
+ rightEdge = extendMergedRightEdge(rightEdge, row, column, merge);
+ }
+ }
+ return rightEdge + 1;
+ }
+
+ private String getRightAdjacentCoordinate(JSONObject sheet, int row, int column) {
+ int adjacentColumn = getRightAdjacentColumn(sheet, row, column);
+ int[] anchor = findMergedAnchor(sheet, row, adjacentColumn);
+ return anchor[0] + "-" + anchor[1];
+ }
+
+ /**
+ * Luckysheet 鍙湪鍚堝苟鍖哄煙宸︿笂瑙掍繚瀛樺疄闄呭�笺�傝嫢鐩爣鍗曞厓鏍间綅浜庡悎骞跺尯鍩熷唴閮紝
+ * 灏嗗叾杞崲涓鸿鍖哄煙鐨勫乏涓婅鍧愭爣锛涙湭鍚堝苟鍒欒繑鍥炲師鍧愭爣銆�
+ */
+ private int[] findMergedAnchor(JSONObject sheet, int row, int column) {
+ JSONObject config = sheet == null ? null : sheet.getJSONObject("config");
+ JSONObject merges = config == null ? null : config.getJSONObject("merge");
+ if (merges != null) {
+ for (Object rawMerge : merges.values()) {
+ int[] anchor = findMergedAnchor(row, column, rawMerge);
+ if (anchor != null) {
+ return anchor;
+ }
+ }
+ }
+
+ JSONArray cellData = sheet == null ? null : sheet.getJSONArray("celldata");
+ if (cellData != null) {
+ for (Object rawCell : cellData) {
+ JSONObject cell = JSON.parseObject(JSON.toJSONString(rawCell));
+ JSONObject value = cell == null ? null : cell.getJSONObject("v");
+ int[] anchor = findMergedAnchor(row, column,
+ value == null ? null : value.getJSONObject("mc"));
+ if (anchor != null) {
+ return anchor;
+ }
+ }
+ }
+ return new int[]{row, column};
+ }
+
+ private int[] findMergedAnchor(int row, int column, Object rawMerge) {
+ if (rawMerge == null) {
+ return null;
+ }
+ JSONObject merge = rawMerge instanceof JSONObject
+ ? (JSONObject) rawMerge : JSON.parseObject(JSON.toJSONString(rawMerge));
+ Integer startRow = merge.getInteger("r");
+ Integer startColumn = merge.getInteger("c");
+ Integer rowSpan = merge.getInteger("rs");
+ Integer columnSpan = merge.getInteger("cs");
+ if (startRow == null || startColumn == null || rowSpan == null || columnSpan == null
+ || rowSpan < 1 || columnSpan < 1) {
+ return null;
+ }
+ if (row >= startRow && row < startRow + rowSpan
+ && column >= startColumn && column < startColumn + columnSpan) {
+ return new int[]{startRow, startColumn};
+ }
+ return null;
+ }
+
+ private int extendMergedRightEdge(int currentRightEdge, int row, int column, Object rawMerge) {
+ if (rawMerge == null) {
+ return currentRightEdge;
+ }
+ JSONObject merge = rawMerge instanceof JSONObject
+ ? (JSONObject) rawMerge : JSON.parseObject(JSON.toJSONString(rawMerge));
+ Integer startRow = merge.getInteger("r");
+ Integer startColumn = merge.getInteger("c");
+ Integer rowSpan = merge.getInteger("rs");
+ Integer columnSpan = merge.getInteger("cs");
+ if (startRow == null || startColumn == null || rowSpan == null || columnSpan == null
+ || rowSpan < 1 || columnSpan < 1) {
+ return currentRightEdge;
+ }
+ int endRow = startRow + rowSpan - 1;
+ int endColumn = startColumn + columnSpan - 1;
+ if (row >= startRow && row <= endRow && column >= startColumn && column <= endColumn) {
+ return Math.max(currentRightEdge, endColumn);
+ }
+ return currentRightEdge;
+ }
+
+ /**
+ * 妫�楠屼繚瀛樸�佹彁浜ゆ牎楠岃鍙栨爣鍑嗙淮鎶や腑鐨勫疄鏃舵ā鏉匡紱妯℃澘宸茶鍒犻櫎鎴栧唴瀹逛负绌烘椂鎵嶅洖閫�璁㈠崟蹇収銆�
+ * 妫�楠屽畬鎴愬悗鐨勫睍绀哄拰鎶ュ憡浠嶇敱璁㈠崟蹇収璐熻矗锛屼笉浼氶殢鏍囧噯妯℃澘鍚庣画淇敼鑰屽彉鍖栥��
+ */
+ private String getCurrentTemplateThing(InsOrderStandardTemplate snapshot) {
+ if (snapshot != null && snapshot.getTemplateId() != null) {
+ StandardTemplate currentTemplate = standardTemplateService.getById(snapshot.getTemplateId());
+ if (currentTemplate != null && StrUtil.isNotBlank(currentTemplate.getThing())) {
+ return currentTemplate.getThing();
+ }
+ }
+ return snapshot == null ? null : snapshot.getThing();
+ }
+
+ /**
+ * 鐩寸粦妯℃澘璁㈠崟鍙牎楠屾瘡涓�滃鍑哄�尖�濇壒娉ㄦ墍鍦ㄥ尯鍩熷彸渚х揣閭诲崟鍏冩牸锛屼笉浣跨敤妫�楠岄」鐘舵�佹垨 last_value 鍒ゅ畾銆�
+ */
+ private List<String> getMissingTemplateExportValues(Integer orderId) {
+ List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId)
+ .orderByAsc(InsOrderStandardTemplate::getSort, InsOrderStandardTemplate::getId));
+ List<String> missing = new ArrayList<>();
+ if (snapshots.isEmpty()) {
+ missing.add("褰撳墠璁㈠崟鏈壘鍒板師濮嬭褰曟ā鏉垮揩鐓�");
+ return missing;
+ }
+ for (InsOrderStandardTemplate snapshot : snapshots) {
+ Integer templateId = snapshot.getTemplateId();
+ List<String> coordinates = getExportValueCoordinates(getCurrentTemplateThing(snapshot)).values().stream()
+ .flatMap(Collection::stream)
+ .distinct()
+ .collect(Collectors.toList());
+ String templateName = StringUtils.defaultIfBlank(snapshot.getName(), "妯℃澘ID " + templateId);
+ if (coordinates.isEmpty()) {
+ missing.add(templateName + "锛堟湭閰嶇疆瀵煎嚭鍊硷級");
+ continue;
+ }
+
+ JSONObject recordValues = StrUtil.isBlank(snapshot.getRecordValues())
+ ? new JSONObject() : JSON.parseObject(snapshot.getRecordValues());
+ for (String coordinate : coordinates) {
+ JSONObject cell = recordValues.getJSONObject(coordinate);
+ Object value = cell == null ? null : cell.get("v");
+ if (value == null || StringUtils.isBlank(String.valueOf(value))) {
+ missing.add(templateName + "锛�" + coordinate + "锛�");
+ }
+ }
+ }
+ return missing;
+ }
+
+ @Override
+ public List<Integer> getOrderDeviceIds(Integer orderId) {
+ return insOrderDeviceRecordMapper.selectList(Wrappers.<InsOrderDeviceRecord>lambdaQuery()
+ .eq(InsOrderDeviceRecord::getInsOrderId, orderId))
+ .stream().map(InsOrderDeviceRecord::getDeviceId).filter(Objects::nonNull).distinct()
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void saveOrderDevices(SaveOrderDevicesDto dto) {
+ if (dto.getOrderId() == null || insOrderMapper.selectById(dto.getOrderId()) == null) {
+ throw new ErrorException("妫�楠屽崟涓嶅瓨鍦�");
+ }
+ Set<Integer> deviceIds = dto.getDeviceIds() == null ? Collections.emptySet() : dto.getDeviceIds().stream()
+ .filter(Objects::nonNull).collect(Collectors.toSet());
+ List<InsOrderDeviceRecord> oldRecords = insOrderDeviceRecordMapper.selectList(
+ Wrappers.<InsOrderDeviceRecord>lambdaQuery().eq(InsOrderDeviceRecord::getInsOrderId, dto.getOrderId()));
+ Set<Integer> oldIds = oldRecords.stream().map(InsOrderDeviceRecord::getDeviceId).collect(Collectors.toSet());
+ if (!oldIds.isEmpty()) {
+ insOrderDeviceRecordMapper.delete(Wrappers.<InsOrderDeviceRecord>lambdaQuery()
+ .eq(InsOrderDeviceRecord::getInsOrderId, dto.getOrderId())
+ .notIn(!deviceIds.isEmpty(), InsOrderDeviceRecord::getDeviceId, deviceIds));
+ }
+ InsOrder order = insOrderMapper.selectById(dto.getOrderId());
+ User user = userMapper.selectById(SecurityUtils.getUserId().intValue());
+ List<InsOrderDeviceRecord> additions = deviceIds.stream().filter(id -> !oldIds.contains(id)).map(id -> {
+ InsOrderDeviceRecord record = new InsOrderDeviceRecord();
+ record.setInsOrderId(dto.getOrderId());
+ record.setDeviceId(id);
+ record.setSampleCode(order.getEntrustCode());
+ record.setUseBefore(1);
+ record.setUseAfter(1);
+ record.setUsePersonId(user.getId());
+ record.setUsePerson(user.getName());
+ return record;
+ }).collect(Collectors.toList());
+ if (!additions.isEmpty()) {
+ insOrderDeviceRecordService.saveBatch(additions);
+ }
+ }
+
+ private synchronized void addDeviceRecord(InsSample insSample, Integer userId) {
+ InsOrder order = insOrderMapper.selectById(insSample.getInsOrderId());
+ User user = userMapper.selectById(userId);
+ // 鏌ヨ璁惧浣跨敤璁板綍鏌ヨ璇ヨ鍗曠殑浣跨敤璁板綍
+ List<InsOrderDeviceRecordDto> deviceRecordDtoList = insOrderDeviceRecordMapper.selectDeviceNumber(insSample.getInsOrderId());
+ Set<String> recordCodeset = deviceRecordDtoList.stream().map(InsOrderDeviceRecordDto::getManagementNumber).collect(Collectors.toSet());
+
+ // 鑾峰彇璁㈠崟璁惧缂栧彿
+ List<InsProductResult> resultList = insProductResultMapper.selectResultByOrderId(insSample.getInsOrderId());
+ Set<String> deviceCodeSet = new HashSet<>();
+ for (InsProductResult result : resultList) {
+ // 娣诲姞璁惧缂栧彿
+ List<JSONObject> jsonObjects = JSON.parseArray(result.getEquipValue(), JSONObject.class);
+ for (JSONObject jsonObject : jsonObjects) {
+ if (!"".equals(jsonObject.get("v") + "")) {
+ List<String> v = StrUtil.split(jsonObject.get("v") + "", "锛�");
+ deviceCodeSet.addAll(v);
+ }
+ }
+ }
+ // 1.鍒ゆ柇鏄惁鏈夋病鏈夋坊鍔犵殑浣跨敤璁板綍
+ Set<String> orderDeviceNumbers = getDeviceDifference(deviceCodeSet, recordCodeset);
+ // 娣诲姞浣跨敤璁板綍, 鏍规嵁缂栧彿鏌ヨ璁惧id
+ if (CollectionUtils.isNotEmpty(orderDeviceNumbers)) {
+ List<Integer> orderDeviceIds = insOrderDeviceRecordMapper.selectDeviceIdsByNumbers(orderDeviceNumbers);
+ List<InsOrderDeviceRecord> collect = orderDeviceIds.stream().map(deviceId -> {
+ InsOrderDeviceRecord insOrderDeviceRecord = new InsOrderDeviceRecord();
+ insOrderDeviceRecord.setInsOrderId(insSample.getInsOrderId());
+ insOrderDeviceRecord.setDeviceId(deviceId);
+ insOrderDeviceRecord.setSampleCode(order.getEntrustCode());
+ insOrderDeviceRecord.setUseBefore(1);
+ insOrderDeviceRecord.setUseAfter(1);
+ insOrderDeviceRecord.setUsePerson(user.getName());
+ insOrderDeviceRecord.setUsePersonId(user.getId());
+ return insOrderDeviceRecord;
+ }).collect(Collectors.toList());
+
+ insOrderDeviceRecordService.saveBatch(collect);
+
+ }
+
+ // 2.鍒ゆ柇鏄惁鍙栨秷浜嗚澶囦娇鐢�
+ Set<String> repoprNumbers = getDeviceDifference(recordCodeset, deviceCodeSet);
+ if (CollectionUtils.isNotEmpty(repoprNumbers)) {
+ List<Integer> reportDeviceIds = insOrderDeviceRecordMapper.selectDeviceIdsByNumbers(repoprNumbers);
+ insOrderDeviceRecordMapper.delete(Wrappers.<InsOrderDeviceRecord>lambdaQuery()
+ .in(InsOrderDeviceRecord::getDeviceId, reportDeviceIds)
+ .eq(InsOrderDeviceRecord::getInsOrderId, insSample.getInsOrderId()));
+ }
+ }
+
+ private static Set<String> getDeviceDifference(Set<String> number1, Set<String> number2) {
+ return number1.stream().filter(s1 -> number2.stream().noneMatch(s2 -> s1.equals(s2)))
+ .collect(Collectors.toSet());
+ }
+
+
+ //浜ゆ帴
+ @Override
+ public int upPlanUser(Integer userId, Integer orderId, String sonLaboratory) {
+ InsSampleUser insSampleUser = new InsSampleUser();
+ insSampleUser.setUserId(userId);
+ insSampleUser.setInsSampleId(orderId);
+ insSampleUser.setState(0);
+ insSampleUser.setSonLaboratory(sonLaboratory);
+ return insSampleUserMapper.insert(insSampleUser);
+ }
+
+ /**
+ * 鏌ヨ妯℃澘鍐呭
+ *
+ * @param order
+ * @param insProducts
+ */
+ private void getTemplateThing(InsOrder order, List<InsProduct> insProducts, String laboratory) {
+ Set<Integer> set = new HashSet<>();
+ Map<Integer, String> recordValuesByTemplate = new HashMap<>();
+ for (InsOrderStandardTemplate snapshot : insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, order.getId()))) {
+ // record_values 鍦ㄩ娆″~鍐欏墠鍏佽涓虹┖锛汣ollectors.toMap 涓嶆帴鍙� null value銆�
+ if (snapshot.getTemplateId() != null && snapshot.getRecordValues() != null) {
+ recordValuesByTemplate.putIfAbsent(snapshot.getTemplateId(), snapshot.getRecordValues());
+ }
+ }
+ boolean directTemplateOrder = insProducts.stream()
+ .anyMatch(product -> product.getTemplateRowIndex() != null);
+ Long snapshotCount = insOrderStandardTemplateService.count(Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, order.getId()));
+ InsOrderState insOrderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, order.getId())
+ .eq(StringUtils.isNotBlank(laboratory), InsOrderState::getLaboratory, laboratory)
+ .last("limit 1"));
+ Integer insState = insOrderState == null ? null : insOrderState.getInsState();
+ boolean hasSnapshot = snapshotCount > 0 && (directTemplateOrder
+ || Objects.equals(order.getIsFirstSubmit(), 1));
+ // 寰呮楠屻�佹楠屼腑浣跨敤鍩虹閰嶇疆鐨勬渶鏂版ā鏉匡紱宸叉楠屽強鍚庣画鐘舵�佷娇鐢ㄨ鍗曞揩鐓с��
+ boolean useSnapshot = hasSnapshot && insState != null && insState >= 2;
+ if (useSnapshot) {
+ for (InsProduct product : insProducts) {
+ if (product.getTemplateId() == null) {
+ product.setTemplate(new ArrayList<>());
+ continue;
+ }
+ if (set.add(product.getTemplateId())) {
+ InsOrderStandardTemplate one = insOrderStandardTemplateService.getOne(Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getTemplateId, product.getTemplateId())
+ .eq(InsOrderStandardTemplate::getInsOrderId, order.getId()));
+ if (one == null || StrUtil.isEmpty(one.getThing())) {
+ // 蹇収涓嶅畬鏁存椂鍏佽鍚庨潰鐨勬渶鏂版ā鏉挎煡璇㈠厹搴曘��
+ set.remove(product.getTemplateId());
+ continue;
+ }
+ String thing = GZipUtil.uncompress(one.getThing());
+ JSONObject sheet = JSON.parseObject(thing).getJSONArray("data").getJSONObject(0);
+ JSONObject config = sheet.getJSONObject("config");
+ List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class);
+ Map<String, Object> style = new HashMap<>();
+ style.put("rowlen", config.get("rowlen"));
+ style.put("columnlen", config.get("columnlen"));
+ product.setTemplate(cellData);
+ product.setStyle(style);
+ product.setTemplateName(one.getName());
+ }
+ }
+ }
+ for (InsProduct product : insProducts) {
+ if (product.getTemplateId() == null) {
+ product.setTemplate(new ArrayList<>());
+ continue;
+ }
+ String thing = null;
+ if (product.getTemplateId() != null && set.add(product.getTemplateId())) {
+ thing = standardTemplateService.getStandTempThingById(product.getTemplateId());
+ }
+ if (StrUtil.isNotEmpty(thing)) {
+ JSONObject sheet = JSON.parseObject(thing).getJSONArray("data").getJSONObject(0);
+ JSONObject config = sheet.getJSONObject("config");
+ List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class);
+ Map<String, Object> style = new HashMap<>();
+ style.put("rowlen", config.get("rowlen"));
+ style.put("columnlen", config.get("columnlen"));
+ product.setTemplate(cellData);
+ product.setStyle(style);
+ product.setTemplateName(standardTemplateService.getStandTempNameById(product.getTemplateId()));
+ }
+ product.setRecordValues(recordValuesByTemplate.get(product.getTemplateId()));
+ }
+ }
+
+ /**
+ * todo: 鍘熷璁板綍妯℃澘娓呴櫎娌℃湁浣跨敤鐨勬楠岄」(鏆傛椂鏈塨ug鏃犳硶浣跨敤)
+ *
+ * @param sheet
+ * @param itemNameList
+ */
+ private static void eliminateItem(JSONObject sheet, List<String> itemNameList) {
+ // 鑾峰彇鍒� 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴,濡傛灉妯℃澘閲岀殑淇℃伅璺熸帴鍙h繑鍥炵殑妫�楠岄」淇℃伅鑳藉鍖归厤鍒欏睍绀哄嚭鏉�
+
+ // 寰幆琛屾暟鍒ゆ柇鏄惁
+ JSONArray dataListJSONArray = sheet.getJSONArray("data");
+
+ // 娣诲姞鍧愭爣map
+ Map<String, String> coordinatesMap = new HashMap<>();
+
+ // 闇�瑕佺Щ闄ょ殑绱㈠紩
+ List<Integer> deleteIndex = new ArrayList<>();
+ // 寰幆鍒�
+ for (int r = 0; r < dataListJSONArray.size(); r++) {
+ JSONArray dataList = dataListJSONArray.getJSONArray(r);
+ // 寰幆琛�
+ String itemName = "";
+ // 鍒ゆ柇鏄惁鏄剧ず
+ boolean isShow = false;
+
+ for (int c = 0; c < dataList.size(); c++) {
+ // 鏌ヨ鎵规敞
+ JSONObject jsonObject = dataList.getJSONObject(c);
+ try {
+ if (jsonObject.getJSONObject("ps").getString("value").equals("妫�楠岄」鍒嗙被")) {
+ String value = jsonObject.getString("v").trim();
+ itemName += value;
+ // 娣诲姞鍧愭爣
+ String coordinates = coordinatesJoint(r, c);
+ coordinatesMap.put(coordinates, value);
+ isShow = true;
+ } else if (jsonObject.getJSONObject("ps").getString("value").equals("妫�楠岄」")) {
+ String value = jsonObject.getString("v").trim();
+ itemName += value;
+ // 娣诲姞鍧愭爣
+ String coordinates = coordinatesJoint(r, c);
+ coordinatesMap.put(coordinates, value);
+ isShow = true;
+ } else if (jsonObject.getJSONObject("ps").getString("value").equals("妫�楠屽瓙椤�")) {
+ String value = jsonObject.getString("v").trim();
+ itemName += value;
+ // 娣诲姞鍧愭爣
+ String coordinates = coordinatesJoint(r, c);
+ coordinatesMap.put(coordinates, value);
+ isShow = true;
+ }
+ } catch (Exception e) {
+ // 鍒ゆ柇鏄惁鏈塵c鍚堝苟鍗曞厓鏍�
+ if (jsonObject != null && jsonObject.getJSONObject("mc") != null) {
+ // 鏌ヨ鍧愭爣杩涜娣诲姞
+ String value = coordinatesMap.get(coordinatesJoint(jsonObject.getJSONObject("mc").getInteger("r"), jsonObject.getJSONObject("mc").getInteger("c")));
+ if (StringUtils.isNotBlank(value) && !itemName.contains(value)) {
+ itemName += value;
+ }
+ }
+ }
+ }
+ // 鍒ゆ柇璇ヨ鍗曟槸鍚︽湁鏀规楠岄」, 娌℃湁鍓旈櫎
+ if (isShow) {
+ if (!itemNameList.contains(itemName)) {
+ dataListJSONArray.remove(r);
+ r--;
+ }
+ }
+ }
+ }
+
+
+ /**
+ * 鍧愭爣鎷兼帴
+ *
+ * @param r 妯潗鏍�
+ * @param c 绾靛潗鏍�
+ * @return
+ */
+ private static String coordinatesJoint(int r, int c) {
+ String coordinates = "";
+ coordinates = "r:" + r + ",c:" + c;
+ return coordinates;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode, Boolean registerInsResults) {
+ ensureDirectTemplateOrderState(orderId);
+ int reportType = DETECTION_REPORT;
+ InsOrder order = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getId, orderId)
+ .last("FOR UPDATE"));
+ boolean isInspectionReport = Objects.equals(INSPECTION_REPORT, reportType);
+ registerInsResults = isInspectionReport && Boolean.TRUE.equals(registerInsResults);
+ // 1. 濮旀墭缂栧彿鍏ㄥ眬鍞竴锛屾彁浜ゅ鏍告椂鍐嶆鏍¢獙锛岄槻姝㈠苟鍙戞垨鍘嗗彶鏁版嵁缁曡繃鐢熸垚鏍¢獙銆�
+ Long codeCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
+ .ne(InsOrder::getId, orderId)
+ .eq(InsOrder::getEntrustCode, order.getEntrustCode()));
+ if (codeCount > 0) {
+ throw new ErrorException("鏍峰搧/濮旀墭鍗曞凡瀛樺湪锛岃纭鏍峰搧缂栧彿");
+ }
+
+ // 2. 鍒ゆ柇璇ヨ鍗曟槸鍚︽槸绗竴娆$敓浜�(鍚庣画鎶ュ憡鐢熸垚鍙彇绗竴娆℃彁浜ゆ椂闂�)
+ boolean firstSubmit = !Objects.equals(order.getIsFirstSubmit(), 1);
+ if (firstSubmit) {
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, orderId)
+ .set(InsOrder::getIsFirstSubmit, 1)
+ .set(InsOrder::getFirstSubmitDate, LocalDateTime.now()));
+ }
+
+ // 3. 鐩寸粦妯℃澘浠呮牎楠屸�滃鍑哄�尖�濓紱鏅�氳鍗曟部鐢ㄥ師妫�楠岄」鏍¢獙銆�
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, orderId).select(InsSample::getId));
+ List<Integer> InsSampleIds = insSamples.stream().map(InsSample::getId).collect(Collectors.toList());
+ boolean directTemplateOrder = isDirectTemplateOrder(orderId);
+ List<InsProduct> insProducts;
+ if (directTemplateOrder) {
+ List<String> missingExportValues = getMissingTemplateExportValues(orderId);
+ if (!missingExportValues.isEmpty()) {
+ throw new ErrorException("妯℃澘涓殑瀵煎嚭鍊间笉鑳戒负绌猴細\n" + String.join("\n", missingExportValues));
+ }
+ insProducts = Collections.emptyList();
+ } else {
+ insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .in(InsProduct::getInsSampleId, InsSampleIds)
+ .eq(InsProduct::getSonLaboratory, laboratory)
+ .eq(InsProduct::getState, 1)
+ .and(wrapper -> {
+ if (Objects.equals(reportType, DETECTION_REPORT)) {
+ wrapper.isNull(InsProduct::getLastValue).or().eq(InsProduct::getLastValue, "");
+ } else {
+ wrapper.isNull(InsProduct::getInsResult).or().eq(InsProduct::getInsResult, 2);
+ }
+ })
+ .ne(InsProduct::getIsBinding, 1));
+ }
+ if (!directTemplateOrder && Objects.equals(reportType, INSPECTION_REPORT)) {
+ List<InsProduct> insProducts1 = insProductMapper.selectFiberInsProduct(InsSampleIds, laboratory);
+ insProducts.addAll(insProducts1);
+ }
+ if (insProducts.size() > 0) {
+ String str = "";
+ int count = 0;
+ for (InsProduct product : insProducts) {
+ count++;
+ str += (count != 0 ? "\n" : "") + count + "锛�" +
+ product.getInspectionItemClass() + " " +
+ product.getInspectionItem() + " " +
+ product.getInspectionItemSubclass();
+ }
+ if (ObjectUtils.isNotEmpty(str)) {
+ throw new ErrorException("瀛樺湪寰呮楠岀殑椤圭洰锛�" + str);
+ }
+ }
+
+ // 4.淇敼妫�娴嬬粨鏋�
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId)
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .set(InsOrderState::getInsTime, LocalDateTime.now())
+ .set(InsOrderState::getInsState, 3)
+ .set(InsOrderState::getVerifyUser, verifyUser));
+
+
+ // 5.鍙戦�佹秷鎭�氱煡缁欏鏍镐汉
+ // 鏌ヨ褰撳墠浜轰俊鎭�
+ Integer userId = SecurityUtils.getUserId().intValue();
+ String userName = insProductMapper.selectUserById(userId).get("name");
+ // 鏌ヨ鍙戦�佷汉淇℃伅
+ String sendUserAccount = insProductMapper.selectUserById(verifyUser).get("account");
+ InformationNotification info = new InformationNotification();
+ info.setCreateUser(userName);
+ info.setMessageType("2");
+ info.setTheme("澶嶆牳閫氱煡");
+ info.setContent("鎮ㄦ湁涓�鏉℃楠屼换鍔″緟澶嶆牳娑堟伅, 缂栧彿:" + order.getEntrustCode());
+ info.setSenderId(userId);
+ info.setConsigneeId(verifyUser);
+ info.setViewStatus(false);
+ info.setJumpPath(MenuJumpPathConstants.INSPECTION_REVIEW);
+ informationNotificationService.addInformationNotification(info);
+
+ // 6.澶嶆牳浜�--鏂板妫�楠屽崟鐩稿叧璐熻矗浜�
+ InsSampleUser insSampleUser = new InsSampleUser();
+ insSampleUser.setUserId(verifyUser);
+ insSampleUser.setInsSampleId(orderId);
+ insSampleUser.setState(1);
+ insSampleUser.setSonLaboratory(laboratory);
+ insSampleUserMapper.insert(insSampleUser);
+
+ // 7.鏍¢獙涓�涓媟esult琛�(閬垮厤鍑虹幇澶氫釜妫�楠岄」缁撴灉)
+ threadPoolTaskExecutor.execute(() -> {
+ List<Integer> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList());
+ for (Integer ip : ips) {
+ List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
+ .eq(InsProductResult::getInsProductId, ip));
+ if (insProductResults.size() > 1) {
+ for (int i = 1; i < insProductResults.size(); i++) {
+ insProductResultMapper.deleteById(insProductResults.get(i));
+ }
+ }
+ }
+ });
+
+ // 8.棣栨鎻愪氦鏃跺皢鏈妫�楠屼娇鐢ㄧ殑鏈�鏂版ā鏉垮喕缁撲负璁㈠崟蹇収銆�
+ Long snapshotCount = insOrderStandardTemplateService.count(Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId));
+ if (firstSubmit || snapshotCount == 0) {
+ this.templateCopy(orderId, InsSampleIds);
+ }
+
+ // 9. 妫�娴嬫姤鍛婁粎鍦ㄥ叏閮ㄥ鏍搁�氳繃鏃剁敓鎴愶紝鎻愪氦澶嶆牳闃舵涓嶇敓鎴愭姤鍛娿��
+
+ // 10.鎴愬搧鎶芥牱娣诲姞鍚堟牸鐘舵��
+ // 鍒ゆ柇鏄惁鏈夋娊鏍蜂俊鎭�
+ if (isInspectionReport && order.getQuarterItemId() != null) {
+ // 鍒ゆ柇鏄惁鏈変笉鍚堟牸
+ this.addProductSpotCheck(insSamples, order);
+ }
+
+
+ // 11.娣诲姞璁㈠崟璐圭敤缁熻淇℃伅
+ List<InsProduct> productList = insProductMapper.selectProductByOrderId(orderId);
+ // 鍒犻櫎鍘熸湰璐圭敤淇℃伅
+ insOrderRatesService.remove(Wrappers.<InsOrderRates>lambdaQuery()
+ .eq(InsOrderRates::getInsOrderId, orderId));
+ List<InsOrderRates> orderRatesList = productList.stream().map(insProduct -> {
+ InsOrderRates insOrderRates = new InsOrderRates();
+ insOrderRates.setInsOrderId(orderId);
+ insOrderRates.setInsSampleId(insProduct.getInsSampleId());
+ insOrderRates.setInsProductId(insProduct.getId());
+ insOrderRates.setSampleCode(insProduct.getSampleCode());
+ insOrderRates.setEntrustCode(order.getEntrustCode());
+ insOrderRates.setInspectionItemClass(insProduct.getInspectionItemClass());
+ insOrderRates.setInspectionItem(insProduct.getInspectionItem());
+ insOrderRates.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());
+ insOrderRates.setCableTag(insProduct.getCableTag());
+ insOrderRates.setRates(insProduct.getRates());
+ insOrderRates.setManHourGroup(insProduct.getManHourGroup());
+ return insOrderRates;
+ }).collect(Collectors.toList());
+ insOrderRatesService.saveBatch(orderRatesList);
+
+
+ // 12.鍙戦�佷紒涓氬井淇¢�氱煡
+ // 鏌ヨ鍘熸潗鏂�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+ // 鏌ヨ鏍峰搧淇℃伅
+ InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, orderId)
+ .last("limit 1"));
+ threadPoolTaskExecutor.execute(() -> {
+ String message = "";
+ message += "妫�楠屼换鍔″鏍搁�氱煡";
+ message += "\n鎻愪氦浜�: " + userName;
+ message += "\n濮旀墭缂栧彿: " + order.getEntrustCode();
+ message += "\n鏍峰搧鍚嶇О: " + insSample.getModel();
+ message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail();
+ if (ifsInventoryQuantity != null) {
+ message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo();
+ }
+ //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡 鎻愪氦澶嶆牳
+ try {
+// WxCpUtils.inform(sendUserAccount, message, null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+
+ // 13.ifs绉诲簱(鍘熸潗鏂欓渶瑕佽繘琛岀Щ搴撴搷浣�) --> 鏈�鍚庢墽琛�,鍥犱负澶辫触鏃犳硶鍥炴粴
+ if (ifsInventoryQuantity != null && isInspectionReport) {
+ // 鐧昏妫�楠岀粨鏋�
+ // 鍒ゆ柇鏄惁鏈変笉鍚堟牸, 鏈変笉鍚堟牸涓嶈兘绉诲簱
+ // todo: ifs绉诲簱
+ insReportService.isRawMaterial(order, registerInsResults, false);
+
+ // 14 鍒ゆ柇褰撳墠鏍峰搧鏄惁涓哄師鏉愭枡, 鍘熸潗鏂欓渶瑕佽繘琛屾暟鎹垎鏋�, 鍒ゆ柇涔嬪墠10鏉℃暟鎹悓涓�涓緵搴斿晢, 鍚屼竴涓楠岄」鐨勫亸宸槸鍚﹁秴杩�10%
+ // 鏌ヨifs淇℃伅鑾峰彇鑾峰彇鍓�10涓緵搴斿晢涓�鏍风殑, 妫�楠岄」涓�鏍蜂俊鎭�
+ threadPoolTaskExecutor.execute(() -> {
+ // 娣诲姞鍒嗘瀽鏁版嵁
+ addAnalysis(productList, ifsInventoryQuantity, order, sendUserAccount);
+ });
+
+
+ } else if (isInspectionReport && !directTemplateOrder) {
+ // 淇敼鎴愬搧鐘舵��
+ // 鍒ゆ柇鏄惁鏈変笉鍚堟牸
+ Long unqualifiedCount = insReportService.getUnqualifiedCount(order);
+ if (unqualifiedCount.equals(0L)) {
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, order.getId())
+ .set(InsOrder::getInsResult, 1));
+ } else {
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, order.getId())
+ .set(InsOrder::getInsResult, 0));
+ }
+ }
+
+ return 1;
+ }
+
+ /**
+ * *****娣诲姞鍒嗘瀽鏁版嵁******
+ *
+ * @param productList
+ * @param ifsInventoryQuantity
+ * @param order
+ */
+ private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String sendUserAccount) {
+ for (InsProduct insProduct : productList) {
+ // 鍒ゆ柇鏄惁鏄暟鍊肩被鍨�
+ if ("1".equals(insProduct.getInspectionValueType()) && Objects.equals(insProduct.getInsResult(), 1)) {
+ List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName());
+
+ if (CollectionUtils.isEmpty(insProductAnalysisDtoList)) {
+ continue;
+ }
+
+ // 鍒ゆ柇褰撳墠妫�娴嬮」鏄惁鍋忓樊瓒呰繃10%
+ List<String> laseValueList = insProductAnalysisDtoList.stream().map(InsProductDeviationWarningDetail::getTestValue)
+ .collect(Collectors.toList());
+
+ double deviation = isDeviationOverTenPercent(laseValueList, insProduct.getLastValue());
+ // 鍒ゆ柇瑕佹眰鍊兼槸鍚﹀亸宸秴杩�10%
+ double asked = isDeviationOverTenPercentByAsked(insProduct.getAsk(), insProduct.getLastValue());
+ // 鍒ゆ柇鍋忓樊鏄惁澶т簬10
+ if (deviation > 10 || asked > 10) {
+ // 鍒ゆ柇涔嬪墠鏄惁娣诲姞杩�, 娣诲姞杩囦笉闇�瑕佹坊鍔�
+ long count = insProductDeviationWarningService.count(Wrappers.<InsProductDeviationWarning>lambdaQuery()
+ .eq(InsProductDeviationWarning::getInsProductId, insProduct.getId()));
+ if (count == 0L) {
+ // 鍙戦�侀�氱煡, 骞朵笖娣诲姞鏁版嵁
+ // 娣诲姞涓昏〃淇℃伅
+ InsProductDeviationWarning deviationWarning = new InsProductDeviationWarning();
+ deviationWarning.setInsOrderId(order.getId());
+ deviationWarning.setInsSampleId(insProduct.getInsSampleId());
+ deviationWarning.setInsProductId(insProduct.getId());
+ deviationWarning.setEntrustCode(order.getEntrustCode());
+ deviationWarning.setSampleCode(insProduct.getSampleCode());
+ deviationWarning.setSupplierName(ifsInventoryQuantity.getSupplierName());
+ deviationWarning.setDeviationValue(Double.toString(deviation));
+ deviationWarning.setDetectionTime(insProduct.getUpdateTime());
+ insProductDeviationWarningService.save(deviationWarning);
+
+ // 娣诲姞璇︽儏鏁版嵁
+ InsProductDeviationWarningDetail deviationWarningDetail = new InsProductDeviationWarningDetail();
+ deviationWarningDetail.setInsOrderId(order.getId());
+ deviationWarningDetail.setInsSampleId(insProduct.getInsSampleId());
+ deviationWarningDetail.setInsProductId(insProduct.getId());
+ deviationWarningDetail.setEntrustCode(order.getEntrustCode());
+ deviationWarningDetail.setSampleCode(insProduct.getSampleCode());
+ deviationWarningDetail.setSupplierName(ifsInventoryQuantity.getSupplierName());
+ deviationWarningDetail.setTestValue(insProduct.getLastValue());
+ deviationWarningDetail.setDetectionTime(insProduct.getCreateTime());
+ deviationWarningDetail.setIsIssue(deviation > 10 ? 1 : 0);
+ deviationWarningDetail.setIsIssueAsked(asked > 10 ? 1 : 0);
+
+ insProductAnalysisDtoList.add(deviationWarningDetail);
+
+ // 娣诲姞id
+ for (InsProductDeviationWarningDetail warningDetail : insProductAnalysisDtoList) {
+ warningDetail.setDeviationWarningId(deviationWarning.getDeviationWarningId());
+ }
+
+ insProductDeviationWarningDetailService.saveBatch(insProductAnalysisDtoList);
+
+ //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡 妫�楠岄」棰勮棰勮閫氱煡
+ try {
+ String message = "";
+ message += "妫�楠岄」棰勮棰勮閫氱煡";
+ message += "\n濮旀墭缂栧彿: " + order.getEntrustCode();
+ message += "\n鏍峰搧鍚嶇О: " + order.getSample();
+ message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail();
+ message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo();
+ message += "\n渚涘簲鍟嗗悕绉�: " + ifsInventoryQuantity.getSupplierName();
+ message += "\n妫�楠岄」: " + insProduct.getInspectionItem() + insProduct.getInspectionItemSubclass();
+ message += "\n鍋忓樊瓒呰繃浜� 10%";
+ // 鍙戦�佺粰鎻愪氦浜�
+// WxCpUtils.inform(sendUserAccount, message, null);
+//
+// // todo: 鍙戦�佺粰妫�娴嬩腑蹇冧富浠�(鍥哄畾姝�)
+// WxCpUtils.inform("ZT-004704", message, null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("鍋忓樊棰勮浼佷笟寰俊閫氱煡鎶ラ敊");
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * *****璁$畻鍋忓樊****
+ *
+ * @param data
+ * @param targetStr
+ * @return
+ */
+ public static double isDeviationOverTenPercent(List<String> data, String targetStr) {
+ if (data.isEmpty()) {
+ return 0;
+ }
+ List<Double> doubleData = data.stream()
+ .map(Double::parseDouble)
+ .collect(Collectors.toList());
+ double sum = doubleData.stream().mapToDouble(Double::doubleValue).sum();
+ double average = sum / doubleData.size();
+
+ double target = Double.parseDouble(targetStr);
+ double deviationPercent = Math.abs(target - average) / average * 100;
+
+ // 淇濈暀涓や綅灏忔暟
+ DecimalFormat df = new DecimalFormat("#.00");
+ String formatted = df.format(deviationPercent);
+ return Double.parseDouble(formatted);
+ }
+
+ /**
+ * *****璁$畻鍋忓樊锛堣姹傚�硷級****
+ *
+ * @param asked
+ * @param targetStr
+ * @return
+ */
+ public static double isDeviationOverTenPercentByAsked(String asked, String targetStr) {
+ if (!isNumeric(asked)) return 0;
+ double average = Double.parseDouble(asked);
+ double target = Double.parseDouble(targetStr);
+ double deviationPercent = Math.abs(target - average) / average * 100;
+
+ // 淇濈暀涓や綅灏忔暟
+ DecimalFormat df = new DecimalFormat("#.00");
+ String formatted = df.format(deviationPercent);
+ return Double.parseDouble(formatted);
+ }
+
+ /**
+ * ******鍘熷璁板綍妯℃澘澶嶅埗*****
+ *
+ * @param orderId
+ * @param ids
+ */
+ private void templateCopy(Integer orderId, List<Integer> ids) {
+ // 淇濈暀妯℃澘椤电椤哄簭锛屽苟鍦ㄩ娆℃彁浜ゅ鏍告椂鐢ㄦ楠屾湡闂撮噰鐢ㄧ殑鏈�鏂版ā鏉垮埛鏂板揩鐓с��
+ // 鐩寸粦妯℃澘璁㈠崟蹇呴』浠ュ師璁㈠崟蹇収涓烘ā鏉挎竻鍗曪紝涓嶈兘鍙寜 ins_product 閲嶅缓锛�
+ // 娌℃湁鈥滄楠岄」鈥濇爣璁扮殑妯℃澘涓嶄細鐢熸垚 ins_product锛屽惁鍒欐彁浜ゅ悗浼氳閿欒鍒犻櫎銆�
+ List<InsOrderStandardTemplate> oldSnapshots = insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId)
+ .orderByAsc(InsOrderStandardTemplate::getSort, InsOrderStandardTemplate::getId));
+ Map<Integer, Integer> templateSortMap = new HashMap<>();
+ Map<Integer, String> templateRecordValuesMap = new HashMap<>();
+ Map<Integer, String> templateTemperatureMap = new HashMap<>();
+ Map<Integer, String> templateHumidityMap = new HashMap<>();
+ Map<Integer, InsOrderStandardTemplate> oldSnapshotMap = new LinkedHashMap<>();
+ int nextTemplateSort = 0;
+ for (InsOrderStandardTemplate snapshot : oldSnapshots) {
+ if (snapshot.getTemplateId() != null) {
+ oldSnapshotMap.putIfAbsent(snapshot.getTemplateId(), snapshot);
+ if (snapshot.getSort() != null) {
+ templateSortMap.putIfAbsent(snapshot.getTemplateId(), snapshot.getSort());
+ nextTemplateSort = Math.max(nextTemplateSort, snapshot.getSort() + 1);
+ }
+ if (snapshot.getRecordValues() != null) {
+ templateRecordValuesMap.putIfAbsent(snapshot.getTemplateId(), snapshot.getRecordValues());
+ }
+ if (snapshot.getTemperature() != null) {
+ templateTemperatureMap.putIfAbsent(snapshot.getTemplateId(), snapshot.getTemperature());
+ }
+ if (snapshot.getHumidity() != null) {
+ templateHumidityMap.putIfAbsent(snapshot.getTemplateId(), snapshot.getHumidity());
+ }
+ }
+ }
+
+ LinkedHashSet<Integer> templateIds = new LinkedHashSet<>();
+ if (isDirectTemplateOrder(orderId)) {
+ // 鍏堝姞鍏ヨ鍗曞師鏉ョ粦瀹氱殑鍏ㄩ儴妯℃澘锛屽寘鎷笉鐢熸垚妫�楠岄」璁板綍鐨勬ā鏉裤��
+ templateIds.addAll(oldSnapshotMap.keySet());
+ }
+ List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .in(InsProduct::getInsSampleId, ids)
+ .select(InsProduct::getTemplateId));
+ insProductList.stream()
+ .map(InsProduct::getTemplateId)
+ .filter(Objects::nonNull)
+ .forEach(templateIds::add);
+
+ List<InsOrderStandardTemplate> refreshedSnapshots = new ArrayList<>();
+ for (Integer templateId : templateIds) {
+ StandardTemplate standardTemplate = standardTemplateService.getById(templateId);
+ InsOrderStandardTemplate oldSnapshot = oldSnapshotMap.get(templateId);
+ if (standardTemplate == null && oldSnapshot == null) {
+ continue;
+ }
+ InsOrderStandardTemplate refreshed = new InsOrderStandardTemplate();
+ refreshed.setInsOrderId(orderId);
+ refreshed.setTemplateId(templateId);
+ refreshed.setNumber(standardTemplate == null ? oldSnapshot.getNumber() : standardTemplate.getNumber());
+ refreshed.setName(standardTemplate == null ? oldSnapshot.getName() : standardTemplate.getName());
+ refreshed.setRemark(standardTemplate == null ? oldSnapshot.getRemark() : standardTemplate.getRemark());
+ refreshed.setThing(standardTemplate == null ? oldSnapshot.getThing() : standardTemplate.getThing());
+ refreshed.setRecordValues(templateRecordValuesMap.get(templateId));
+ refreshed.setTemperature(templateTemperatureMap.get(templateId));
+ refreshed.setHumidity(templateHumidityMap.get(templateId));
+ // 鍒锋柊妯℃澘缁撴瀯鏃跺繀椤讳繚鐣欐楠岄樁娈靛~鍐欑殑涓氬姟鏁版嵁锛岄伩鍏嶈繘鍏ュ鏍稿悗鍥炴樉涓虹┖銆�
+ refreshed.setDetectionTime(oldSnapshot == null ? null : oldSnapshot.getDetectionTime());
+ refreshed.setDetectionPlace(oldSnapshot == null ? null : oldSnapshot.getDetectionPlace());
+ refreshed.setInsResult(oldSnapshot == null ? null : oldSnapshot.getInsResult());
+ Integer templateSort = templateSortMap.get(templateId);
+ refreshed.setSort(templateSort == null ? nextTemplateSort++ : templateSort);
+ refreshedSnapshots.add(refreshed);
+ }
+
+ // 鏂板揩鐓у凡瀹屾暣缁勮鍚庡啀鏇挎崲锛涗簨鍔″け璐ユ椂浼氭暣浣撳洖婊氥��
+ insOrderStandardTemplateService.remove(Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId));
+ if (!refreshedSnapshots.isEmpty()) {
+ insOrderStandardTemplateService.saveBatch(refreshedSnapshots);
+ }
+ }
+
+
+ /**
+ * 妫�楠屼换鍔″鏍�
+ *
+ * @param orderId
+ * @param laboratory
+ * @param type
+ * @param tell
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int rawMaterialVerifyPlan(Integer orderId, String laboratory, Integer type, String tell, Integer userId) {
+ VerifyPlanDto dto = new VerifyPlanDto();
+ dto.setOrderId(orderId);
+ dto.setLaboratory(laboratory);
+ dto.setType(type);
+ dto.setTell(tell);
+ dto.setUserId(userId);
+ return rawMaterialVerifyPlan(dto);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int rawMaterialVerifyPlan(VerifyPlanDto dto) {
+ Integer orderId = dto.getOrderId();
+ String laboratory = dto.getLaboratory();
+ Integer type = dto.getType();
+ String tell = dto.getTell();
+ Integer userId = dto.getUserId();
+ if (orderId == null || laboratory == null || type == null) {
+ throw new ErrorException("澶嶆牳鍙傛暟涓嶅畬鏁�");
+ }
+ ensureDirectTemplateOrderState(orderId);
+ InsOrderState currentState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, orderId)
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .last("limit 1"));
+ InsReport existingReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getInsOrderId, orderId)
+ .last("limit 1"));
+ boolean directTemplateOrder = isDirectTemplateOrder(orderId);
+ if (currentState != null && Objects.equals(currentState.getInsState(), 5)
+ && existingReport != null && StringUtils.isNotBlank(existingReport.getUrl())
+ && (!directTemplateOrder || StringUtils.isNotBlank(existingReport.getInspectionUrl()))) {
+ // 闃叉澶嶆牳椤甸潰閲嶅鐐瑰嚮鎴栫綉缁滈噸璇曢噸澶嶇敓鎴愭姤鍛娿�侀噸澶嶅彂璧锋姤鍛婂鎵广��
+ return 1;
+ }
+ if (directTemplateOrder && Objects.equals(type, 1)
+ && !Objects.equals(dto.getInsResult(), 0) && !Objects.equals(dto.getInsResult(), 1)) {
+ throw new ErrorException("璇烽�夋嫨妫�楠屽崟缁撹");
+ }
+ Integer num = (type == 1 ? 5 : 4);
+ LocalDateTime now = LocalDateTime.now();
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, orderId)
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .set(InsOrderState::getInsTime, now)
+ .set(InsOrderState::getInsState, num)
+ .set(InsOrderState::getVerifyTell, tell)
+ .set(InsOrderState::getVerifyUser, SecurityUtils.getUserId().intValue()));
+ Long count = insOrderStateMapper.selectCount(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, orderId)
+ .ne(InsOrderState::getInsState, 5));
+ InsReport report = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getInsOrderId, orderId)
+ .last("limit 1"));
+ Integer writeUserId = report != null && report.getWriteUserId() != null
+ ? report.getWriteUserId() : resolveInspectionUserId(orderId, laboratory);
+ // 鏌ヨ璁㈠崟
+ InsOrder order = insOrderMapper.selectById(orderId);
+ if (directTemplateOrder && Objects.equals(type, 1)) {
+ List<Integer> templateResults = insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId)
+ .select(InsOrderStandardTemplate::getInsResult))
+ .stream().map(InsOrderStandardTemplate::getInsResult)
+ .collect(Collectors.toList());
+ if (templateResults.isEmpty()
+ || templateResults.stream().anyMatch(result -> !Objects.equals(result, 0)
+ && !Objects.equals(result, 1))) {
+ throw new ErrorException("璇峰厛濉啓鍏ㄩ儴妯℃澘鐨勬楠岀粨璁�");
+ }
+ Integer aggregateResult = templateResults.stream().allMatch(result -> Objects.equals(result, 1))
+ ? 1 : 0;
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, orderId)
+ .set(InsOrder::getInsResult, aggregateResult));
+ order.setInsResult(aggregateResult);
+ }
+ if (count == 0 && num == 5) {
+ // 淇敼璁㈠崟鐘舵��
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, orderId)
+ .set(InsOrder::getInsState, 5));
+
+ // 妫�楠屼汉鍛樻彁浜ゅ鏍告椂涓嶇敓鎴愭姤鍛婏紱鍏ㄩ儴璇曢獙瀹ゅ鏍搁�氳繃鍚庣敓鎴愭姤鍛娿��
+ if (report == null || StringUtils.isBlank(report.getUrl())) {
+ this.generateReport(orderId, DETECTION_REPORT, writeUserId);
+ }
+ // 鐩寸粦妯℃澘璁㈠崟鍚屾椂鐢熸垚妫�楠屾姤鍛婏紝涓や唤鏂囦欢鍏辩敤鍚屼竴鏉″鎵硅褰曘��
+ if (directTemplateOrder && (report == null || StringUtils.isBlank(report.getInspectionUrl()))) {
+ this.generateReport(orderId, INSPECTION_REPORT, writeUserId);
+ }
+ report = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getInsOrderId, orderId)
+ .last("limit 1"));
+ if (report == null || StringUtils.isBlank(report.getUrl())) {
+ throw new ErrorException("妫�娴嬫姤鍛婄敓鎴愬け璐�");
+ }
+ if (directTemplateOrder && StringUtils.isBlank(report.getInspectionUrl())) {
+ throw new ErrorException("妫�楠屾姤鍛婄敓鎴愬け璐�");
+ }
+ if (report.getTempUrlPdf() == null) {
+ String tempUrlPdf = this.wordToPdfTemp(report.getUrl().replace("/word", wordUrl));
+ report.setTempUrlPdf("/word/" + tempUrlPdf);
+ }
+ report.setIsPass(1);
+ insReportMapper.updateById(report);
+
+ //鐢熸垚鍘熸潗鏂欒繘璐ч獙璇佸師濮嬭褰曞埌闄勪欢閲�
+ if (order.getTypeSource() != null && order.getTypeSource().equals(1)) {
+ this.reportFactoryVerify(orderId, userId, writeUserId);
+ }
+
+ // 鏌ヨ妫�楠屼换鍔$殑妫�楠屼换鍔�
+ // 鎶ュ憡鐩栦笂鎵瑰噯浜�
+ insReportService.writeReport(report.getId(), userId, writeUserId);
+
+ // 妫�楠屼汉
+ String userName = insProductMapper.selectUserById(writeUserId).get("name");
+
+ // 澶嶆牳浜�
+ Integer checkUserId = SecurityUtils.getUserId().intValue();
+ String chenkUserName = insProductMapper.selectUserById(checkUserId).get("name");
+
+ // 瀹℃牳浜�
+ String sendUserAccount = insProductMapper.selectUserById(userId).get("account");
+
+ // 鍙戦�佷紒涓氬井淇¢�氱煡(閫氱煡瀹℃牳浜哄鎵�)
+ threadPoolTaskExecutor.execute(() -> {
+
+ InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, orderId)
+ .last("limit 1"));
+ // 鏌ヨ鍘熸潗鏂�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+
+ String message = "";
+ message += "鎶ュ憡缂栧埗瀹℃壒閫氱煡";
+ message += "\n妫�楠屼汉: " + userName;
+ message += "\n澶嶆牳浜�: " + chenkUserName;
+ message += "\n濮旀墭缂栧彿: " + order.getEntrustCode();
+ message += "\n鏍峰搧鍚嶇О: " + insSample.getModel();
+ message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail();
+ if (ifsInventoryQuantity != null) {
+ message += "\n鐢熶骇鍘傚: " + ifsInventoryQuantity.getSupplierName();
+ message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo();
+ }
+ //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡 鎻愪氦澶嶆牳
+ try {
+ WxCpUtils.inform(sendUserAccount, message, null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+
+
+ } else {
+ //澶嶆牳涓嶉�氳繃灏嗘妸澶嶆牳鐨勮礋璐d汉鍘绘帀
+ Integer id = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getId).last("limit 1")).getId();
+ insSampleUserMapper.deleteById(id);
+
+ // 褰撳墠瀹℃牳浜�
+ Integer currentUserId = SecurityUtils.getUserId().intValue();
+ String userName = insProductMapper.selectUserById(currentUserId).get("name");
+
+ // 鍙戦�佹秷鎭殑浜�
+ // 鏌ヨ鍙戦�佷汉淇℃伅
+ String sendUserAccount = insProductMapper.selectUserById(writeUserId).get("account");
+
+ // 鍙戦�佷紒涓氬井淇¢�氱煡(妫�楠屼换鍔¢��鍥�)
+ threadPoolTaskExecutor.execute(() -> {
+ // 鏌ヨ璁㈠崟
+ InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, orderId)
+ .last("limit 1"));
+ // 鏌ヨ鍘熸潗鏂�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+
+ String message = "";
+ message += "妫�楠屼换鍔″鏍搁��鍥為�氱煡";
+ message += "\n澶嶆牳浜�: " + userName;
+ message += "\n濮旀墭缂栧彿: " + order.getEntrustCode();
+ message += "\n鏍峰搧鍚嶇О: " + insSample.getModel();
+ message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail();
+ if (ifsInventoryQuantity != null) {
+ message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo();
+ }
+ message += "\n閫�鍥炲師鍥�: " + tell;
+ //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡 鎻愪氦澶嶆牳
+ try {
+ WxCpUtils.inform(sendUserAccount, message, null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+ return 1;
+ }
+
+ private boolean isDirectTemplateOrder(Integer orderId) {
+ List<InsSample> samples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, orderId));
+ if (samples.isEmpty()) {
+ return false;
+ }
+ Long snapshotCount = insOrderStandardTemplateService.count(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId));
+ InsOrder order = snapshotCount == 0 ? null : insOrderMapper.selectById(orderId);
+ if (order != null && samples.stream().anyMatch(sample -> isDirectTemplateSample(order, sample))) {
+ return true;
+ }
+ // 鍏煎宸茬粡鐢熸垚浜嗘ā鏉胯鍙枫�佷絾璁㈠崟鍩虹瀛楁涓嶅畬鏁寸殑鍘嗗彶鐩寸粦璁㈠崟銆�
+ return insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
+ .in(InsProduct::getInsSampleId, samples.stream().map(InsSample::getId).collect(Collectors.toList()))
+ .isNotNull(InsProduct::getTemplateRowIndex)) > 0;
+ }
+
+ /**
+ * 鍏煎淇涓婄嚎鍓嶅凡缁忎笅鍙戙�佷絾鍥犳病鏈� ins_product 鑰岀己灏戜换鍔$姸鎬佺殑鐩寸粦妯℃澘璁㈠崟銆�
+ */
+ private void ensureDirectTemplateOrderState(Integer orderId) {
+ if (!isDirectTemplateOrder(orderId)) {
+ return;
+ }
+ Long stateCount = insOrderStateMapper.selectCount(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, orderId)
+ .eq(InsOrderState::getLaboratory, DIRECT_TEMPLATE_LABORATORY));
+ if (stateCount > 0) {
+ return;
+ }
+ InsOrderState state = new InsOrderState();
+ state.setInsOrderId(orderId);
+ state.setLaboratory(DIRECT_TEMPLATE_LABORATORY);
+ state.setInsState(0);
+ insOrderStateMapper.insert(state);
+ }
+
+ private Integer resolveInspectionUserId(Integer orderId, String laboratory) {
+ InsSampleUser inspector = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery()
+ .eq(InsSampleUser::getInsSampleId, orderId)
+ .eq(InsSampleUser::getState, 0)
+ .eq(StringUtils.isNotBlank(laboratory), InsSampleUser::getSonLaboratory, laboratory)
+ .orderByDesc(InsSampleUser::getId)
+ .last("limit 1"));
+ if (inspector == null || inspector.getUserId() == null) {
+ throw new ErrorException("鎵句笉鍒板綋鍓嶆楠屼换鍔$殑妫�楠屼汉锛屾棤娉曠敓鎴愭娴嬫姤鍛�");
+ }
+ return inspector.getUserId();
+ }
+
+ /**
+ * 閲嶆柊鐢熸垚灏氭湭鎵瑰噯鐨勭郴缁熸姤鍛婏紝骞舵仮澶嶅凡瀛樺湪鐨勭紪鍒躲�佸鏍哥鍚嶃��
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void regenerateReport(Integer reportId, Integer createOrderUser) {
+ if (reportId == null) {
+ throw new ErrorException("鎶ュ憡涓嶈兘涓虹┖");
+ }
+ InsReport accessibleReport = insReportMapper.selectDownloadableReport(reportId, createOrderUser);
+ if (accessibleReport == null) {
+ throw new ErrorException("鎶ュ憡涓嶅瓨鍦ㄣ�佸皻鏈敓鎴愭垨鏃犳潈鎿嶄綔");
+ }
+ // 鏁版嵁搴撹閿侀伩鍏嶅悓涓�鎶ュ憡琚浜哄悓鏃堕噸鏂扮敓鎴愬苟瑕嗙洊銆�
+ InsReport report = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getId, reportId)
+ .last("FOR UPDATE"));
+ if (report == null) {
+ throw new ErrorException("鎶ュ憡涓嶅瓨鍦�");
+ }
+ if (Objects.equals(report.getIsRatify(), 1)) {
+ throw new ErrorException("宸叉壒鍑嗘姤鍛婁笉鑳介噸鏂扮敓鎴�");
+ }
+ if (StringUtils.isNotBlank(report.getUrlS())) {
+ throw new ErrorException("褰撳墠鎶ュ憡宸叉墜鍔ㄤ笂浼狅紝璇峰厛杩樺師涓虹郴缁熸姤鍛婂悗鍐嶉噸鏂扮敓鎴�");
+ }
+ if (report.getInsOrderId() == null) {
+ throw new ErrorException("鎶ュ憡鏈叧鑱旀楠屽崟锛屾棤娉曢噸鏂扮敓鎴�");
+ }
+
+ Integer reportType = report.getReportType() == null ? DETECTION_REPORT : report.getReportType();
+ Integer writeUserId = report.getWriteUserId() == null
+ ? SecurityUtils.getUserId().intValue() : report.getWriteUserId();
+ boolean directTemplateOrder = isDirectTemplateOrder(report.getInsOrderId());
+ if (directTemplateOrder) {
+ generateReport(report.getInsOrderId(), DETECTION_REPORT, writeUserId);
+ generateReport(report.getInsOrderId(), INSPECTION_REPORT, writeUserId);
+ } else {
+ generateReport(report.getInsOrderId(), reportType, writeUserId);
+ }
+
+ InsReport regenerated = insReportMapper.selectById(reportId);
+ if (regenerated == null || StringUtils.isBlank(regenerated.getUrl())) {
+ throw new ErrorException("鎶ュ憡閲嶆柊鐢熸垚澶辫触");
+ }
+ if (directTemplateOrder && StringUtils.isBlank(regenerated.getInspectionUrl())) {
+ throw new ErrorException("妫�楠屾姤鍛婇噸鏂扮敓鎴愬け璐�");
+ }
+ String reportPath = regenerated.getUrl().replace("/word", wordUrl);
+ Map<String, Object> marks = buildExistingReportMarks(report);
+ if (!marks.isEmpty()) {
+ insReportService.wordInsertUrl(marks, reportPath);
+ if (StringUtils.isNotBlank(regenerated.getInspectionUrl())) {
+ insReportService.wordInsertUrl(marks,
+ regenerated.getInspectionUrl().replace("/word", wordUrl));
+ }
+ }
+ String tempPdfName = wordToPdfTemp(reportPath);
+ if (StringUtils.isBlank(tempPdfName)) {
+ throw new ErrorException("鎶ュ憡棰勮鏂囦欢鐢熸垚澶辫触");
+ }
+ // generateReport 浼氬啓鍏ュ綋鍓嶆椂闂达紱閲嶆柊鐢熸垚涓嶅簲鏀瑰彉鍘熷鎵硅褰曟椂闂淬��
+ insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate()
+ .eq(InsReport::getId, reportId)
+ .set(InsReport::getWriteTime, report.getWriteTime())
+ .set(InsReport::getTempUrlPdf, "/word/" + tempPdfName));
+ }
+
+ private Map<String, Object> buildExistingReportMarks(InsReport report) {
+ Map<String, Object> marks = new HashMap<>();
+ boolean submitted = Objects.equals(report.getState(), 1)
+ || report.getIsExamine() != null
+ || report.getExamineTime() != null;
+ if (submitted) {
+ User writer = getReportSigner(report.getWriteUserId(), "缂栧埗浜�");
+ marks.put("writeUrl", ReportSignaturePictureUtils.create(imgUrl, writer.getSignatureUrl()));
+ marks.put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(report.getWriteTime())).create());
+ marks.put("insUrl", ReportSignaturePictureUtils.create(imgUrl, writer.getSignatureUrl()));
+ }
+ if (Objects.equals(report.getIsExamine(), 1)) {
+ User examiner = getReportSigner(report.getExamineUserId(), "瀹℃牳浜�");
+ marks.put("examineUrl", ReportSignaturePictureUtils.create(imgUrl, examiner.getSignatureUrl()));
+ marks.put("examineDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(report.getExamineTime())).create());
+ }
+ return marks;
+ }
+
+ private User getReportSigner(Integer userId, String roleName) {
+ User user = userId == null ? null : userMapper.selectById(userId);
+ if (user == null || StringUtils.isBlank(user.getSignatureUrl())) {
+ throw new ErrorException("鎵句笉鍒�" + roleName + "鐨勭鍚�");
+ }
+ return user;
+ }
+
+ /**
+ * 鐢熸垚鎶ュ憡
+ *
+ * @param orderId
+ */
+ private void generateReport(Integer orderId, Integer reportType, Integer writeUserId) {
+ /*鏍峰搧涓嬬殑椤圭洰鍙鏈変竴涓」鐩笉鍚堟牸鍒欐楠岀粨鏋滀负0,鍚﹀垯涓�1*/
+ //杩欓噷鐨刬nsSamples鏄鍗曚笅鐨勬墍鏈夋牱鍝佸寘鎷�("/")
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
+ if (Objects.equals(reportType, INSPECTION_REPORT)) {
+ for (InsSample insSample : insSamples) {
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, insSample.getId())
+ .eq(InsProduct::getState, 1)
+ .ne(InsProduct::getIsBinding, 1));
+ List<Integer> results = insProducts.stream().map(InsProduct::getInsResult).filter(Objects::nonNull).collect(Collectors.toList());
+ if (results.contains(0)) {
+ insSample.setInsResult(0);
+ } else {
+ insSample.setInsResult(1);
+ }
+ insSampleMapper.updateById(insSample);
+ }
+ }
+ InsOrder insOrder = insOrderMapper.selectById(orderId);
+ // 鎶芥鍙樻垚濮旀墭妫�楠�
+ if (insOrder.getOrderType().equals(InsOrderTypeConstants.SPOT_CHECK)) {
+ insOrder.setOrderType(InsOrderTypeConstants.CUSTOMER_ORDERED);
+ }
+
+ // 鍒ゆ柇鏄ぇ鎶ュ憡杩樻槸灏忔姤鍛� 杩涘巶灏忔姤鍛�, 鍏朵粬閮芥槸澶ф姤鍛�
+ if (insOrder.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) {
+ // 鐢熸垚灏忔姤鍛�
+ addSmallReport(orderId, insOrder, insSamples, reportType, writeUserId);
+ } else {
+ //鐢熸垚澶ф姤鍛�
+ addBitReport(orderId, insOrder, reportType, writeUserId);
+ }
+
+ }
+
+
+ /**
+ * 鐢电紗閰嶇疆, 鏌ョ湅閰嶇疆鏍囪瘑
+ *
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ @Override
+ public List<Map<String, Object>> getCableTag(Integer id, String laboratory) {
+ return insSampleMapper.getCableTag(id, laboratory);
+ }
+
+ /**
+ * 鍘熸潗鏂欐煡鐪嬫爣璇�
+ *
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ @Override
+ public List<Map<String, Object>> getRawMaterialTag(Integer id, String laboratory) {
+ return insSampleMapper.getRawMaterialTag(id, laboratory);
+ }
+
+ /**
+ * 鏌ョ湅閲嶅鏍囪瘑
+ *
+ * @param id
+ * @param laboratory
+ * @return
+ */
+ @Override
+ public List<Map<String, Object>> getRepetitionTag(Integer id, String laboratory, String cableTag) {
+ return insSampleMapper.getRepetitionTag(id, laboratory, cableTag);
+ }
+
+ /**
+ * 鏂板涓嶅悎鏍煎娴嬪唴瀹�
+ *
+ * @return
+ */
+ @Override
+ public boolean addDisqualificationRetest(List<InsProduct> insProductsList) {
+ List<Integer> ids = insProductsList.stream().map(InsProduct::getId).collect(Collectors.toList());
+
+ // 鍒ゆ柇涔嬪墠鏄惁娣诲姞杩�
+ Long count = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery()
+ .in(InsUnqualifiedRetestProduct::getInsProductId, ids));
+ if (count > 0) {
+ throw new ErrorException("鏈夋楠岄」妫�娣诲姞杩囧娴嬩俊鎭�");
+ }
+
+ // 鏌ヨ涓嶅悎鏍煎唴瀹�
+ List<InsUnqualifiedRetestProduct> list = insUnqualifiedRetestProductMapper.selectRetestProduct(ids);
+ // 寰幆鍒ゆ柇鏄惁鏄粦瀹氬��, 缁戝畾鍊间慨鏀规楠岃姹�
+ for (InsUnqualifiedRetestProduct insUnqualifiedRetestProduct : list) {
+ for (InsProduct insProduct : insProductsList) {
+ if (insProduct.getIsBinding().equals(1)) {
+ insUnqualifiedRetestProduct.setIsBinding(1);
+ insUnqualifiedRetestProduct.setAsk(null);
+ insUnqualifiedRetestProduct.setTell(null);
+ insUnqualifiedRetestProduct.setPrice(null);
+ insUnqualifiedRetestProduct.setManHour(null);
+ insUnqualifiedRetestProduct.setSection(null);
+ }
+ }
+ }
+
+ // 鏂板涓嶅悎鏍煎唴瀹�
+ insUnqualifiedRetestProductService.saveBatch(list);
+ list.forEach(insUnqualifiedRetestProduct -> {
+ insUnqualifiedRetestProduct.setRetestTag("2");
+ insUnqualifiedRetestProduct.setId(null);
+ });
+ insUnqualifiedRetestProductService.saveBatch(list);
+ return true;
+ }
+
+ @Override
+ public List<InsProduct> getInsProductUnqualifiedRetest(InsOrderPlanProductDto dto) {
+
+ List<InsProduct> insProducts = new ArrayList<>();
+ switch (dto.getType()) {
+ case 0:
+ case 4:
+ //濮旀墭
+ insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), dto.getRetestTag());
+ break;
+ case 5:
+ //鍘熸潗鏂欎笅鍗�
+ insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), dto.getRetestTag());
+ break;
+ }
+ if (BeanUtil.isEmpty(insProducts)) {
+ return null;
+ }
+ InsOrder order = insOrderMapper.selectFirstSubmit(dto.getId());
+ getTemplateThing(order, Collections.unmodifiableList(insProducts), dto.getLaboratory());
+ return insProducts;
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void saveUnqualifiedContext(Map<String, Object> insContext, Integer currentTable, Integer currentSampleId, Integer orderId, String sonLaboratory) {
+ Integer userId = SecurityUtils.getUserId().intValue();
+ insContext.forEach((k, v) -> {
+ JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
+ InsUnqualifiedRetestProduct insProduct = new InsUnqualifiedRetestProduct();
+ insProduct.setId(Integer.parseInt(k));
+ InsUnqualifiedRetestProduct product = insUnqualifiedRetestProductMapper.selectById(insProduct.getId());
+ if (currentTable.equals(product.getTemplateId()) && currentSampleId.equals(product.getInsSampleId())) {
+ List<InsUnqualifiedRetestResult> oldResults = insUnqualifiedRetestResultMapper.selectList(Wrappers.<InsUnqualifiedRetestResult>lambdaQuery()
+ .eq(InsUnqualifiedRetestResult::getRetestProductId, insProduct.getId()));
+ InsUnqualifiedRetestResult newResult = new InsUnqualifiedRetestResult();
+ if (CollectionUtils.isNotEmpty(oldResults)) {
+ BeanUtil.copyProperties(oldResults.get(0), newResult);
+ }
+ newResult.setRetestProductId(Integer.parseInt(k));
+ /*鏍¢獙涓�涓媟esult琛�*/
+ if (oldResults.size() > 1) {
+ for (int i = 1; i < oldResults.size(); i++) {
+ insUnqualifiedRetestResultMapper.deleteById(oldResults.get(i));
+ }
+ }
+ //妫�楠屽��
+ if (jo.get("insValue") != null) {
+ JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue")));
+ List<Map<String, Object>> iv = new ArrayList<>();
+ for (Object o : jsonArray) {
+ JSONObject insValue = JSON.parseObject(JSON.toJSONString(o));
+ Map<String, Object> map = new HashMap<>();
+ map.put("v", JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v"));
+ map.put("r", JSON.toJSONString(insValue.get("r")));
+ map.put("c", JSON.toJSONString(insValue.get("c")));
+ map.put("w", insValue.get("w"));
+ try {
+ if ((insValue.get("u") == null || insValue.get("u").equals("")) && StrUtil.isNotEmpty(JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v").toString())) {
+ map.put("u", userId + "");
+ } else {
+ map.put("u", insValue.get("u"));
+ }
+ iv.add(map);
+ } catch (Exception e) {
+ }
+ }
+ newResult.setInsValue(JSON.toJSONString(iv));
+ }
+ //璁$畻鍊�
+ if (jo.get("comValue") != null && !Objects.equals(jo.get("comValue"), "")) {
+ JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("comValue")));
+ List<Map<String, Object>> cv = new ArrayList<>();
+ for (Object o : jsonArray2) {
+ JSONObject comValue = JSON.parseObject(JSON.toJSONString(o));
+ Map<String, Object> map = new HashMap<>();
+ map.put("r", JSON.toJSONString(comValue.get("r")));
+ map.put("c", JSON.toJSONString(comValue.get("c")));
+ map.put("v", JSON.parseObject(JSON.toJSONString(comValue.get("v"))).get("v"));
+ cv.add(map);
+ }
+ newResult.setComValue(JSON.toJSONString(cv));
+ }
+ //鏈�缁堝��
+ try {
+ JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue")));
+ if (resValue.get("v") != null) {
+ Object o = JSON.parseObject(JSON.toJSONString(resValue.get("v"))).get("v");
+ insProduct.setLastValue(o.equals("") ? null : (o.toString()));
+ }
+ } catch (Exception e) {
+ insProduct.setLastValue("");//''
+ }
+ //璁惧缂栧彿
+ if (jo.get("equipValue") != null) {
+ JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipValue")));
+ List<Map<String, Object>> ev = new ArrayList<>();
+ for (Object o : jsonArray2) {
+ JSONObject equipValue = JSON.parseObject(JSON.toJSONString(o));
+ Map<String, Object> map = new HashMap<>();
+ map.put("v", JSON.parseObject(JSON.toJSONString(equipValue.get("v"))).get("v"));
+ ev.add(map);
+ }
+ newResult.setEquipValue(JSON.toJSONString(ev));
+ }
+ //璁惧鍚嶇О
+ if (jo.get("equipName") != null) {
+ JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipName")));
+ List<Map<String, Object>> ev = new ArrayList<>();
+ for (Object o : jsonArray2) {
+ JSONObject equipValue = JSON.parseObject(JSON.toJSONString(o));
+ Map<String, Object> map = new HashMap<>();
+ map.put("v", JSON.parseObject(JSON.toJSONString(equipValue.get("v"))).get("v"));
+ ev.add(map);
+ }
+ newResult.setEquipName(JSON.toJSONString(ev));
+ }
+ //缁撹
+ try {
+ JSONObject insResult = JSON.parseObject(JSON.toJSONString(jo.get("insResult")));
+ String ir = JSON.parseObject(JSON.toJSONString(insResult.get("v"))).get("v") + "";
+ insProduct.setInsResult(Integer.parseInt(ir));
+ } catch (Exception e) {
+ insProduct.setInsResult(2);//寰呭畾
+ }
+ if (Objects.isNull(newResult.getId())) {
+ newResult.setCreateUser(userId);
+ newResult.setUpdateUser(userId);
+ insUnqualifiedRetestResultMapper.insert(newResult);
+ } else {
+ newResult.setUpdateUser(userId);
+ newResult.setUpdateTime(LocalDateTime.now());
+ insUnqualifiedRetestResultMapper.updateById(newResult);
+ }
+
+ insProduct.setUpdateUser(userId);
+ insUnqualifiedRetestProductMapper.updateById(insProduct);
+ insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId()));
+
+
+ /*鏍¢獙涓�涓媟esult琛�*/
+ List<InsUnqualifiedRetestResult> insProductResults = insUnqualifiedRetestResultMapper.selectList(Wrappers.<InsUnqualifiedRetestResult>lambdaQuery()
+ .eq(InsUnqualifiedRetestResult::getRetestProductId, product.getId()));
+ if (insProductResults.size() > 1) {
+ for (int i = 1; i < insProductResults.size(); i++) {
+ insUnqualifiedRetestResultMapper.deleteById(insProductResults.get(i));
+ }
+ }
+
+ }
+ });
+
+ }
+
+ /**
+ * 鏌ヨ杩涜揣鍘熷璁板綍
+ *
+ * @param insOrderId
+ * @return
+ */
+ @Override
+ public InsOrderFactoryVerify getFactoryVerify(Integer insOrderId) {
+ InsOrderFactoryVerify insOrderFactoryVerify = insOrderFactoryVerifyMapper.selectOne(Wrappers.<InsOrderFactoryVerify>lambdaQuery()
+ .eq(InsOrderFactoryVerify::getInsOrderId, insOrderId)
+ .last("limit 1"));
+ // 鍒ゆ柇鏌ヨ鏌ヨ鏄惁涓虹┖
+ if (insOrderFactoryVerify == null) {
+ insOrderFactoryVerify = new InsOrderFactoryVerify();
+ // 鏌ヨ涓嬪崟
+ InsOrder order = insOrderMapper.selectById(insOrderId);
+ // 鏌ヨ妫�楠岄」鐩〃
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, insOrderId));
+
+ //鏌ヨ瑙勬牸淇″彿
+ List<String> insSamplemodel = insSamples.stream().map(insSample -> insSample.getModel()).collect(Collectors.toList());
+ String model = CollUtil.join(insSamplemodel, ",");
+
+ // 鏌ヨ鍘熸潗鏂欎俊鎭�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+ if (ifsInventoryQuantity == null) {
+ throw new ErrorException("缂哄皯鍘熸潗鏂欎俊鎭�");
+ }
+
+ // 妫�楠岀紪鍙�
+ insOrderFactoryVerify.setEntrustCode(order.getEntrustCode());
+ // 鏉愭枡鍘傚
+ insOrderFactoryVerify.setSupplierName(ifsInventoryQuantity.getSupplierName());
+ // 鍒拌揣鏃ユ湡
+ insOrderFactoryVerify.setDeclareDate(ifsInventoryQuantity.getDeclareDate());
+ // 鏉愭枡鍚嶇О
+ insOrderFactoryVerify.setSample(order.getSample());
+ // 瑙勬牸鍨嬪彿
+ insOrderFactoryVerify.setModel(model);
+ // 鏉愭枡鎵瑰彿
+ insOrderFactoryVerify.setUpdateBatchNo(ifsInventoryQuantity.getUpdateBatchNo());
+
+ insOrderFactoryVerify.setInsOrderId(insOrderId);
+
+ return insOrderFactoryVerify;
+ }
+
+ // 鏌ヨ楠岃瘉椤圭洰
+ List<InsOrderFactoryVerifyItem> verifyItems = insOrderFactoryVerifyItemService.list(Wrappers.<InsOrderFactoryVerifyItem>lambdaQuery()
+ .eq(InsOrderFactoryVerifyItem::getFactoryVerifyId, insOrderFactoryVerify.getFactoryVerifyId())
+ .orderByAsc(InsOrderFactoryVerifyItem::getSort));
+ insOrderFactoryVerify.setFactoryVerifyItemList(verifyItems);
+ return insOrderFactoryVerify;
+ }
+
+ /**
+ * 淇濆瓨鍘熸潗鏂欒繘璐ч獙璇�
+ *
+ * @param factoryVerify
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean addFactoryVerify(InsOrderFactoryVerify factoryVerify) {
+ if (factoryVerify.getInsOrderId() == null) {
+ throw new ErrorException("缂哄皯璁㈠崟Id");
+ }
+
+ // 鍒ゆ柇鏄柊澧炶繕鏄慨鏀�
+ if (factoryVerify.getFactoryVerifyId() == null) {
+ // 鍒ゆ柇涔嬪墠鏄惁娣诲姞杩�
+ Long count = insOrderFactoryVerifyMapper.selectCount(Wrappers.<InsOrderFactoryVerify>lambdaQuery()
+ .eq(InsOrderFactoryVerify::getInsOrderId, factoryVerify.getInsOrderId()));
+ if (count > 0) {
+ throw new ErrorException("鍘熸潗鏂欒繘璐ч獙璇佽褰曢噸澶嶆坊鍔�");
+ }
+
+ // 鏂板
+ insOrderFactoryVerifyMapper.insert(factoryVerify);
+
+ for (InsOrderFactoryVerifyItem item : factoryVerify.getFactoryVerifyItemList()) {
+ item.setFactoryVerifyId(factoryVerify.getFactoryVerifyId());
+ }
+
+ // 鎵归噺娣诲姞
+ insOrderFactoryVerifyItemService.saveBatch(factoryVerify.getFactoryVerifyItemList());
+
+ } else {
+ // 缂栬緫
+ insOrderFactoryVerifyMapper.updateById(factoryVerify);
+
+ // 鍒犻櫎鍘熸湰楠岃瘉椤圭洰
+ insOrderFactoryVerifyItemService.remove(Wrappers.<InsOrderFactoryVerifyItem>lambdaQuery()
+ .eq(InsOrderFactoryVerifyItem::getFactoryVerifyId, factoryVerify.getFactoryVerifyId()));
+
+ for (InsOrderFactoryVerifyItem item : factoryVerify.getFactoryVerifyItemList()) {
+ item.setFactoryVerifyId(factoryVerify.getFactoryVerifyId());
+ }
+
+ insOrderFactoryVerifyItemService.saveBatch(factoryVerify.getFactoryVerifyItemList());
+ }
+
+ return true;
+ }
+
+ /***************************************************** 灏忔姤鍛� ***************************************************************************/
+
+ /**
+ * 璁剧疆琛ㄦ牸鏍峰紡
+ *
+ * @param max 鏍囪瘑鏈�澶т釜鏁�
+ * @return
+ */
+ private TableStyle setTableStyle(int max, boolean showResult) {
+ //璁剧疆鏍峰紡
+ TableStyle tableStyle = new TableStyle();
+ if (!showResult) {
+ switch (max) {
+ case 1:
+ tableStyle.setColWidths(new int[]{650, 3000, 850, 2400, 3100});
+ break;
+ case 2:
+ tableStyle.setColWidths(new int[]{650, 2800, 850, 2200, 1750, 1750});
+ break;
+ case 3:
+ tableStyle.setColWidths(new int[]{650, 2600, 850, 1800, 1400, 1400, 1400});
+ break;
+ case 4:
+ tableStyle.setColWidths(new int[]{650, 2400, 850, 1600, 1125, 1125, 1125, 1125});
+ break;
+ case 5:
+ tableStyle.setColWidths(new int[]{650, 2200, 850, 1500, 960, 960, 960, 960, 960});
+ break;
+ default:
+ break;
+ }
+ } else if (max <= 5) {
+ for (int i = 1; i <= max; i++) {
+ // 鏍规嵁妫�楠岀粨鏋滀釜鏁颁慨鏀归暱搴�
+ switch (i) {
+ case 1:
+ tableStyle.setColWidths(new int[]{650, 2900, 850, 2300, 2100, 1200});
+ break;
+ case 2:
+ tableStyle.setColWidths(new int[]{650, 2700, 850, 2200, 1200, 1200, 1200});
+ break;
+ case 3:
+ tableStyle.setColWidths(new int[]{650, 2700, 850, 1600, 1000, 1000, 1000, 1200});
+ break;
+ case 4:
+ tableStyle.setColWidths(new int[]{650, 2400, 850, 1500, 850, 850, 850, 850, 1200});
+ break;
+ case 5:
+ tableStyle.setColWidths(new int[]{650, 2200, 850, 1350, 770, 770, 770, 770, 770, 1100});
+ break;
+ }
+ }
+ }
+
+ tableStyle.setWidth("10000");
+ tableStyle.setAlign(TableRowAlign.CENTER);
+ BorderStyle borderStyle = new BorderStyle();
+ borderStyle.setColor("000000");
+ borderStyle.setType(XWPFTable.XWPFBorderType.SINGLE);
+ borderStyle.setSize(4);
+ tableStyle.setLeftBorder(borderStyle);
+ tableStyle.setRightBorder(borderStyle);
+ tableStyle.setInsideHBorder(borderStyle); // 璁剧疆姘村钩鍐呰竟妗�
+ tableStyle.setInsideVBorder(borderStyle);
+ return tableStyle;
+ }
+
+
+ /**
+ * 澶勭悊鏈夌數缂嗛鑹叉爣璇嗙殑妫�娴嬮」
+ *
+ * @param cableTags 鐢电紗棰滆壊鏍囪瘑
+ * @param collect 妫�娴嬮」鍒楄〃
+ * @param startIndex 璧峰涓嬫爣
+ * @param endIndex 缁撴潫涓嬫爣
+ * @return
+ */
+ private List<SampleProductExportDto> transformSampleProduct(List<String> cableTags, Map<String, List<SampleProductExportDto>> collect, int startIndex, int endIndex) {
+ List<SampleProductExportDto> sampleProductExportDtos = new ArrayList<>();
+ for (String s : collect.keySet()) {
+ List<String> lastValueList = new ArrayList<>();
+ SampleProductExportDto dto = new SampleProductExportDto();
+ BeanUtil.copyProperties(collect.get(s).get(0), dto);
+ Set<String> tellSet = new HashSet<>();
+ for (int i = startIndex; i < endIndex; i++) {
+ String cableTag = cableTags.get(i);
+ for (SampleProductExportDto sDto : collect.get(s)) {
+ tellSet.add(sDto.getTell());
+ if (sDto.getCableTag().equals(cableTag)) {
+ lastValueList.add(sDto.getLastValue());
+ }
+ }
+ }
+ //鍒囧壊鐢电紗閰嶇疆椤�
+ dto.setTell(String.join("\n", tellSet));
+ dto.setLastValueList(lastValueList);
+ sampleProductExportDtos.add(dto);
+ }
+ return sampleProductExportDtos;
+ }
+
+ /**
+ * 妫�娴嬮」鎺掑簭
+ *
+ * @param sourceMap
+ * @param targetMap
+ */
+ private void sortSampleProduct(Map<String, List<SampleProductExportDto>> sourceMap, Map<String, List<SampleProductExportDto>> targetMap) {
+ List<Map.Entry<String, List<SampleProductExportDto>>> entries = new ArrayList<>(sourceMap.entrySet());
+ entries.sort(Comparator.comparingInt(o -> (o.getValue().get(0).getSort() == null ? 0 : o.getValue().get(0).getSort())));
+ for (Map.Entry<String, List<SampleProductExportDto>> entry : entries) {
+ targetMap.put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ /**
+ * 灏忔姤鍛婄敓鎴�
+ *
+ * @param orderId
+ * @param insOrder
+ * @param insSamples
+ */
+ private void addSmallReport(Integer orderId, InsOrder insOrder, List<InsSample> insSamples, Integer reportType, Integer writeUserId) {
+ InsReport insReport = new InsReport();
+ AtomicReference<String> resultCh = new AtomicReference<>("");
+ boolean showResult = Objects.equals(reportType, INSPECTION_REPORT);
+ insReport.setCode(insOrder.getEntrustCode());
+ insReport.setInsOrderId(orderId);
+ insReport.setReportType(reportType);
+ InsSample insSample = insSamples.get(0);
+ // 濉厖鍩虹鏁版嵁
+ EnterFactoryReport enterFactoryReport = new EnterFactoryReport();
+ enterFactoryReport.setCode(insOrder.getEntrustCode());
+ enterFactoryReport.setSample(insOrder.getSample());
+ // 鑾峰彇ifs鏁版嵁
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId());
+ //鏌ヨ闆朵欢灞炴��
+ IfsPartPropsRecord ifsPartPropsRecord = ifsPartPropsRecordMapper.selectOne(Wrappers.<IfsPartPropsRecord>lambdaQuery()
+ .eq(IfsPartPropsRecord::getIfsInventoryId, ifsInventoryQuantity.getId()));
+ if (Objects.nonNull(ifsPartPropsRecord)) {
+ enterFactoryReport.setOuterColor(ifsPartPropsRecord.getOuterColor());
+ }
+ enterFactoryReport.setQtyArrived(ifsInventoryQuantity.getQtyArrived() == null ? "" :
+ ifsInventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + ifsInventoryQuantity.getBuyUnitMeas());
+ enterFactoryReport.setQuantity(insOrder.getTestQuantity());
+ enterFactoryReport.setPartDesc(insOrder.getPartDetail());
+ enterFactoryReport.setSupplierName(ifsInventoryQuantity.getSupplierName());
+ enterFactoryReport.setLotBatchNo(ifsInventoryQuantity.getUpdateBatchNo());
+
+ // 妫�娴嬩緷鎹�
+ Set<String> standardMethod = new LinkedHashSet<>();
+ StringBuilder standardMethod2 = new StringBuilder();
+ String reportStandardMethod = baseMapper.getStandardMethodReportText(insSample.getStandardMethodListId());
+ if (StringUtils.isNotBlank(reportStandardMethod)) {
+ standardMethod.add(reportStandardMethod);
+ }
+ for (String s : standardMethod) {
+ standardMethod2.append("銆�").append(s);
+ }
+ if (standardMethod2.length() > 0) {
+ standardMethod2.deleteCharAt(0);
+ }
+
+ // 鏍峰搧绫诲瀷
+ String orderType = iSysDictTypeService.selectLabelByDict(DictDataConstants.CHECK_TYPE, insOrder.getOrderType());
+
+ List<RowRenderData> rows = new ArrayList<>();
+ List<TextRenderData> text = new ArrayList<>();
+ RowRenderData rowRenderData = null;
+ List<Map<String, Object>> cableTagEnclosureTables = new ArrayList<>();
+
+ // 鏌ヨ妫�楠屽唴瀹�
+ List<SampleProductExportDto> sampleProductDto2s = insOrderMapper.selectSampleBySampleId(insSamples.stream()
+ .map(InsSample::getId).collect(Collectors.toList()));
+
+ // 鏍煎紡鍖栦慨鏀规楠岄」
+ this.formatProducts(sampleProductDto2s);
+
+ List<SampleProductExportDto> sampleList = new ArrayList<>();
+ Integer max = insSamples.stream().mapToInt(InsSample::getQuantity).sum();
+ TableRenderData tableRenderData = new TableRenderData();
+ String templateName;
+ if (StringUtils.equals(OrderType.WG.getValue(), ifsInventoryQuantity.getOrderType())) {
+ //杩囨护涓嶅垽瀹氱殑妫�娴嬮」
+ List<SampleProductExportDto> filterItems = sampleProductDto2s.stream()
+ .filter(f -> !showResult || f.getInsResult() != 3)
+ .collect(Collectors.toList());
+ int maxCableTag = 5;//鍗曚釜琛ㄦ牸锛岀數缂嗛鑹叉爣璇嗘渶澶т釜鏁�
+ templateName = showResult ? "/static/small-wg-report-template.docx" : "/static/small-wg-detection-template.docx";
+ //鏌ヨ妫�楠屽崟娑堟伅
+ InsSampleUserVO insSampleUser = insSampleUserMapper.selectUserNameByOrderId(orderId);
+ if (Objects.nonNull(insSampleUser)) {
+ enterFactoryReport.setPartDesc(insSampleUser.getModel());
+ enterFactoryReport.setInspector(insSampleUser.getInspector());
+ enterFactoryReport.setInspectDate(insSampleUser.getInspectDate());
+ }
+
+ Map<String, List<SampleProductExportDto>> totalItem = new LinkedHashMap<>();//妫�娴嬮」鍒楄〃
+ Map<String, List<SampleProductExportDto>> cableTagItem = new LinkedHashMap<>();//鐢电紗閰嶇疆妫�娴嬮」
+ Map<String, List<SampleProductExportDto>> cableTagEnclosureItem = new LinkedHashMap<>();//鐢电紗閰嶇疆妫�娴嬮」闄勪欢
+
+ AtomicInteger finalIndex = new AtomicInteger(1);
+ List<String> cableTags = insOrderMapper.selectSampleCableTag(insSample.getId());
+ max = Math.max(cableTags.size(), 1);
+ //澶勭悊鐢电紗閰嶇疆妫�娴嬮」
+ Map<String, List<SampleProductExportDto>> tempMap = new HashMap<>();
+ Map<String, List<SampleProductExportDto>> tempMap2 = new HashMap<>();
+ Map<String, List<SampleProductExportDto>> listMap2 = filterItems.stream()
+ .filter(f -> StringUtils.isNotBlank(f.getCableTag()) && StringUtils.isNotBlank(f.getInspectionItem()))
+ .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItem));
+ for (String key : listMap2.keySet()) {
+ List<SampleProductExportDto> sampleProductExportDtos;
+ List<SampleProductExportDto> sampleProductExportDtos2;
+ //澶勭悊鐢电紗閰嶇疆椤�
+ Map<String, List<SampleProductExportDto>> collect = listMap2.get(key).stream().collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItemSubclass));
+ if (cableTags.size() > maxCableTag) {
+ sampleProductExportDtos = transformSampleProduct(cableTags, collect, 0, maxCableTag);
+ sampleProductExportDtos2 = transformSampleProduct(cableTags, collect, maxCableTag, cableTags.size());
+ tempMap2.put(key, sampleProductExportDtos2);
+ } else {
+ sampleProductExportDtos = transformSampleProduct(cableTags, collect, 0, cableTags.size());
+ }
+ cableTagItem.put(key, sampleProductExportDtos);
+ }
+ //澶勭悊闈炵數缂嗛厤缃娴嬮」
+ Map<String, List<SampleProductExportDto>> listMap = filterItems.stream()
+ .filter(f -> StringUtils.isBlank(f.getCableTag()) && StringUtils.isNotBlank(f.getInspectionItem()))
+ .collect(Collectors.groupingBy(s -> s.getInspectionItem() + "&"));
+ //鍚堝苟妫�娴嬮」鍒楄〃
+ tempMap.putAll(cableTagItem);
+ tempMap.putAll(listMap);
+ sortSampleProduct(tempMap, totalItem);
+ int tagNum = Math.min(max, maxCableTag);
+ List<String> tagList = cableTags.isEmpty() ? new ArrayList<>() : cableTags.subList(0, tagNum);
+ handlerSampleItems(OrderType.WG.getValue(), totalItem, finalIndex, sampleList, tagNum, text, rows, rowRenderData, resultCh, tagList, true, showResult);
+
+ if (CollectionUtil.isNotEmpty(tempMap2)) {
+ sortSampleProduct(tempMap2, cableTagEnclosureItem);
+ //鐢熸垚闄勪欢鐢电紗琛ㄦ牸
+ TableRenderData tableRenderData2 = new TableRenderData();
+ List<String> newCableTags = cableTags.subList(maxCableTag, cableTags.size());
+ AtomicInteger finalIndex2 = new AtomicInteger(1);
+ List<TextRenderData> newText = new ArrayList<TextRenderData>();
+ List<RowRenderData> newRows = new ArrayList<>();
+ RowRenderData newRowRenderData = null;
+ handlerSampleItems(OrderType.WG.getValue(), cableTagEnclosureItem, finalIndex2, new ArrayList<>(), newCableTags.size(), newText, newRows, newRowRenderData, resultCh, newCableTags, true, showResult);
+ tableRenderData2.setRows(newRows);
+ tableRenderData2.setTableStyle(setTableStyle(newCableTags.size(), showResult));
+ HashMap<String, Object> tableMap = new HashMap<>();
+ tableMap.put("enclosureTable", tableRenderData2);
+ tableMap.put("resultCh", resultCh);
+ tableMap.put("writeUrl", null);
+ tableMap.put("examineUrl", null);
+ tableMap.put("ratifyUrl", null);
+ tableMap.put("writeDateUrl", null);
+ tableMap.put("examineDateUrl", null);
+ tableMap.put("ratifyDateUrl", null);
+ tableMap.put("seal1", null);
+ cableTagEnclosureTables.add(tableMap);
+ }
+
+ tableRenderData.setRows(rows);
+ tableRenderData.setTableStyle(setTableStyle(tagNum, showResult));
+ if (showResult && !resultCh.get().isEmpty()) {
+ resultCh.set("缁忔楠岋紝" + resultCh.get() + "鎵�妫�椤圭洰涓嶅悎鏍硷紝鍏朵綑鎵�妫�椤圭洰鍧囧悎鏍笺�傦紙鐩栫珷鏈夋晥锛�");
+ } else if (showResult) {
+ resultCh.set("鏈骇鍝佺鍚堢浉鍏虫爣鍑嗚姹傦紝缁忔楠屽悎鏍煎噯浜堝嚭鍘傦紙鐩栫珷鏈夋晥锛�");
+ }
+
+ } else {
+ templateName = showResult ? "/static/small-report-template.docx" : "/static/small-detection-template.docx";
+ // 杞垚Mpa杩涜鎺掑簭
+ Map<String, List<SampleProductExportDto>> sortedMap = sampleProductDto2s.stream()
+ .filter(sampleProductDto2 -> StringUtils.isNotBlank(sampleProductDto2.getInspectionItem()))
+ .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItem));
+// // 鍒涘缓涓�涓� LinkedHashMap 鏉ヤ繚鎸佹彃鍏ラ『搴�
+ Map<String, List<SampleProductExportDto>> item = new LinkedHashMap<>();
+ sortSampleProduct(sortedMap, item);
+
+
+ AtomicInteger finalIndex = new AtomicInteger(1);
+ handlerSampleItems(OrderType.RAW.getValue(), item, finalIndex, sampleList, max, text, rows, rowRenderData, resultCh, null, true, showResult);
+ tableRenderData.setRows(rows);
+ tableRenderData.setTableStyle(setTableStyle(max, showResult));
+
+ if (showResult && !resultCh.get().equals("")) {
+ resultCh.set("缁忔楠岋紝" + resultCh.get() + "鎵�妫�椤圭洰涓嶅悎鏍硷紝鍏朵綑鎵�妫�椤圭洰鍧囧悎鏍笺��");
+ } else if (showResult) {
+ resultCh.set("缁忔楠屾鎵�" + enterFactoryReport.getSample() + "鍚勯」鐩潎绗﹀悎妫�楠岃鑼冭姹傘��");
+ }
+ }
+
+ ConfigureBuilder builder = Configure.builder();
+ builder.useSpringEL(true);
+
+ InputStream inputStream = this.getClass().getResourceAsStream(templateName);
+ XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render(
+ new HashMap<String, Object>() {{
+ put("report", enterFactoryReport);
+ put("standardMethod", standardMethod2.toString().equals("null") ? "" : standardMethod2);
+ put("orderType", orderType);
+ put("table", tableRenderData);
+ put("enclosureTables", cableTagEnclosureTables.isEmpty() ? null : cableTagEnclosureTables);
+ put("resultCh", resultCh);
+ put("writeUrl", null);
+ put("examineUrl", null);
+ put("ratifyUrl", null);
+ put("writeDateUrl", null);
+ put("examineDateUrl", null);
+ put("ratifyDateUrl", null);
+ put("seal1", null);
+ }});
+ try {
+ // 淇敼鎹㈣鍜屽悎骞堕棶棰�
+ updaeMerge(template.getXWPFDocument(), true);
+ String name = insReport.getCode().replace("/", "") + (showResult ? "-J.docx" : "-C.docx");
+ Files.createDirectories(Paths.get(wordUrl));
+ template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl, name)));
+ insReport.setUrl("/word/" + name);
+ insReport.setIsPass(0);
+ insReport.setWriteUserId(writeUserId);//缂栧埗浜猴紙妫�楠屼汉锛�
+ insReport.setWriteTime(LocalDateTime.now());//鎻愪氦鏃堕棿
+ saveGeneratedReport(insReport);
+ inputStream.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * 澶勭悊甯歌妫�娴嬮」
+ *
+ * @param item
+ * @param finalIndex
+ * @param sampleList
+ * @param max
+ * @param text
+ * @param rows
+ * @param rowRenderData
+ * @param resultCh
+ */
+ private static void handlerSampleItems(String orderType, Map<String, List<SampleProductExportDto>> item, AtomicInteger finalIndex, List<SampleProductExportDto> sampleList, Integer max, List<TextRenderData> text, List<RowRenderData> rows, RowRenderData rowRenderData, AtomicReference<String> resultCh, List<String> cableTagList, Boolean hasAddHead, boolean showResult) {
+ item.forEach((s, sampleProductDtoInside) -> {
+ // 娣诲姞妫�楠岄」
+ SampleProductExportDto dto2 = new SampleProductExportDto();
+ // 鍒ゆ柇鏄惁鏈夎嫳鏂囧悕绉�
+ SampleProductExportDto temp = sampleProductDtoInside.get(0);
+
+ // 鍒ゆ柇鏄惁鏈夋楠屽瓙椤�,娌℃湁灏辨妸妫�楠屽弬鏁板~鍏�
+ dto2.setIndex(Integer.toString(finalIndex.get()));
+ if (StringUtils.isBlank(temp.getInspectionItemSubclass())) {
+ // 澶勭悊闆嗗悎
+ Map<String, SampleProductExportDto> map = new LinkedHashMap<>();
+ for (SampleProductExportDto productDto2 : sampleProductDtoInside) {
+ String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getCableTag();
+ if (map.containsKey(productName)) {
+ // 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
+ if (CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(), orderType)) {
+ map.get(productName)
+ .getLastValueList()
+ .add(productDto2.getLastValue());
+ }
+ map.get(productName)
+ .getInsResultList()
+ .add(productDto2.getInsResult());
+ } else {
+ // 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
+ if (CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(), orderType)) {
+ productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
+ productDto2.getLastValueList().add(productDto2.getLastValue());
+ }
+ productDto2.setInsResultList(new ArrayList<>()); // 缁撴灉
+ productDto2.getInsResultList().add(productDto2.getInsResult());
+
+ map.put(productName, productDto2);
+ }
+ }
+ List<SampleProductExportDto> result = new ArrayList<>(map.values());
+
+ //娣诲姞妫�楠屽瓙椤�
+ SampleProductExportDto temp2 = result.get(0);
+ if (StringUtils.isNotBlank(temp2.getRadius())) {
+ s = s + "(" + temp2.getRadius() + ")";
+ }
+ // 鍒ゆ柇鏈夋病鏈夋潯浠跺瓧娈垫湁闇�瑕佹嫾鎺ュ埌鍚嶇О鍚庨潰
+ temp2.setInspectionName(s);
+ temp2.setIndex(Integer.toString(finalIndex.get()));
+ sampleList.add(temp2);
+ } else {
+ dto2.setInspectionName(s);
+ // 濉厖鍒拌姹�
+ if (StringUtils.isNotBlank(temp.getRadius())) {
+ dto2.setTell("(" + temp.getRadius() + ")");
+ }
+ sampleList.add(dto2);
+
+ // 澶勭悊闆嗗悎
+ Map<String, SampleProductExportDto> map = new LinkedHashMap<>();
+ for (SampleProductExportDto productDto2 : sampleProductDtoInside) {
+ String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getInspectionItemSubclass() + productDto2.getCableTag();
+ if (map.containsKey(productName)) {
+ // 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
+ if (CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(), orderType)) {
+ map.get(productName)
+ .getLastValueList()
+ .add(productDto2.getLastValue());
+ }
+ map.get(productName)
+ .getInsResultList()
+ .add(productDto2.getInsResult());
+ } else {
+ // 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
+ if (CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(), orderType)) {
+ productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
+ productDto2.getLastValueList().add(productDto2.getLastValue());
+ }
+ productDto2.setInsResultList(new ArrayList<>()); // 缁撴灉
+ productDto2.getInsResultList().add(productDto2.getInsResult());
+
+ map.put(productName, productDto2);
+ }
+ }
+ List<SampleProductExportDto> result = new ArrayList<>(map.values());
+ //娣诲姞妫�楠屽瓙椤�
+ for (SampleProductExportDto productDto2 : result) {
+ productDto2.setInspectionName("--" + productDto2.getInspectionItemSubclass());
+ sampleList.add(productDto2);
+ }
+ }
+ finalIndex.incrementAndGet();
+ });
+
+ // 娣诲姞灏忔姤鍛婅〃澶�
+ if (hasAddHead) {
+ text = addSmallHead(text, max, rows, cableTagList, showResult);
+ }
+
+ // 涓棿妫�娴嬪�兼坊鍔�
+ for (int i = 0; i < sampleList.size(); i++) {
+ SampleProductExportDto sample = sampleList.get(i);
+
+ // 搴忓彿
+ TextRenderData middleRenderData1 = new TextRenderData();
+ middleRenderData1.setText(sample.getIndex());
+ Style middleStyle1 = new Style();
+ middleStyle1.setFontFamily("瀹嬩綋");
+ middleStyle1.setColor("000000");
+ middleRenderData1.setStyle(middleStyle1);
+ text.add(middleRenderData1);
+
+ // 妫�楠岄」鐩�
+ TextRenderData middleRenderData2 = new TextRenderData();
+ String[] split = sample.getInspectionName().split("&");
+ String itemName = split.length > 0 ? split[0] : sample.getInspectionName();
+ middleRenderData2.setText(itemName + "鈭�" + itemName + i + "_" + finalIndex);
+ Style middleStyle2 = new Style();
+ middleStyle2.setFontFamily("瀹嬩綋");
+ middleStyle2.setColor("000000");
+ middleRenderData2.setStyle(middleStyle2);
+ text.add(middleRenderData2);
+
+ // 鍗曚綅
+ TextRenderData middleRenderData4 = new TextRenderData();
+ middleRenderData4.setText(sample.getUnit());
+ Style middleStyle4 = new Style();
+ middleStyle4.setFontFamily("瀹嬩綋");
+ middleStyle4.setColor("000000");
+ middleRenderData4.setStyle(middleStyle4);
+ text.add(middleRenderData4);
+
+ //鏍囧噯瑕佹眰
+ TextRenderData middleRenderData5 = new TextRenderData();
+ middleRenderData5.setText(sample.getTell());
+ Style middleStyle5 = new Style();
+ middleStyle5.setFontFamily("瀹嬩綋");
+ middleStyle5.setColor("000000");
+ middleRenderData5.setStyle(middleStyle5);
+ text.add(middleRenderData5);
+
+ // 妫�楠岀粨鏋�
+ boolean isMore = false;
+ if (CollectionUtils.isNotEmpty(sample.getLastValueList())
+ && sample.getLastValueList().size() == max) {
+ // 鍒ゆ柇鏄惁鏄瑙�, 澶栬鍏ㄩ儴鍚堟牸鐨勮瘽闇�瑕佸悎骞�
+ if (showResult && sample.getInspectionItem().contains("澶栬")) {
+ // 鍒ゅ畾缁撴灉
+ boolean falg = false;
+ if (CollectionUtils.isNotEmpty(sample.getLastValueList())) {
+ // 鍒ゆ柇鏄惁鏈変竴涓敊璇�
+ if (sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 2))) {
+ falg = true;
+ } else {
+ boolean error = sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 0));
+ if (!error) {
+ falg = true;
+ }
+ }
+ } else {
+ if (!Objects.equals(sample.getInsResult(), 2)) {
+ falg = true;
+ }
+ }
+ if (falg) {
+ for (int j = 0; j < max; j++) {
+ TextRenderData middleRenderData6 = new TextRenderData();
+ middleRenderData6.setText((StringUtils.isNotEmpty(sample.getLastValue()) ?
+ sample.getLastValue() : "")
+ + "鈭�" + (50 + i));
+ Style middleStyle6 = new Style();
+ middleStyle6.setFontFamily("瀹嬩綋");
+ middleStyle6.setColor("000000");
+ middleRenderData6.setStyle(middleStyle6);
+ text.add(middleRenderData6);
+ }
+ } else {
+ for (String s : sample.getLastValueList()) {
+ TextRenderData middleRenderData6 = new TextRenderData();
+ middleRenderData6.setText(s);
+ Style middleStyle6 = new Style();
+ middleStyle6.setFontFamily("瀹嬩綋");
+ middleStyle6.setColor("000000");
+ middleRenderData6.setStyle(middleStyle6);
+ text.add(middleRenderData6);
+ }
+ }
+ } else {
+ for (String s : sample.getLastValueList()) {
+ TextRenderData middleRenderData6 = new TextRenderData();
+ middleRenderData6.setText(s);
+ Style middleStyle6 = new Style();
+ middleStyle6.setFontFamily("瀹嬩綋");
+ middleStyle6.setColor("000000");
+ middleRenderData6.setStyle(middleStyle6);
+ text.add(middleRenderData6);
+ }
+ }
+ } else {
+ for (int j = 0; j < max; j++) {
+ TextRenderData middleRenderData6 = new TextRenderData();
+ middleRenderData6.setText((StringUtils.isNotEmpty(sample.getLastValue()) ?
+ sample.getLastValue() : "")
+ + "鈭�" + (finalIndex.get() + "_" + i));
+ Style middleStyle6 = new Style();
+ middleStyle6.setFontFamily("瀹嬩綋");
+ middleStyle6.setColor("000000");
+ middleRenderData6.setStyle(middleStyle6);
+ text.add(middleRenderData6);
+ }
+ }
+
+
+ // 鍒ゅ畾缁撴灉
+ String result = "";
+ if (showResult && sample.getInsResult() != null) {
+ switch (sample.getInsResult()) {
+ case 1:
+ result = "鈭�";
+ break;
+ case 2:
+ result = "脳";
+ break;
+ case 3:
+ result = "-";
+ break;
+ }
+ }
+ if (showResult && CollectionUtils.isNotEmpty(sample.getLastValueList())) {
+ // 鍒ゆ柇鏄惁鏈変竴涓敊璇�
+ if (sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 3))) {
+ result = "-";
+ } else {
+ boolean error = sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 0));
+ if (error) {
+ List<String> collect = new ArrayList<>();
+ int index = 1;
+ for (Integer count : sample.getInsResultList()) {
+ String type;
+ if (Objects.equals(count, 0)) {
+ // 娣诲姞涓嶅悎鏍兼弿杩�
+ String item1 = (max == 1 ? "" : "绗�" + index + "娆�")
+ + sample.getInspectionItem()
+ + (StringUtils.isBlank(sample.getInspectionItemSubclass()) ? "" : "" + sample.getInspectionItemSubclass());
+ if (resultCh.get().equals("")) {
+ resultCh.set(resultCh.get() + item1);
+ } else {
+ resultCh.set(resultCh.get() + "銆�" + item1);
+ }
+ type = "脳";
+ } else {
+ type = "鈭�";
+ }
+ collect.add(type);
+ index++;
+ }
+ result = CollUtil.join(collect, " ");
+ } else {
+ result = "鈭�";
+ }
+ }
+ }
+
+ if (showResult) {
+ TextRenderData middleRenderData7 = new TextRenderData();
+ middleRenderData7.setText(result);
+ Style middleStyle7 = new Style();
+ middleStyle7.setFontFamily("瀹嬩綋");
+ middleStyle7.setColor("000000");
+ middleRenderData7.setStyle(middleStyle7);
+ text.add(middleRenderData7);
+ }
+
+ TextRenderData[] text2 = text.toArray(new TextRenderData[0]);
+ rowRenderData = Rows.of(text2).center().rowAtleastHeight(1).create();
+ // 0.8鍘樼背
+ double centimeters = 0.8;
+ int twips = UnitUtils.cm2Twips(centimeters);
+ rowRenderData.getRowStyle().setHeight(twips);
+ rows.add(rowRenderData);
+ text = new ArrayList<>();
+ }
+
+ }
+
+ /**
+ * 娣诲姞灏忔姤鍛婅〃澶�
+ *
+ * @param text
+ * @param max
+ * @param rows
+ * @return
+ */
+ private static List<TextRenderData> addSmallHead(List<TextRenderData> text, Integer max, List<RowRenderData> rows, List<String> cableTagList, boolean showResult) {
+ RowRenderData rowRenderData;
+// // 澶�
+ TextRenderData headRenderData1 = new TextRenderData();
+ headRenderData1.setText("搴忓彿");
+ Style headStyle1 = new Style();
+ headStyle1.setFontFamily("瀹嬩綋");
+ headStyle1.setColor("000000");
+ headRenderData1.setStyle(headStyle1);
+ text.add(headRenderData1);
+
+ TextRenderData headRenderData2 = new TextRenderData();
+ headRenderData2.setText("妫�楠岄」鐩�");
+ Style headStyle2 = new Style();
+ headStyle2.setFontFamily("瀹嬩綋");
+ headStyle2.setColor("000000");
+ headRenderData2.setStyle(headStyle2);
+ text.add(headRenderData2);
+
+ TextRenderData headRenderData4 = new TextRenderData();
+ headRenderData4.setText("鍗曚綅");
+ Style headStyle4 = new Style();
+ headStyle4.setFontFamily("瀹嬩綋");
+ headStyle4.setColor("000000");
+ headRenderData4.setStyle(headStyle4);
+ text.add(headRenderData4);
+
+ TextRenderData headRenderData5 = new TextRenderData();
+ headRenderData5.setText("鏍囧噯瑕佹眰");
+ Style headStyle5 = new Style();
+ headStyle5.setFontFamily("瀹嬩綋");
+ headStyle5.setColor("000000");
+ headRenderData5.setStyle(headStyle5);
+ text.add(headRenderData5);
+
+ for (int i = 0; i < max; i++) {
+ TextRenderData headRenderData6 = new TextRenderData();
+ headRenderData6.setText(showResult ? "妫�楠岀粨鏋溾垜6" : "妫�娴嬫暟鎹垜6");
+ Style headStyle6 = new Style();
+ headStyle6.setFontFamily("瀹嬩綋");
+ headStyle6.setColor("000000");
+ headRenderData6.setStyle(headStyle6);
+ text.add(headRenderData6);
+ }
+ if (showResult) {
+ TextRenderData headRenderData7 = new TextRenderData();
+ headRenderData7.setText("鍗曢」鍒ゆ柇");
+ Style headStyle7 = new Style();
+ headStyle7.setFontFamily("瀹嬩綋");
+ headStyle7.setColor("000000");
+ headRenderData7.setStyle(headStyle7);
+ text.add(headRenderData7);
+ }
+
+ TextRenderData[] text3 = text.toArray(new TextRenderData[0]);
+ rowRenderData = Rows.of(text3).center().rowAtleastHeight(1).create();
+ rows.add(rowRenderData);
+ text = new ArrayList<>();
+
+ // 绗簩琛�(鍙兘娌℃湁)
+ if (max > 1 && CollectionUtil.isEmpty(cableTagList)) {
+ TextRenderData tagRenderData1 = new TextRenderData();
+ tagRenderData1.setText("");
+ Style tagStyle1 = new Style();
+ tagStyle1.setFontFamily("瀹嬩綋");
+ tagStyle1.setColor("000000");
+ tagRenderData1.setStyle(tagStyle1);
+ text.add(tagRenderData1);
+
+ TextRenderData tagRenderData2 = new TextRenderData();
+ tagRenderData2.setText("鏍囪瘑");
+ Style tagStyle2 = new Style();
+ tagStyle2.setFontFamily("瀹嬩綋");
+ tagStyle2.setColor("000000");
+ tagRenderData2.setStyle(tagStyle2);
+ text.add(tagRenderData2);
+
+ TextRenderData tagRenderData4 = new TextRenderData();
+ tagRenderData4.setText("");
+ Style tagStyle4 = new Style();
+ tagStyle4.setFontFamily("瀹嬩綋");
+ tagStyle4.setColor("000000");
+ tagRenderData4.setStyle(tagStyle4);
+ text.add(tagRenderData4);
+
+ TextRenderData tagRenderData5 = new TextRenderData();
+ tagRenderData5.setText("");
+ Style tagStyle5 = new Style();
+ tagStyle5.setFontFamily("瀹嬩綋");
+ tagStyle5.setColor("000000");
+ tagRenderData5.setStyle(tagStyle5);
+ text.add(tagRenderData5);
+
+ for (int i = 0; i < max; i++) {
+ TextRenderData tagRenderData6 = new TextRenderData();
+ tagRenderData6.setText("鏍囪瘑" + (i + 1));
+ Style tagStyle6 = new Style();
+ tagStyle6.setFontFamily("瀹嬩綋");
+ tagStyle6.setColor("000000");
+ tagRenderData6.setStyle(tagStyle6);
+ text.add(tagRenderData6);
+ }
+ if (showResult) {
+ TextRenderData tagRenderData7 = new TextRenderData();
+ tagRenderData7.setText("");
+ Style tagStyle7 = new Style();
+ tagStyle7.setFontFamily("瀹嬩綋");
+ tagStyle7.setColor("000000");
+ tagRenderData7.setStyle(tagStyle7);
+ text.add(tagRenderData7);
+ }
+
+ TextRenderData[] text4 = text.toArray(new TextRenderData[0]);
+ rowRenderData = Rows.of(text4).center().rowAtleastHeight(1).create();
+ rows.add(rowRenderData);
+ text = new ArrayList<>();
+
+
+ }
+ //濡傛灉鏈夌數缂嗛鑹诧紝鐢熸垚棰滆壊鏍囪瘑琛�
+ if (CollectionUtil.isNotEmpty(cableTagList)) {
+ TextRenderData tagRenderData1 = new TextRenderData();
+ tagRenderData1.setText("");
+ Style tagStyle1 = new Style();
+ tagStyle1.setFontFamily("瀹嬩綋");
+ tagStyle1.setColor("000000");
+ tagRenderData1.setStyle(tagStyle1);
+ text.add(tagRenderData1);
+
+ TextRenderData tagRenderData2 = new TextRenderData();
+ tagRenderData2.setText("缁濈紭绾胯姱棰滆壊鍜屾爣蹇�");
+ Style tagStyle2 = new Style();
+ tagStyle2.setFontFamily("瀹嬩綋");
+ tagStyle2.setColor("000000");
+ tagRenderData2.setStyle(tagStyle2);
+ text.add(tagRenderData2);
+
+ TextRenderData tagRenderData4 = new TextRenderData();
+ tagRenderData4.setText("/");
+ Style tagStyle4 = new Style();
+ tagStyle4.setFontFamily("瀹嬩綋");
+ tagStyle4.setColor("000000");
+ tagRenderData4.setStyle(tagStyle4);
+ text.add(tagRenderData4);
+
+ TextRenderData tagRenderData5 = new TextRenderData();
+ tagRenderData5.setText("/");
+ Style tagStyle5 = new Style();
+ tagStyle5.setFontFamily("瀹嬩綋");
+ tagStyle5.setColor("000000");
+ tagRenderData5.setStyle(tagStyle5);
+ text.add(tagRenderData5);
+
+ for (String cableTag : cableTagList) {
+ TextRenderData tagRenderData6 = new TextRenderData();
+ tagRenderData6.setText(cableTag);
+ Style tagStyle6 = new Style();
+ tagStyle6.setFontFamily("瀹嬩綋");
+ tagStyle6.setColor("000000");
+ tagRenderData6.setStyle(tagStyle6);
+ text.add(tagRenderData6);
+ }
+ if (showResult) {
+ TextRenderData tagRenderData7 = new TextRenderData();
+ tagRenderData7.setText("/");
+ Style tagStyle7 = new Style();
+ tagStyle7.setFontFamily("瀹嬩綋");
+ tagStyle7.setColor("000000");
+ tagRenderData7.setStyle(tagStyle7);
+ text.add(tagRenderData7);
+ }
+
+ TextRenderData[] text4 = text.toArray(new TextRenderData[0]);
+ rowRenderData = Rows.of(text4).center().rowAtleastHeight(1).create();
+ rows.add(rowRenderData);
+ text = new ArrayList<>();
+ }
+ return text;
+ }
+
+ /***************************************************** 澶ф姤鍛� ***************************************************************************/
+
+ /**
+ * 鍒涘缓澶ф姤鍛�
+ *
+ * @param orderId
+ * @param insOrder
+ * @param
+ */
+ private void addBitReport(Integer orderId, InsOrder insOrder, Integer reportType, Integer writeUserId) {
+ //samples鏄笉鍖呮嫭甯︽湁"/"鐨勬牱鍝�
+ List<SampleProductDto> samples = insSampleMapper.selectSampleProductListByOrderId(orderId);
+ boolean directTemplateOrder = isDirectTemplateOrder(orderId);
+ if (!directTemplateOrder && CollectionUtils.isEmpty(samples)) {
+ throw new ErrorException("褰撳墠璁㈠崟鏈壘鍒板彲鐢熸垚鎶ュ憡鐨勬湁鏁堟楠岄」鐩�");
+ }
+ InsReport insReport = new InsReport();
+ insReport.setCode(insOrder.getEntrustCode());
+ insReport.setInsOrderId(orderId);
+ insReport.setReportType(reportType);
+ boolean showResult = Objects.equals(reportType, INSPECTION_REPORT);
+ List<Map<String, Object>> tables = new ArrayList<>();
+ Set<String> standardMethod = new LinkedHashSet<>();
+ Set<String> models = new HashSet<>();
+ // 鏌ヨ妫�楠岄」鏁伴噺
+ AtomicInteger productSize = new AtomicInteger();
+ String[] monthNames = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
+ List<String> resultChList = new ArrayList<>();
+ List<String> resultEnList = new ArrayList<>();
+ // 鍒ゆ柇鏄惁鏄彧鏈変竴涓牱鍝�
+ boolean isOneSample = samples.size() == 1;
+ /*鍩虹鎶ュ憡(鏍规嵁缁樺埗鐨勫師濮嬭褰曟ā鐗堝舰鎴�)*/
+ samples.forEach(a -> {
+ models.add(a.getModel());
+ String standardMethodCode = baseMapper.getStandardMethodReportText(a.getStandardMethodListId());
+ if (StrUtil.isNotBlank(standardMethodCode)) {
+ if (StrUtil.isNotBlank(a.getSpecialStandardMethod())) {
+ standardMethodCode = standardMethodCode + "+" + a.getSpecialStandardMethod();
+ }
+ standardMethod.add(standardMethodCode);
+ }
+ // 鐩寸粦妯℃澘鐨勬娴嬫姤鍛娿�佹楠屾姤鍛婇兘浣跨敤鏂扮増鍥哄畾缁撴灉琛岋紝涓嶅啀杩涘叆鏃х増妫�楠岄」琛ㄦ牸閫昏緫銆�
+ // 鐩寸粦妯℃澘涓殑鎵胯浇璁板綍娌℃湁鏃ф楠岄」瀛楁锛岃繘鍏ユ棫閫昏緫浼氬湪鏍煎紡鍖栨椂浜х敓绌烘寚閽堛��
+ if (!showResult || directTemplateOrder) {
+ return;
+ }
+ // 鏀舵牱鏃ユ湡
+ List<RowRenderData> rows = new ArrayList<>();
+ List<TextRenderData> text = new ArrayList<>();
+ RowRenderData rowRenderData = null;
+
+ InsSample insSamples = null;
+ int max = 1;
+ List<String> cableTags = new ArrayList<>();
+ // 鍒ゆ柇鏄惁涓哄師鏉愭枡
+ if (insOrder.getTypeSource() != null && insOrder.getTypeSource().equals(1)) {
+
+ InsOrder one = insOrderService.getOne(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getIfsInventoryId, insOrder.getIfsInventoryId())
+ .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY)
+ .ne(InsOrder::getState, -1)
+ .last("limit 1"));
+ // 鍒ゆ柇涔嬪墠鏄惁鏈夎繘鍘傛楠�
+ if (one != null) {
+ insSamples = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, one.getId())
+ .last("limit 1"));
+ }
+
+ max = a.getQuantity();
+ if (StringUtils.isBlank(insOrder.getSampleView())) {
+ insOrder.setSampleView(insOrder.getSample());
+ }
+ if (StringUtils.isBlank(insOrder.getSampleViewEn())) {
+ String sampleViewEn = insSampleMapper.getSampleEn(insOrder.getSample());
+ if (StringUtils.isBlank(sampleViewEn)) {
+ sampleViewEn = insSampleMapper.getSampleEnByObject(insOrder.getSample());
+ }
+ insOrder.setSampleViewEn(sampleViewEn);
+ }
+ } else {
+ // 鑾峰緱鎵归噺妫�楠岀殑鎬绘暟
+ max = insOrderMapper.selectSampleMax(a.getId());
+ cableTags = insOrderMapper.selectSampleCableTag(a.getId());
+ }
+
+ // 琛ㄥご娣诲姞
+ addHead(a, text, rowRenderData, rows, max, cableTags, showResult);
+ text = new ArrayList<>();
+
+ // 娣诲姞妫�娴嬪��
+ productSize.set(addTestValue(a, text, rowRenderData, rows, max, resultChList, resultEnList, insSamples, cableTags, isOneSample, showResult));
+ text = new ArrayList<>();
+
+ // 缁撳熬娣诲姞
+ addEnding(text, rowRenderData, rows, max, showResult);
+ text = new ArrayList<>();
+
+ List<TableRenderData> tables1 = new ArrayList<>();
+ TableRenderData tableRenderData = new TableRenderData();
+ tableRenderData.setRows(new ArrayList<>());
+ double totalHeight = 0.0; // 鐢ㄤ簬璺熻釜褰撳墠琛ㄦ牸鐨勬�昏楂�
+ double heightThreshold = 9300.0; // 闃堝�硷紝
+ List<RowRenderData> firstTwoRows = new ArrayList<>(); // 淇濆瓨鍓嶄袱琛屼互渚垮鍒跺埌鏂拌〃鏍�
+ List<RowRenderData> endTwoRows = new ArrayList<>(); // 淇濆瓨鏈�鍚庝竴琛屼互渚垮鍒跺埌鏂拌〃鏍�
+ // 淇濆瓨鍓嶄袱琛屼互渚垮鍒跺埌鏂拌〃鏍�
+ firstTwoRows.add(rows.get(0));
+ firstTwoRows.add(rows.get(1));
+ // 淇濆瓨鏈�鍚庝竴琛�
+ endTwoRows.add(rows.get(rows.size() - 1));
+ for (RowRenderData row : rows) {
+ double rowHeight = row.getRowStyle().getHeight(); // 鑾峰彇褰撳墠琛岀殑琛岄珮
+// // 鍒ゆ柇瀛椾綋鍐呭鏄惁鏈夊鐨�, 澶氱殑琛岄珮涔樺�嶆暟
+ RowRenderData lastRaw = rows.get(rows.size() - 1);
+ // 鎺掗櫎鏈�鍚庝竴琛�
+ if (rows.get(0) != row && rows.get(1) != row && lastRaw != row) {
+ // 璋冩暣楂樺害
+ rowHeight = adjustRowHeight(row, rowHeight, max);
+ }
+ totalHeight += rowHeight; // 鏇存柊鎬昏楂�
+ if (totalHeight >= heightThreshold) {
+ // 鍒涘缓鏂拌〃鏍煎苟澶嶅埗鍓嶄袱琛�
+ TableRenderData newTableRenderData = new TableRenderData();
+ newTableRenderData.setRows(new ArrayList<>(firstTwoRows));
+ //璁剧疆鏍峰紡
+ TableStyle tableStyle = new TableStyle();
+// for (int i = 1; i <= max; i++) {
+// }
+ // 鏍规嵁妫�楠岀粨鏋滀釜鏁颁慨鏀归暱搴�
+ tableStyle.setColWidths(calcTableColWidths(max, showResult));
+// switch (max) {
+// case 1:
+// tableStyle.setColWidths(new int[]{650, 2000, 2000, 850, 2200, 2100, 1200});
+// break;
+// case 2:
+// tableStyle.setColWidths(new int[]{650, 1400, 1400, 850, 2100, 1200, 1200, 1200});
+// break;
+// case 3:
+// tableStyle.setColWidths(new int[]{650, 1400, 1400, 850, 1500, 1000, 1000, 1000, 1200});
+// break;
+// case 4:
+// tableStyle.setColWidths(new int[]{650, 1200, 1200, 850, 1400, 850, 850, 850, 850, 1200});
+// break;
+// case 5:
+// tableStyle.setColWidths(new int[]{650, 1100, 1100, 850, 1350, 750, 750, 750, 750, 750, 1200});
+// break;
+// }
+ tableStyle.setWidth("10000");
+ tableStyle.setAlign(TableRowAlign.CENTER);
+ BorderStyle borderStyle = new BorderStyle();
+ borderStyle.setColor("000000");
+ borderStyle.setType(XWPFTable.XWPFBorderType.THICK);
+ borderStyle.setSize(14);
+ tableStyle.setLeftBorder(borderStyle);
+ tableStyle.setTopBorder(borderStyle);
+ tableStyle.setRightBorder(borderStyle);
+ tableStyle.setBottomBorder(borderStyle);
+ tableRenderData.setTableStyle(tableStyle);
+ newTableRenderData.setTableStyle(tableStyle);
+
+ // 娣诲姞鏈�鍚庝竴琛�
+ tableRenderData.addRow(rows.get(rows.size() - 1));
+
+ tables1.add(tableRenderData);
+ tableRenderData = newTableRenderData;
+ totalHeight = rowHeight;
+ }
+ tableRenderData.getRows().add(row);
+ }
+ TableStyle tableStyle = new TableStyle();
+ if (tableRenderData.getRows().size() != 3) {
+ //璁剧疆鏍峰紡
+// for (int i = 1; i <= max; i++) {
+// }
+ // 鏍规嵁妫�楠岀粨鏋滀釜鏁颁慨鏀归暱搴�
+ tableStyle.setColWidths(calcTableColWidths(max, showResult));
+// switch (max) {
+// case 1:
+// tableStyle.setColWidths(new int[]{650, 2000, 2000, 850, 2200, 2100, 1200});
+// break;
+// case 2:
+// tableStyle.setColWidths(new int[]{650, 1400, 1400, 850, 2100, 1200, 1200, 1200});
+// break;
+// case 3:
+// tableStyle.setColWidths(new int[]{650, 1400, 1400, 850, 1500, 1000, 1000, 1000, 1200});
+// break;
+// case 4:
+// tableStyle.setColWidths(new int[]{650, 1200, 1200, 850, 1400, 850, 850, 850, 850, 1200});
+// break;
+// case 5:
+// tableStyle.setColWidths(new int[]{650, 1100, 1100, 850, 1350, 750, 750, 750, 750, 750, 1200});
+// break;
+// }
+ }
+ tableStyle.setWidth("10000");
+ tableStyle.setAlign(TableRowAlign.CENTER);
+ BorderStyle borderStyle = new BorderStyle();
+ borderStyle.setColor("000000");
+ borderStyle.setType(XWPFTable.XWPFBorderType.THICK);
+ borderStyle.setSize(14);
+ tableStyle.setLeftBorder(borderStyle);
+ tableStyle.setTopBorder(borderStyle);
+ tableStyle.setRightBorder(borderStyle);
+ tableStyle.setBottomBorder(borderStyle);
+ tableRenderData.setTableStyle(tableStyle);
+ tables1.add(tableRenderData);
+ tables1.forEach(table -> {
+ Map<String, Object> tableMap = new HashMap<>();
+ tableMap.put("table", table);
+ tableMap.put("report", insReport);
+ tables.add(tableMap);
+ });
+
+ });
+
+ StringBuilder standardMethod2 = new StringBuilder();
+ for (String s : standardMethod) {
+ standardMethod2.append("銆�").append(s);
+ }
+ if (standardMethod2.length() > 0) {
+ standardMethod2.deleteCharAt(0);
+ }
+ tables.forEach(table -> {
+ table.put("tableSize", tables.size() + 1);
+ });
+ // 鎶ュ憡鍙睍绀烘楠屽崟鍚勬ā鏉块�夋嫨鐨勮澶囷紝骞舵寜璁惧ID鍘婚噸銆�
+ Set<Integer> reportDeviceIds = insOrderTemplateDeviceMapper
+ .selectDeviceIdsByOrderId(orderId).stream()
+ .filter(Objects::nonNull)
+ .collect(Collectors.toCollection(LinkedHashSet::new));
+ List<Map<String, String>> deviceList = reportDeviceIds.isEmpty()
+ ? new ArrayList<>() : insOrderMapper.selectDeviceListByIds(reportDeviceIds);
+ if (CollectionUtils.isNotEmpty(deviceList)) {
+ int count = 1;
+ for (Map<String, String> stringMap : deviceList) {
+ stringMap.put("index", String.valueOf(count));
+ count++;
+ }
+ }
+
+ String modelStr = CollUtil.join(models, "\n");
+
+ // 妫�娴嬬被鍨�
+ String orderType = null;
+ orderType = iSysDictTypeService.selectLabelByDict(DictDataConstants.CHECK_TYPE, insOrder.getOrderType());
+ // 鍒ゆ柇绗竴涓瓧鍏告槸鍚︿负绌�
+ if (StringUtils.isBlank(orderType)) {
+ orderType = iSysDictTypeService.selectLabelByDict(DictDataConstants.CHECK_TYPE1, insOrder.getOrderType());
+ }
+
+ // 鏉ユ牱鏂瑰紡
+ String formType = iSysDictTypeService.selectLabelByDict(DictDataConstants.FORM_TYPE, insOrder.getFormType());
+
+ // 鏍峰搧澶栬浼樺厛灞曠ず瀛楀吀鍚嶇О锛涘巻鍙叉暟鎹垨鐩存帴淇濆瓨鏂囨湰鏃讹紝鍥為��灞曠ず璁㈠崟鍘熷�笺��
+ String sampleStatus = defaultReportText(
+ iSysDictTypeService.selectLabelByDict(
+ DictDataConstants.SAMPLE_STATUS_LIST, insOrder.getSampleStatus()),
+ insOrder.getSampleStatus());
+
+ // 鍏徃淇℃伅
+ Custom custom = customMapper.selectById(insOrder.getCompanyId());
+
+ // 鏌ヨ鍒ゆ柇鏄惁鏈変笉鍒ゅ畾椤圭洰,鍜屽叏閮芥槸鍒ゅ畾椤�
+ int judgeType = showResult ? insProductMapper.selectNoJudge(insOrder.getId()) : 0;
+ String resultCh = "";
+ String resultEn = "";
+ for (String reference : resultChList) {
+ resultCh = resultCh + reference;
+ }
+ for (String reference : resultEnList) {
+ resultEn = resultEn + reference;
+ }
+ switch (judgeType) {
+ // 娌℃湁涓嶅垽瀹氶」鐩�
+ case 1:
+ if (StringUtils.isNotBlank(resultCh)) {
+ resultCh = "渚濇嵁濮旀墭瑕佹眰锛�" + resultCh + "鎵�妫�椤圭洰涓嶅悎鏍硷紝鍏朵綑鎵�妫�椤圭洰鍧囧悎鏍笺��";
+ resultEn = "According to commissioned requirements," + resultEn + " these inspected items do not meet the requirements, all other inspected items meet the requirements.";
+ } else {
+ resultCh = "渚濇嵁濮旀墭瑕佹眰锛屾墍妫�椤圭洰鍧囩鍚堣姹傘��";
+ resultEn = "According to commissioned requirements, all the tested items meet the requirements.";
+ }
+ break;
+ // 瀛樺湪涓嶅垽瀹氶」鐩�
+ case 2:
+ if (StringUtils.isNotBlank(resultCh)) {
+ resultCh = "渚濇嵁濮旀墭瑕佹眰锛�" + resultCh + "鎵�妫�椤圭洰涓嶅悎鏍硷紝鍏朵綑鎵�妫�椤圭洰闄や笉鍒ゅ畾澶栧潎绗﹀悎瑕佹眰銆�";
+ resultEn = "According to commissioned requirements," + resultEn + " these inspected items do not meet the requirements, all the inspected items meet the requirements except that they are not judged.";
+ } else {
+ resultCh = "渚濇嵁濮旀墭瑕佹眰锛屾墍妫�椤圭洰闄や笉鍒ゅ畾澶栧潎绗﹀悎瑕佹眰銆�";
+ resultEn = "According to commissioned requirements, all the tested items meet the requirements.";
+ }
+ break;
+ // 閮芥槸涓嶅垽瀹氶」鐩�
+ case 3:
+ resultCh = "渚濇嵁濮旀墭瑕佹眰锛屾墍妫�椤圭洰鍧囦笉鍒ゅ畾銆�";
+ resultEn = "According to commissioned requirements, the items examined are not judged.";
+ break;
+ }
+
+ /*鑾峰彇闄勪欢鍥剧墖绫诲瀷*/
+ List<Map<String, Object>> images = new ArrayList<>();
+ List<InsOrderFile> insOrderFiles = insOrderFileMapper.selectList(Wrappers.<InsOrderFile>lambdaQuery().eq(InsOrderFile::getType, 1).eq(InsOrderFile::getInsOrderId, orderId));
+ if (CollectionUtils.isNotEmpty(insOrderFiles)) {
+ insOrderFiles.forEach(insOrderFile -> {
+ Map<String, Object> image = new HashMap<>();
+ PictureRenderData pictureRenderData = Pictures.ofLocal(imgUrl + "/" + insOrderFile.getFileUrl()).sizeInCm(17, 20).create();
+ image.put("url", pictureRenderData);
+ image.put("report", insReport);
+ images.add(image);
+ });
+ }
+ //濮旀墭浜哄拰鐢佃瘽瀛楁鍒ゆ柇
+ if (ObjectUtils.isEmpty(insOrder.getPrepareUser())) {
+ insOrder.setPrepareUser("/");
+ }
+ if (ObjectUtils.isEmpty(insOrder.getPhone())) {
+ insOrder.setPhone("/");
+ }
+
+ // 鎶芥牱鏃ユ湡
+ // 鎴愬搧鏄娊鏍锋椂闂�
+ LocalDateTime sendTime = insOrder.getSendTime();
+ IfsInventoryQuantity reportInventory = null;
+ if (insOrder.getIfsInventoryId() != null) {
+ reportInventory = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId());
+ }
+ if (insOrder.getTypeSource() != null && insOrder.getTypeSource().equals(1) && reportInventory != null) {
+ // 鍘熸潗鏂欐敹鏍锋棩鏈熸槸鎶ユ鏃ユ湡
+ sendTime = reportInventory.getDeclareDate();
+ }
+
+ // 妫�娴嬫棩鏈燂細姹囨�绘楠屽崟鍚勬ā鏉垮~鍐欑殑妫�娴嬫椂闂达紝鏃ユ湡鐩稿悓鏄剧ず涓�涓紝鍚﹀垯鏄剧ず鏈�鏃╄嚦鏈�鏅氥��
+ LocalDateTime now = LocalDateTime.now();
+ List<InsOrderStandardTemplate> templateSnapshots = insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId)
+ .orderByAsc(InsOrderStandardTemplate::getSort, InsOrderStandardTemplate::getId));
+ List<LocalDate> detectionDates = templateSnapshots.stream()
+ .map(InsOrderStandardTemplate::getDetectionTime)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ String insTime = formatReportTestDate(detectionDates);
+ String insTimeEn = formatReportTestDateEn(detectionDates, monthNames);
+
+ // 妫�楠岀幆澧冿細浼樺厛姹囨�诲悇妯℃澘濉啓鐨勬俯婀垮害锛屾姤鍛婂睍绀哄叏閮ㄦā鏉跨殑鏈�灏忓�煎埌鏈�澶у�笺��
+ String environment = buildReportEnvironment(orderId, insOrder);
+ String finalEnvironment = environment;
+ LocalDateTime finalSendTime = sendTime;
+ String finalResultCh = resultCh;
+ String finalResultEn = resultEn;
+ String finalOrderType = orderType;
+ List<Map<String, String>> finalDeviceList = deviceList;
+ String finalModelStr = modelStr;
+
+ // 鐩寸粦妯℃澘璁㈠崟娌℃湁 ins_product锛屾娴嬮」鐩�佸崟浣嶅拰缁撴灉鍧囦粠璁㈠崟妯℃澘蹇収涓幏鍙栥��
+ List<Map<String, String>> detectionResultRows = directTemplateOrder
+ ? buildTemplateDetectionResultRows(orderId)
+ : buildDetectionResultRows(samples);
+ String productName = defaultReportText(insOrder.getSampleView(), insOrder.getSample());
+ String customerName = defaultReportText(custom == null ? null : custom.getCompany(), insOrder.getCompany());
+ String detectionCategory = defaultReportText(finalOrderType, "濮旀墭妫�娴�");
+ String sampleCode = samples.stream()
+ .map(SampleProductDto::getSampleCode)
+ .filter(StringUtils::isNotBlank)
+ .distinct()
+ .collect(Collectors.joining("銆�"));
+ String productAndModel = productName;
+ if (StringUtils.isNotBlank(finalModelStr) && !Objects.equals(productName, finalModelStr)) {
+ productAndModel = productName + " " + finalModelStr;
+ }
+ String standardMethodText = "null".equals(standardMethod2.toString()) ? "" : standardMethod2.toString();
+ String productionDate = "/";
+ String batchNo = "/";
+ if (reportInventory != null) {
+ if (reportInventory.getProductDate() != null) {
+ productionDate = reportInventory.getProductDate().format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�"));
+ }
+ batchNo = defaultReportText(reportInventory.getUpdateBatchNo(), reportInventory.getLotBatchNo());
+ }
+ // 鏂拌仛鐩寸粦妯℃澘璁㈠崟锛氭姤鍛婁俊鎭彇濮旀墭淇℃伅鍜岃鍗曟ā鏉垮揩鐓э紝涓嶅啀鍙栬兘鍔涜寖鍥存爣鍑嗘柟娉曘��
+ boolean newJuTemplateOrder = !templateSnapshots.isEmpty() && directTemplateOrder;
+ if (newJuTemplateOrder) {
+ productName = defaultReportText(insOrder.getSampleView(), insOrder.getSample());
+ finalModelStr = "/";
+ productAndModel = productName;
+ if (insOrder.getSampleDate() != null) {
+ finalSendTime = insOrder.getSampleDate().atStartOfDay();
+ }
+ if (insOrder.getProductionDate() != null) {
+ productionDate = insOrder.getProductionDate().format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�"));
+ }
+ batchNo = defaultReportText(insOrder.getProductionBatch(), "/");
+ standardMethodText = defaultReportText(
+ baseMapper.getStandardMethodReportTextByCode(insOrder.getSample()), insOrder.getSample());
+ }
+ boolean containsOrganicChlorine = detectionResultRows.stream()
+ .map(row -> row.get("itemName"))
+ .filter(Objects::nonNull)
+ .anyMatch(name -> name.contains("鏈夋満姘�"));
+ String resultRemark = containsOrganicChlorine
+ ? "寰簱浠戞硶锛屾湁鏈烘隘鍚噺灏忎簬0.005%鏃讹紝浠ユ湭妫�鍑烘姤鍑恒��"
+ : defaultReportText(insOrder.getRemark(), "/");
+
+ String templateName = showResult
+ ? "/static/inspection-report-template-v2.docx"
+ : "/static/detection-report-template-v2.docx";
+ InputStream inputStream = this.getClass().getResourceAsStream(templateName);
+ if (inputStream == null) {
+ throw new RuntimeException("鎵句笉鍒版姤鍛婃ā鏉�: " + templateName);
+ }
+ Configure configure = Configure.builder()
+ .bind("deviceList", new HackLoopTableRenderPolicy())
+ .bind("r", new HackLoopTableRenderPolicy(true))
+ .setValidErrorHandler(new PreserveReportPicturePlaceholderHandler())
+ .useSpringEL(true)
+ .build();
+
+ String finalProductAndModel = productAndModel;
+ String finalProductName = productName;
+ String finalCustomerName = customerName;
+ String finalDetectionCategory = detectionCategory;
+ String finalSampleCode = defaultReportText(sampleCode, "/");
+ String finalStandardMethodText = defaultReportText(standardMethodText, "/");
+ String finalProductionDate = productionDate;
+ String finalBatchNo = batchNo;
+ String finalResultRemark = resultRemark;
+ String equipmentText = buildEquipmentText(finalDeviceList);
+ String issueDate = now.format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�"));
+ String finalReportModelStr = finalModelStr;
+ LocalDateTime finalReportSendTime = finalSendTime;
+ XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render(
+ new HashMap<String, Object>() {{
+ put("order", insOrder);
+ put("report", insReport);
+ put("environment", finalEnvironment);
+ put("custom", custom);
+ put("sampleSize", insOrder.getTestQuantity());
+ put("tables", tables);
+ put("tableSize", tables.size() + 1);
+ put("standardMethod", finalStandardMethodText);
+ put("deviceList", finalDeviceList);
+ put("twoCode", null);
+ put("models", finalReportModelStr);
+ put("productSize", productSize.get());
+ put("createTime", now.format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�")));
+ put("createTimeEn", monthNames[now.getMonthValue() - 1] + " " + now.format(DateTimeFormatter.ofPattern("dd, yyyy")));
+ put("insTime", insTime);
+ put("insTimeEn", insTimeEn);
+ put("writeUrl", null);
+ put("insUrl", null);
+ put("images", images);
+ put("examineUrl", null);
+ put("ratifyUrl", null);
+ put("orderType", finalOrderType);
+ put("getTime", finalReportSendTime.format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�")));
+ put("getTimeEn", monthNames[finalReportSendTime.getMonthValue() - 1] + " " + finalReportSendTime.format(DateTimeFormatter.ofPattern("dd, yyyy")));
+ put("seal1", null);
+ put("seal2", null);
+ put("formTypeCh", formType);
+ put("formTypeEn", insOrder.getFormType());
+ put("resultCh", finalResultCh);
+ put("resultEn", finalResultEn);
+ put("sampleStatus", sampleStatus);
+ // 鏂扮増妫�娴嬫姤鍛婃ā鏉匡紙鍙傜収銆婃湁鏈烘隘妫�娴嬫姤鍛娿�嬶級浣跨敤鐨勬墎骞冲瓧娈点��
+ put("no", insReport.getCode());
+ put("cover", finalProductAndModel);
+ put("product", finalProductName);
+ put("model", defaultReportText(finalReportModelStr, "/"));
+ put("customer", finalCustomerName);
+ put("category", finalDetectionCategory);
+ put("date", issueDate);
+ put("maker", defaultReportText(insOrder.getProduction(), "/"));
+ put("env", finalEnvironment);
+ put("qty", defaultReportText(insOrder.getTestQuantity(), "/"));
+ put("receive", finalReportSendTime.format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�")));
+ put("sampleNo", finalSampleCode);
+ put("appearance", defaultReportText(sampleStatus, "/"));
+ put("sender", defaultReportText(insOrder.getPrepareUser(), "/"));
+ put("produced", finalProductionDate);
+ put("batch", finalBatchNo);
+ put("phone", defaultReportText(insOrder.getPhone(), "/"));
+ put("testDate", insTime);
+ put("entrustNo", defaultReportText(insOrder.getEntrustCode(), "/"));
+ put("sampling", "/");
+ put("standard", finalStandardMethodText);
+ put("equipment", equipmentText);
+ put("conclusion", "鏍峰搧鎸夊鎵樻柟瑕佹眰杩涜妫�娴嬶紝鏁版嵁瑙佹娴嬬粨鏋溿��");
+ put("remark", "鏈姤鍛婃娴嬬粨鏋滀粎瀵瑰綋鏃ユ墍鎺ユ敹鏍峰搧璐熻矗銆�");
+ put("r", detectionResultRows);
+ put("resultNote", finalResultRemark);
+ }});
+ try {
+ String name = insReport.getCode().replace("/", "") + (showResult ? "-J.docx" : "-C.docx");
+ Files.createDirectories(Paths.get(wordUrl));
+ template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl, name)));
+ insReport.setUrl("/word/" + name);
+ insReport.setWriteUserId(writeUserId);//缂栧埗浜猴紙妫�楠屼汉锛�
+ insReport.setWriteTime(LocalDateTime.now());//鎻愪氦鏃堕棿
+ saveGeneratedReport(insReport);
+ inputStream.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void saveGeneratedReport(InsReport report) {
+ InsReport existing = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getInsOrderId, report.getInsOrderId())
+ .last("limit 1"));
+ if (Objects.equals(report.getReportType(), INSPECTION_REPORT)) {
+ String inspectionUrl = report.getUrl();
+ if (existing == null) {
+ report.setReportType(DETECTION_REPORT);
+ report.setUrl(null);
+ report.setInspectionUrl(inspectionUrl);
+ insReportMapper.insert(report);
+ } else {
+ insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate()
+ .eq(InsReport::getId, existing.getId())
+ .set(InsReport::getInspectionUrl, inspectionUrl)
+ .set(InsReport::getWriteUserId, report.getWriteUserId())
+ .set(InsReport::getWriteTime, report.getWriteTime()));
+ }
+ return;
+ }
+ if (existing == null) {
+ insReportMapper.insert(report);
+ return;
+ }
+ report.setId(existing.getId());
+ insReportMapper.updateById(report);
+ }
+
+ /**
+ * 鏂扮増妫�娴嬫姤鍛婄殑缁撴灉琛ㄥ浐瀹氫负鍥涘垪锛氬簭鍙枫�佹娴嬮」鐩�佸崟浣嶃�佹娴嬬粨鏋溿��
+ */
+ private List<Map<String, String>> buildDetectionResultRows(List<SampleProductDto> samples) {
+ List<Map<String, String>> rows = new ArrayList<>();
+ if (CollectionUtils.isEmpty(samples)) {
+ return rows;
+ }
+
+ boolean multipleSamples = samples.size() > 1;
+ int sequence = 1;
+ for (SampleProductDto sample : samples) {
+ if (CollectionUtils.isEmpty(sample.getInsProduct())) {
+ continue;
+ }
+ for (InsProduct product : sample.getInsProduct()) {
+ // 缁戝畾椤圭洰浠呭弬涓庤绠楋紝涓嶅簲鍑虹幇鍦ㄦ姤鍛婁腑銆�
+ if (product == null || Objects.equals(product.getIsBinding(), 1)) {
+ continue;
+ }
+
+ String itemName = defaultReportText(
+ product.getInspectionItemSubclass(),
+ defaultReportText(product.getInspectionItem(), product.getInspectionItemClass()));
+ if (multipleSamples && StringUtils.isNotBlank(sample.getSampleCode())) {
+ itemName = sample.getSampleCode() + " - " + itemName;
+ }
+
+ Map<String, String> row = new LinkedHashMap<>();
+ row.put("seq", String.valueOf(sequence++));
+ row.put("itemName", itemName);
+ row.put("unit", defaultReportText(product.getUnit(), "/"));
+ row.put("result", defaultReportText(product.getLastValue(), "/"));
+ row.put("inspectionConclusion", formatInspectionConclusion(product.getInsResult()));
+ rows.add(row);
+ }
+ }
+ return rows;
+ }
+
+ /**
+ * 鏂拌仛鐩寸粦妯℃澘璁㈠崟锛氭ā鏉夸腑姣忎竴涓�滃鍑哄�尖�濇壒娉ㄩ兘瀵瑰簲鎶ュ憡涓殑涓�鏉℃娴嬮」鐩��
+ */
+ private List<Map<String, String>> buildTemplateDetectionResultRows(Integer orderId) {
+ List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId)
+ .orderByAsc(InsOrderStandardTemplate::getSort, InsOrderStandardTemplate::getId));
+ List<Map<String, String>> rows = new ArrayList<>();
+ int sequence = 1;
+ for (InsOrderStandardTemplate snapshot : snapshots) {
+ List<TemplateExportCell> exportCells = getTemplateExportCells(snapshot.getThing());
+ JSONObject recordValues = StrUtil.isBlank(snapshot.getRecordValues())
+ ? new JSONObject() : JSON.parseObject(snapshot.getRecordValues());
+ for (TemplateExportCell exportCell : exportCells) {
+ String result = readTemplateCellText(recordValues, exportCell.resultCoordinate, exportCell.templateValues);
+ if (StringUtils.isBlank(result)) {
+ throw new ErrorException("妯℃澘鈥�" + defaultReportText(snapshot.getName(), "妯℃澘ID " + snapshot.getTemplateId())
+ + "鈥濈殑瀵煎嚭鍊间笉鑳戒负绌猴紙" + exportCell.resultCoordinate + "锛�");
+ }
+ String unit = exportCell.unitCoordinate == null ? null
+ : readTemplateCellText(recordValues, exportCell.unitCoordinate, exportCell.templateValues);
+ String itemName = exportCell.itemCoordinate == null ? null
+ : readTemplateCellText(recordValues, exportCell.itemCoordinate, exportCell.templateValues);
+
+ Map<String, String> row = new LinkedHashMap<>();
+ row.put("seq", String.valueOf(sequence++));
+ String reportItemName = defaultReportText(itemName,
+ defaultReportText(snapshot.getName(), "妯℃澘ID " + snapshot.getTemplateId()));
+ row.put("itemName", formatExportItemName(reportItemName));
+ row.put("unit", defaultReportText(unit, "/"));
+ row.put("result", result);
+ row.put("inspectionConclusion", formatInspectionConclusion(snapshot.getInsResult()));
+ rows.add(row);
+ }
+ }
+ if (rows.isEmpty()) {
+ throw new ErrorException("褰撳墠璁㈠崟鏈壘鍒板彲鐢熸垚鎶ュ憡鐨勫師濮嬭褰曟ā鏉�");
+ }
+ return rows;
+ }
+
+ private static String formatInspectionConclusion(Integer insResult) {
+ if (Objects.equals(insResult, 1)) {
+ return "鍚堟牸";
+ }
+ if (Objects.equals(insResult, 0)) {
+ return "涓嶅悎鏍�";
+ }
+ return "/";
+ }
+
+ private List<TemplateExportCell> getTemplateExportCells(String compressedThing) {
+ if (StrUtil.isBlank(compressedThing)) {
+ throw new ErrorException("鍘熷璁板綍妯℃澘涓虹┖");
+ }
+ String thing;
+ try {
+ thing = GZipUtil.uncompress(compressedThing);
+ } catch (Exception ignored) {
+ thing = compressedThing;
+ }
+ JSONObject sheet = JSON.parseObject(thing).getJSONArray("data").getJSONObject(0);
+ JSONArray cellData = sheet.getJSONArray("celldata");
+ Integer unitColumn = null;
+ List<int[]> exportCells = new ArrayList<>();
+ Map<String, String> templateValues = new HashMap<>();
+ for (Object item : cellData) {
+ JSONObject cell = JSON.parseObject(JSON.toJSONString(item));
+ Integer row = cell.getInteger("r");
+ Integer column = cell.getInteger("c");
+ JSONObject value = cell.getJSONObject("v");
+ if (row == null || column == null || value == null) {
+ continue;
+ }
+ String displayValue = value.get("v") == null ? null : String.valueOf(value.get("v"));
+ templateValues.put(row + "-" + column, displayValue);
+ if (unitColumn == null && "鍗曚綅".equals(StringUtils.trim(displayValue))) {
+ unitColumn = column;
+ }
+ JSONObject ps = value.getJSONObject("ps");
+ if (ps != null && "瀵煎嚭鍊�".equals(ps.getString("value"))) {
+ exportCells.add(new int[]{row, column});
+ }
+ }
+ if (exportCells.isEmpty()) {
+ throw new ErrorException("妯℃澘蹇呴』鑷冲皯閰嶇疆涓�涓鍑哄�兼壒娉�");
+ }
+ exportCells.sort(Comparator.comparingInt((int[] cell) -> cell[0]).thenComparingInt(cell -> cell[1]));
+ List<TemplateExportCell> results = new ArrayList<>();
+ for (int[] exportCell : exportCells) {
+ TemplateExportCell result = new TemplateExportCell();
+ result.resultCoordinate = getRightAdjacentCoordinate(sheet, exportCell[0], exportCell[1]);
+ result.itemCoordinate = exportCell[0] + "-" + exportCell[1];
+ result.unitCoordinate = unitColumn == null ? null : exportCell[0] + "-" + unitColumn;
+ result.templateValues = templateValues;
+ results.add(result);
+ }
+ return results;
+ }
+
+ private String readTemplateCellText(JSONObject recordValues, String coordinate, Map<String, String> templateValues) {
+ JSONObject recordCell = recordValues == null ? null : recordValues.getJSONObject(coordinate);
+ if (recordCell != null && recordCell.get("v") != null) {
+ String value = String.valueOf(recordCell.get("v"));
+ if (StringUtils.isNotBlank(value)) {
+ return value;
+ }
+ }
+ return templateValues.get(coordinate);
+ }
+
+ private static class TemplateExportCell {
+ private String itemCoordinate;
+ private String resultCoordinate;
+ private String unitCoordinate;
+ private Map<String, String> templateValues;
+ }
+
+ private static String buildEquipmentText(List<Map<String, String>> deviceList) {
+ if (CollectionUtils.isEmpty(deviceList)) {
+ return "/";
+ }
+ Set<String> equipmentItems = new LinkedHashSet<>();
+ for (Map<String, String> device : deviceList) {
+ String name = getMapText(device, "deviceName", "device_name");
+ String managementNumber = getMapText(device, "managementNumber", "management_number");
+ if (StringUtils.isBlank(name) || "/".equals(name.trim())) {
+ continue;
+ }
+ String number = StringUtils.isBlank(managementNumber) || "/".equals(managementNumber.trim())
+ ? "鍑哄巶缂栧彿" : managementNumber.trim();
+ String item = name.trim() + "锛�" + number;
+ equipmentItems.add(item);
+ }
+ if (equipmentItems.isEmpty()) {
+ return "/";
+ }
+ List<String> items = new ArrayList<>(equipmentItems);
+ List<String> lines = new ArrayList<>();
+ for (int i = 0; i < items.size(); i++) {
+ String punctuation = i == items.size() - 1 ? "銆�" : "锛�";
+ lines.add((i + 1) + ". " + items.get(i) + punctuation);
+ }
+ return String.join("\n", lines);
+ }
+
+ private String buildReportEnvironment(Integer orderId, InsOrder order) {
+ List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, orderId)
+ .select(InsOrderStandardTemplate::getTemperature,
+ InsOrderStandardTemplate::getHumidity));
+ List<String> temperatures = snapshots.stream()
+ .map(InsOrderStandardTemplate::getTemperature)
+ .filter(StringUtils::isNotBlank)
+ .collect(Collectors.toList());
+ List<String> humidities = snapshots.stream()
+ .map(InsOrderStandardTemplate::getHumidity)
+ .filter(StringUtils::isNotBlank)
+ .collect(Collectors.toList());
+
+ String temperature = formatConditionRange(temperatures, order.getTemperature(), "鈩�");
+ String humidity = formatConditionRange(humidities, order.getHumidity(), "%RH");
+ return Stream.of(temperature, humidity)
+ .filter(StringUtils::isNotBlank)
+ .collect(Collectors.joining(" "));
+ }
+
+ private static String formatConditionRange(List<String> values, String fallback, String unit) {
+ List<BigDecimal> numbers = new ArrayList<>();
+ List<String> candidates = CollectionUtils.isEmpty(values)
+ ? Collections.singletonList(fallback) : values;
+ Pattern numberPattern = Pattern.compile("-?\\d+(?:\\.\\d+)?");
+ for (String value : candidates) {
+ if (StringUtils.isBlank(value)) {
+ continue;
+ }
+ java.util.regex.Matcher matcher = numberPattern.matcher(value);
+ while (matcher.find()) {
+ numbers.add(new BigDecimal(matcher.group()));
+ }
+ }
+ if (numbers.isEmpty()) {
+ // 鈥�/鈥濊〃绀烘ā鏉挎槑纭~鍐欎簡涓嶉�傜敤锛屼笉鑳藉啀鎸夌┖鍊煎鐞嗘垨杩藉姞鍗曚綅銆�
+ return candidates.stream()
+ .filter(StringUtils::isNotBlank)
+ .map(String::trim)
+ .distinct()
+ .collect(Collectors.joining("~"));
+ }
+ BigDecimal minimum = Collections.min(numbers);
+ BigDecimal maximum = Collections.max(numbers);
+ String minimumText = minimum.stripTrailingZeros().toPlainString();
+ if (minimum.compareTo(maximum) == 0) {
+ return minimumText + unit;
+ }
+ return minimumText + "~" + maximum.stripTrailingZeros().toPlainString() + unit;
+ }
+
+ /**
+ * 鎶ュ憡椤圭洰鍚嶇О涓嶅睍绀烘ā鏉胯绠楄繃绋嬩腑鐨勨�滃钩鍧囧�尖�濆瓧鏍峰強鍏跺悗鐨勫垎闅旈�楀彿銆�
+ */
+ private static String formatExportItemName(String itemName) {
+ if (StringUtils.isBlank(itemName)) {
+ return itemName;
+ }
+ return itemName.replaceAll("骞冲潎鍊糪\s*[锛�,]?\\s*", "");
+ }
+
+ private static String getMapText(Map<String, String> map, String... keys) {
+ if (map == null) {
+ return null;
+ }
+ for (String key : keys) {
+ String value = map.get(key);
+ if (StringUtils.isNotBlank(value)) {
+ return value;
+ }
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ if (entry.getKey() != null && entry.getKey().equalsIgnoreCase(key)
+ && StringUtils.isNotBlank(entry.getValue())) {
+ return entry.getValue();
+ }
+ }
+ }
+ return null;
+ }
+
+ private static String defaultReportText(String value, String fallback) {
+ if (StringUtils.isNotBlank(value)) {
+ return value;
+ }
+ return StringUtils.isNotBlank(fallback) ? fallback : "/";
+ }
+
+ private static String formatReportTestDate(List<LocalDate> detectionDates) {
+ if (CollectionUtils.isEmpty(detectionDates)) {
+ return "/";
+ }
+ LocalDate startDate = Collections.min(detectionDates);
+ LocalDate endDate = Collections.max(detectionDates);
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�");
+ if (startDate.equals(endDate)) {
+ return startDate.format(formatter);
+ }
+ return startDate.format(formatter) + "鑷�" + endDate.format(formatter);
+ }
+
+ private static String formatReportTestDateEn(List<LocalDate> detectionDates, String[] monthNames) {
+ if (CollectionUtils.isEmpty(detectionDates)) {
+ return "/";
+ }
+ LocalDate startDate = Collections.min(detectionDates);
+ LocalDate endDate = Collections.max(detectionDates);
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd, yyyy");
+ String startText = monthNames[startDate.getMonthValue() - 1] + " " + startDate.format(formatter);
+ if (startDate.equals(endDate)) {
+ return startText;
+ }
+ return startText + "-" + monthNames[endDate.getMonthValue() - 1] + " " + endDate.format(formatter);
+ }
+
+ /**
+ * 璁$畻琛ㄦ牸鍒楀搴�
+ *
+ * @param max 鏈�澶ф楠屼釜鏁�
+ * @return
+ */
+ private static int[] calcTableColWidths(int max, boolean showResult) {
+ if (!showResult) {
+ switch (max) {
+ case 1:
+ return new int[]{650, 2200, 2200, 850, 2300, 1800};
+ case 2:
+ return new int[]{650, 1600, 1600, 850, 1900, 1700, 1700};
+ case 3:
+ return new int[]{650, 1400, 1400, 850, 1600, 1375, 1375, 1375};
+ case 4:
+ return new int[]{650, 1250, 1250, 850, 1450, 1140, 1140, 1140, 1140};
+ case 5:
+ return new int[]{650, 1150, 1150, 850, 1300, 980, 980, 980, 980, 980};
+ default:
+ return new int[0];
+ }
+ }
+ int[] colWidths = null;
+ switch (max) {
+ case 1:
+ colWidths = new int[]{650, 2000, 2000, 850, 2200, 2100, 1200};
+ break;
+ case 2:
+ colWidths = new int[]{650, 1400, 1400, 850, 2100, 1200, 1200, 1200};
+ break;
+ case 3:
+ colWidths = new int[]{650, 1400, 1400, 850, 1500, 1000, 1000, 1000, 1200};
+ break;
+ case 4:
+ colWidths = new int[]{650, 1200, 1200, 850, 1400, 850, 850, 850, 850, 1200};
+ break;
+ case 5:
+ colWidths = new int[]{650, 1100, 1100, 850, 1350, 750, 750, 750, 750, 750, 1200};
+ break;
+ }
+ if (ObjectUtils.isNull(colWidths)) {
+ List<Integer> defaultColWidths = new ArrayList<>(Arrays.asList(650, 1100, 1100, 850, 1350));
+ int totalWidth = 3000;//鎬诲搴�
+ int byOneWidth = totalWidth / max;//姣忎竴涓殑瀹藉害
+ int realWidth = 0;//瀹為檯瀹藉害
+ for (int i = 0; i < max; i++) {
+ realWidth += byOneWidth;
+ defaultColWidths.add(byOneWidth);
+ }
+ defaultColWidths.add(1200 + (totalWidth - realWidth));
+ return defaultColWidths.stream().mapToInt(Integer::intValue).toArray();
+ }
+ return colWidths;
+ }
+
+ /**
+ * 璋冩暣楂樺害
+ *
+ * @param row
+ * @param rowHeight
+ * @return
+ */
+ private static double adjustRowHeight(RowRenderData row, double rowHeight, int max) {
+ // 鏍规嵁妫�楠岄」鐩悕绉拌繘琛岄珮搴﹁皟鏁�
+ TextRenderData renderData = (TextRenderData) row.getCells().get(1).getParagraphs().get(0).getContents().get(0);
+ String dataText = renderData.getText();
+ TextRenderData valueData = (TextRenderData) row.getCells().get(5).getParagraphs().get(0).getContents().get(0);
+ String valueText = valueData.getText();
+ // 鑾峰彇妫�娴嬪唴瀹瑰垽鏂槸鍚﹁秴鍑�
+ if (StringUtils.isNotBlank(dataText) && dataText.contains("@")) {
+ double number = 1;
+ double chinaLength = 14;
+ double englishLength = 28;
+ double valueLength = 6;
+ // 鏍规嵁绾胯姱涓暟鍒ゆ柇璺濈
+ switch (max) {
+ case 1:
+ chinaLength = 15;
+ englishLength = 30;
+ valueLength = 8;
+ break;
+ case 2:
+ chinaLength = 13;
+ englishLength = 25;
+ valueLength = 6;
+ break;
+ case 3:
+ chinaLength = 13;
+ englishLength = 25;
+ valueLength = 4;
+ break;
+ case 4:
+ chinaLength = 13;
+ englishLength = 23;
+ valueLength = 3;
+ break;
+ case 5:
+ chinaLength = 12;
+ englishLength = 22;
+ valueLength = 2;
+ break;
+ }
+ // 鏍规嵁@绗﹀彿鎴彇涓嫳鏂�
+ String[] split = dataText.split("@");
+ // 鏂囧瓧鍊嶆暟
+ double chinaMultiple = (Math.ceil(split[0].length() / chinaLength)) - 1;
+
+ // 鑻辨枃鍊嶆暟
+ double englishMultiple = (Math.ceil(split[1].length() / englishLength)) - 1;
+ double multiple = number + chinaMultiple * 0.5 + englishMultiple * 0.5;
+
+ if (StringUtils.isNotBlank(valueText)) {
+ double valueMultiple = (Math.ceil(valueText.length() / valueLength)) - 1;
+ if (multiple < number + valueMultiple * 0.4) {
+ multiple = number + valueMultiple * 0.4;
+ }
+ }
+ rowHeight = rowHeight * multiple;
+ }
+ return rowHeight;
+ }
+
+ /**
+ * 鍚堝苟鍗曞厓鏍�
+ */
+ private void updaeMerge(XWPFDocument document, boolean isSmall) {
+ // 澶勭悊鍚堝苟鍗曞厓鏍肩殑闂
+ // 鑾峰彇鏂囨。涓殑鎵�鏈夎〃鏍�
+ List<XWPFTable> xwpfTables = document.getTables();
+ // 閬嶅巻琛ㄦ牸
+ for (int i = 1; i < xwpfTables.size(); i++) {
+ // 鍒涘缓涓�涓狧ashSet鏉ュ瓨鍌ㄥ敮涓�鐨勫瓧绗︿覆锛堣繖閲屽熀浜�"鈭�"鍒嗗壊鍚庣殑绗簩閮ㄥ垎锛�
+ Set<String> set1 = new HashSet<>();
+ // 鍒涘缓涓�涓狧ashMap鏉ュ瓨鍌ㄦ瘡涓敮涓�瀛楃涓插強鍏跺搴旂殑鍗曞厓鏍间綅缃俊鎭�
+ Map<String, Map<String, Integer>> maps = new HashMap<>();
+ // 閬嶅巻褰撳墠琛ㄦ牸鐨勬墍鏈夎
+ for (int j = 0; j < xwpfTables.get(i).getRows().size(); j++) {
+ // 閬嶅巻褰撳墠琛岀殑鎵�鏈夊崟鍏冩牸
+ for (int k = 0; k < xwpfTables.get(i).getRows().get(j).getTableCells().size(); k++) {
+ // 妫�鏌ュ崟鍏冩牸鏂囨湰涓槸鍚﹀寘鍚�"鈭�"
+ if (xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().indexOf("鈭�") > -1) {
+ String[] split = xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().split("鈭�");
+ // 濡傛灉鍒嗗壊鍚庣殑绗簩閮ㄥ垎鏄柊鐨勶紙鍗充箣鍓嶆湭鍑虹幇杩囷級锛屽垯娣诲姞鍒皊et1骞跺垱寤轰綅缃俊鎭痬ap
+ if (set1.add(split[1])) {
+ Map<String, Integer> map = new HashMap<>();
+ // 瀛樺偍璧峰琛屻�佽捣濮嬪垪銆佺粨鏉熻锛堝綋鍓嶈锛夈�佺粨鏉熷垪锛堝綋鍓嶅垪锛�
+ map.put("sr", j);
+ map.put("sc", k);
+ map.put("er", j + 0);
+ map.put("ec", k + 0);
+ maps.put(split[1], map);
+ } else {
+ // 濡傛灉宸插瓨鍦紝鍒欐洿鏂扮粨鏉熻鎴栫粨鏉熷垪
+ Map<String, Integer> map1 = maps.get(split[1]);
+ if (j == map1.get("sr")) {
+ map1.put("ec", map1.get("ec") + 1);
+ } else if (k == map1.get("sc")) {
+ map1.put("er", map1.get("er") + 1);
+ }
+ }
+ // 鍒ゆ柇灏忛珮鎶ュ憡杩樻槸澶ф姤鍛�
+ if (isSmall) {
+ // 鑾峰彇鍗曞厓鏍�
+ XWPFTableCell cell = xwpfTables.get(i).getRows().get(j).getTableCells().get(k);
+ XWPFParagraph paragraph = cell.getParagraphArray(0);
+ String originalText = paragraph.getText();
+ String newText = originalText.split("鈭�")[0];
+ List<XWPFRun> runs = paragraph.getRuns();
+ for (XWPFRun run : runs) {
+ run.setText("", 0); // 娓呯┖ run 涓殑鏂囨湰
+ }
+ if (!runs.isEmpty()) {
+ XWPFRun run = runs.get(0);
+ run.setText(newText);
+
+ // 澶嶅埗鏍峰紡
+ run.setFontFamily(paragraph.getRuns().get(0).getFontFamily());
+ run.setFontSize(paragraph.getRuns().get(0).getFontSize());
+ run.setBold(paragraph.getRuns().get(0).isBold());
+ run.setItalic(paragraph.getRuns().get(0).isItalic());
+ run.setUnderline(paragraph.getRuns().get(0).getUnderline());
+ run.setColor(paragraph.getRuns().get(0).getColor());
+ }
+
+ cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
+ paragraph.setAlignment(ParagraphAlignment.CENTER);
+ } else {
+ // 绉婚櫎鍖呭惈"鈭�"鐨勬钀斤紝骞堕噸鏂拌缃崟鍏冩牸鏂囨湰鍜屾牱寮�
+ String str = xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().split("鈭�")[0];
+ xwpfTables.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0);
+ xwpfTables.get(i).getRows().get(j).getTableCells().get(k).setText(str);
+ xwpfTables.get(i).getRows().get(j).getTableCells().get(k).setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
+ xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getParagraphArray(0).setAlignment(ParagraphAlignment.CENTER);
+ }
+ }
+ }
+ }
+
+ // 鍗曞厓鏍兼帓搴�, 閬垮厤鏍煎紡閿欎贡
+ List<Map.Entry<String, Map<String, Integer>>> entries = new ArrayList<>(maps.entrySet());
+ entries.sort((o1, o2) -> o1.getValue().get("sc") - o2.getValue().get("sc"));
+
+ // 鎸夌収椤哄簭娣诲姞杩涢泦鍚�
+ List<String> list = new ArrayList<>();
+ for (Map.Entry<String, Map<String, Integer>> entry : entries) {
+ list.add(entry.getKey());
+ }
+
+ for (int a = list.size() - 1; a >= 0; a--) {
+ Map<String, Integer> v = maps.get(list.get(a));
+ for (int j = 0; j < v.get("er") - v.get("sr") + 1; j++) {
+ if (v.get("ec") > v.get("sc")) {
+ try {
+ TableTools.mergeCellsHorizonal(xwpfTables.get(i), v.get("sr") + j, v.get("sc"), v.get("ec"));
+ } catch (Exception e) {
+ }
+ }
+ }
+ if (v.get("er") > v.get("sr")) {
+ try {
+ TableTools.mergeCellsVertically(xwpfTables.get(i), v.get("sc"), v.get("sr"), v.get("er"));
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
+
+ //澶勭悊涓嫳鏂囨崲琛岀殑闂
+
+ List<XWPFTable> xwpfTables1 = document.getTables();
+ for (int i = 1; i < xwpfTables1.size(); i++) {
+ for (int j = 0; j < xwpfTables1.get(i).getRows().size(); j++) {
+ for (int k = 0; k < xwpfTables1.get(i).getRows().get(j).getTableCells().size(); k++) {
+ if (xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText().contains("@")) {
+ if (isSmall) {
+ // 鑾峰彇鍘熸湁娈佃惤鐨勭涓�涓� XWPFRun
+ String text = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText();
+ XWPFParagraph oldParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getParagraphs().get(0);
+ XWPFRun oldRun = oldParagraph.getRuns().get(0);
+ // 淇濆瓨鍘熸湁鏍峰紡
+ String fontFamily = oldRun.getFontFamily();
+ int fontSize = oldRun.getFontSize();
+ boolean isBold = oldRun.isBold();
+ boolean isItalic = oldRun.isItalic();
+ boolean isUnderline = oldRun.getUnderline() != UnderlinePatterns.NONE;
+ // 鍒犻櫎鍘熸湁娈佃惤
+ xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0);
+ // 娣诲姞鏂版钀�
+ XWPFParagraph newParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).addParagraph();
+ XWPFRun newRun = newParagraph.createRun();
+ // 搴旂敤淇濆瓨鐨勬牱寮�
+ newRun.setFontFamily(fontFamily);
+ newRun.setFontSize(fontSize);
+ newRun.setBold(isBold);
+ newRun.setItalic(isItalic);
+ if (isUnderline) {
+ newRun.setUnderline(UnderlinePatterns.SINGLE);
+ }
+ // 璁剧疆鏂版枃鏈�
+ String[] split = text.split("@");
+ newRun.setText(split[0]);
+ if (split.length > 1) {
+ newRun.addBreak();
+ newRun.setText(split[1]);
+ }
+ // 璁剧疆娈佃惤瀵归綈鏂瑰紡
+ newParagraph.setAlignment(ParagraphAlignment.CENTER);
+ } else {
+ String text = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText();
+ String[] split = text.split("@");
+ xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0);
+ XWPFParagraph xwpfParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).addParagraph();
+ XWPFRun run = xwpfParagraph.createRun();
+ run.setText(split[0]);
+ if (ObjectUtils.isNotNull(split[1])) {
+ run.addBreak();
+ run.setText(split[1]);
+ }
+ xwpfParagraph.setAlignment(ParagraphAlignment.CENTER);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ /**
+ * 娣诲姞鎶ュ憡琛ㄥご
+ *
+ * @param sample
+ * @param text
+ * @param rowRenderData
+ * @param rows
+ * @param max
+ * @param cableTags 绾胯姱棰滆壊
+ */
+ private static void addHead(SampleProductDto sample, List<TextRenderData> text, RowRenderData rowRenderData, List<RowRenderData> rows, int max, List<String> cableTags, boolean showResult) {
+ // 绗竴琛�
+ TextRenderData firstRenderData1 = new TextRenderData();
+ firstRenderData1.setText("鏍峰搧缂栧彿@Sample No.鈭�1");
+ Style firstStyle1 = new Style();
+ firstStyle1.setFontFamily("瀹嬩綋");
+ firstStyle1.setColor("000000");
+ firstRenderData1.setStyle(firstStyle1);
+ text.add(firstRenderData1);
+
+ TextRenderData firstRenderData2 = new TextRenderData();
+ firstRenderData2.setText("鏍峰搧缂栧彿@Sample No.鈭�1");
+ Style firstStyle2 = new Style();
+ firstStyle2.setFontFamily("瀹嬩綋");
+ firstStyle2.setColor("000000");
+ firstRenderData2.setStyle(firstStyle2);
+ text.add(firstRenderData2);
+
+ TextRenderData firstRenderData3 = new TextRenderData();
+ firstRenderData3.setText(sample.getSampleCode() + "鈭�2");
+ Style firstStyle3 = new Style();
+ firstStyle3.setFontFamily("瀹嬩綋");
+ firstStyle3.setColor("000000");
+ firstRenderData3.setStyle(firstStyle3);
+ text.add(firstRenderData3);
+
+ TextRenderData firstRenderData4 = new TextRenderData();
+ firstRenderData4.setText(sample.getSampleCode() + "鈭�2");
+ Style firstStyle4 = new Style();
+ firstStyle4.setFontFamily("瀹嬩綋");
+ firstStyle4.setColor("000000");
+ firstRenderData4.setStyle(firstStyle4);
+ text.add(firstRenderData4);
+
+
+ // 鍒ゆ柇寰幆鏉′欢
+
+ if (max <= 2) {
+ for (int i = 0; i < max; i++) {
+ TextRenderData firstRenderData5 = new TextRenderData();
+ firstRenderData5.setText("瑙勬牸鍨嬪彿@Type鈭�3");
+ Style firstStyle5 = new Style();
+ firstStyle5.setFontFamily("瀹嬩綋");
+ firstStyle5.setColor("000000");
+ firstRenderData4.setStyle(firstStyle5);
+ text.add(firstRenderData5);
+ }
+ for (int i = 0; i < 2; i++) {
+ TextRenderData firstRenderData6 = new TextRenderData();
+ firstRenderData6.setText(sample.getModel() + "鈭�4");
+ Style firstStyle6 = new Style();
+ firstStyle6.setFontFamily("瀹嬩綋");
+ firstStyle6.setColor("000000");
+ firstRenderData6.setStyle(firstStyle6);
+ text.add(firstRenderData6);
+ }
+ } else {
+ for (int i = 0; i < 2; i++) {
+ TextRenderData firstRenderData5 = new TextRenderData();
+ firstRenderData5.setText("瑙勬牸鍨嬪彿@Type鈭�3");
+ Style firstStyle5 = new Style();
+ firstStyle5.setFontFamily("瀹嬩綋");
+ firstStyle5.setColor("000000");
+ firstRenderData4.setStyle(firstStyle5);
+ text.add(firstRenderData5);
+ }
+ for (int i = 0; i < max; i++) {
+ TextRenderData firstRenderData6 = new TextRenderData();
+ firstRenderData6.setText(sample.getModel() + "鈭�4");
+ Style firstStyle6 = new Style();
+ firstStyle6.setFontFamily("瀹嬩綋");
+ firstStyle6.setColor("000000");
+ firstRenderData6.setStyle(firstStyle6);
+ text.add(firstRenderData6);
+ }
+
+ }
+ // 妫�娴嬫姤鍛婁笉灞曠ず鈥滅粨璁衡�濆垪锛岄琛屼篃瑕佸悓姝ュ噺灏戜竴涓崟鍏冩牸锛�
+ // 鍚﹀垯棣栬涓� max + 6 鍒椼�佸叾浣欒涓� max + 5 鍒楋紝poi-tl 鏃犳硶娓叉煋琛ㄦ牸銆�
+ if (!showResult && !text.isEmpty()) {
+ text.remove(text.size() - 1);
+ }
+ TextRenderData[] text2 = text.toArray(new TextRenderData[0]);
+ rowRenderData = Rows.of(text2).center().rowAtleastHeight(1).create();
+ rows.add(rowRenderData);
+ text = new ArrayList<>();
+
+ // 绗簩琛�
+ TextRenderData headRenderData1 = new TextRenderData();
+ headRenderData1.setText("搴忓彿@NO.");
+ Style headStyle1 = new Style();
+ headStyle1.setFontFamily("瀹嬩綋");
+ headStyle1.setColor("000000");
+ headRenderData1.setStyle(headStyle1);
+ text.add(headRenderData1);
+
+ TextRenderData headRenderData2 = new TextRenderData();
+ headRenderData2.setText("妫�楠岄」鐩瓳Test item鈭�5");
+ Style headStyle2 = new Style();
+ headStyle2.setFontFamily("瀹嬩綋");
+ headStyle2.setColor("000000");
+ headRenderData2.setStyle(headStyle2);
+ text.add(headRenderData2);
+
+ TextRenderData headRenderData3 = new TextRenderData();
+ headRenderData3.setText("妫�楠岄」鐩瓳Test item鈭�5");
+ Style headStyle3 = new Style();
+ headStyle3.setFontFamily("瀹嬩綋");
+ headStyle3.setColor("000000");
+ headRenderData3.setStyle(headStyle3);
+ text.add(headRenderData3);
+
+ TextRenderData headRenderData4 = new TextRenderData();
+ headRenderData4.setText("鍗曚綅@Unit");
+ Style headStyle4 = new Style();
+ headStyle4.setFontFamily("瀹嬩綋");
+ headStyle4.setColor("000000");
+ headRenderData4.setStyle(headStyle4);
+ text.add(headRenderData4);
+
+ TextRenderData headRenderData5 = new TextRenderData();
+ headRenderData5.setText("鏍囧噯瑕佹眰@Requirement");
+ Style headStyle5 = new Style();
+ headStyle5.setFontFamily("瀹嬩綋");
+ headStyle5.setColor("000000");
+ headRenderData5.setStyle(headStyle5);
+ text.add(headRenderData5);
+
+ for (int i = 0; i < max; i++) {
+ TextRenderData headRenderData6 = new TextRenderData();
+ headRenderData6.setText(showResult ? "妫�楠岀粨鏋淍Test result鈭�6" : "妫�娴嬫暟鎹瓳Test data鈭�6");
+ Style headStyle6 = new Style();
+ headStyle6.setFontFamily("瀹嬩綋");
+ headStyle6.setColor("000000");
+ headRenderData6.setStyle(headStyle6);
+ text.add(headRenderData6);
+ }
+ if (showResult) {
+ TextRenderData headRenderData7 = new TextRenderData();
+ headRenderData7.setText("缁撹@Conclusion");
+ Style headStyle7 = new Style();
+ headStyle7.setFontFamily("瀹嬩綋");
+ headStyle7.setColor("000000");
+ headRenderData7.setStyle(headStyle7);
+ text.add(headRenderData7);
+ }
+
+ TextRenderData[] text3 = text.toArray(new TextRenderData[0]);
+ rowRenderData = Rows.of(text3).center().rowAtleastHeight(1).create();
+ rows.add(rowRenderData);
+ text = new ArrayList<>();
+
+ // 绾胯姱棰滆壊
+ if (CollectionUtils.isNotEmpty(cableTags)) {
+ TextRenderData cableRenderData1 = new TextRenderData();
+ cableRenderData1.setText("");
+ Style cableStyle1 = new Style();
+ cableStyle1.setFontFamily("瀹嬩綋");
+ cableStyle1.setColor("000000");
+ cableRenderData1.setStyle(cableStyle1);
+ text.add(cableRenderData1);
+
+ TextRenderData cableRenderData2 = new TextRenderData();
+ cableRenderData2.setText("缁濈紭绾胯姱棰滆壊鍜屾爣蹇桜Insulation core color and mark鈭�200");
+ Style cableStyle2 = new Style();
+ cableStyle2.setFontFamily("瀹嬩綋");
+ cableStyle2.setColor("000000");
+ cableRenderData2.setStyle(cableStyle2);
+ text.add(cableRenderData2);
+
+ TextRenderData cableRenderData3 = new TextRenderData();
+ cableRenderData3.setText("缁濈紭绾胯姱棰滆壊鍜屾爣蹇桜Insulation core color and mark鈭�200");
+ Style cableStyle3 = new Style();
+ cableStyle3.setFontFamily("瀹嬩綋");
+ cableStyle3.setColor("000000");
+ cableRenderData3.setStyle(cableStyle3);
+ text.add(cableRenderData3);
+
+ TextRenderData cableRenderData4 = new TextRenderData();
+ cableRenderData4.setText("");
+ Style cableStyle4 = new Style();
+ cableStyle4.setFontFamily("瀹嬩綋");
+ cableStyle4.setColor("000000");
+ cableRenderData4.setStyle(cableStyle4);
+ text.add(cableRenderData4);
+
+ TextRenderData cableRenderData5 = new TextRenderData();
+ cableRenderData5.setText("");
+ Style cableStyle5 = new Style();
+ cableStyle5.setFontFamily("瀹嬩綋");
+ cableStyle5.setColor("000000");
+ cableRenderData5.setStyle(cableStyle5);
+ text.add(cableRenderData5);
+
+ for (String cableTag : cableTags) {
+ TextRenderData cableRenderData6 = new TextRenderData();
+ cableRenderData6.setText(cableTag);
+ Style cableStyle6 = new Style();
+ cableStyle6.setFontFamily("瀹嬩綋");
+ cableStyle6.setColor("000000");
+ cableRenderData6.setStyle(cableStyle6);
+ text.add(cableRenderData6);
+ }
+ if (showResult) {
+ TextRenderData cableRenderData7 = new TextRenderData();
+ cableRenderData7.setText("-");
+ Style cableStyle7 = new Style();
+ cableStyle7.setFontFamily("瀹嬩綋");
+ cableStyle7.setColor("000000");
+ cableRenderData7.setStyle(cableStyle7);
+ text.add(cableRenderData7);
+ }
+
+ TextRenderData[] text4 = text.toArray(new TextRenderData[0]);
+ rowRenderData = Rows.of(text4).center().rowAtleastHeight(1).create();
+ rows.add(rowRenderData);
+ text = new ArrayList<>();
+ }
+
+
+ }
+
+
+ /**
+ * 娣诲姞妫�娴嬪��
+ *
+ * @param a 褰撳墠鏍峰搧
+ * @param text
+ * @param rowRenderData
+ * @param rows
+ * @param max 妫�楠屾暟閲�
+ * @param resultChList 涓嶇鍚堜俊鎭腑鏂�
+ * @param resultEhList 涓嶇鍚堜俊鎭嫳鏂�
+ * @param insSamples
+ * @param cableTags 绾胯姱棰滆壊
+ * @param isOneSample 鍒ゆ柇鏄惁鏄彧鏈変竴涓牱鍝�
+ */
+ private int addTestValue(SampleProductDto a,
+ List<TextRenderData> text,
+ RowRenderData rowRenderData,
+ List<RowRenderData> rows,
+ int max,
+ List<String> resultChList,
+ List<String> resultEhList,
+ InsSample insSamples, List<String> cableTags,
+ boolean isOneSample, boolean showResult) {
+ // 妫�楠岄」鎬绘暟
+ AtomicInteger productSize = new AtomicInteger(1);
+ // 涓嶅悎鏍间俊鎭�
+ AtomicReference<String> resultCh = new AtomicReference<>("");
+ AtomicReference<String> resultEn = new AtomicReference<>("");
+ // 鏌ヨ妫�楠岀粨鏋�
+ List<Integer> ids = new ArrayList<>();
+ ids.add(a.getId());
+ List<SampleProductExportDto> sampleProductDto2s = insOrderMapper.selectSampleBySampleId(ids);
+
+ // 鍒ゆ柇鏄惁鏄搴︽楠�, 涓旀湁娌℃湁杩涘巶妫�楠�, 鏈夎繘鍘傛楠岃繘鍘傛楠岀殑淇℃伅璧嬪�煎埌瀛e害涓�
+ if (insSamples != null) {
+ // 鏌ヨ妫�楠屽唴瀹�
+ List<SampleProductExportDto> enterDto = insOrderMapper.selectSampleBySampleIdOne(insSamples.getId());
+ // 鎺掗櫎鎺夎繘鍘傛姤鍛婇噸澶嶇殑
+ enterDto = enterDto.stream().filter(sampleProductDto2 -> {
+ // 鍒ゆ柇妫�楠岄」妫�楠屽瓙椤规槸鍚︿竴鏍�, 涓�鏍峰氨鐩存帴杩斿洖false鎺掗櫎
+ return !sampleProductDto2s.stream().anyMatch(dto -> {
+ String quarter = sampleProductDto2.getInspectionItem() + sampleProductDto2.getInspectionItemSubclass();
+ String enter = dto.getInspectionItem() + dto.getInspectionItemSubclass();
+ return quarter.equals(enter);
+ });
+ }).collect(Collectors.toList());
+ sampleProductDto2s.addAll(enterDto);
+ }
+
+ // 鏍煎紡鍖栦慨鏀规楠岄」
+ this.formatProducts(sampleProductDto2s);
+
+ List<SampleProductExportDto> sampleList = new ArrayList<>();
+
+ // 鑾峰彇妫�楠岄」鍒嗙被鐨�
+ Map<String, List<SampleProductExportDto>> itemClassMap = sampleProductDto2s.stream().filter(sampleProductDto2 -> StringUtils.isNotBlank(sampleProductDto2.getInspectionItemClass()))
+ .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItemClass));
+
+ List<Map.Entry<String, List<SampleProductExportDto>>> itemClassEntries = new ArrayList<>(itemClassMap.entrySet());
+ itemClassEntries.sort((o1, o2) -> {
+ // 鍐嶆瘮杈� sort
+ Integer sort1 = o1.getValue().get(0).getSort();
+ Integer sort2 = o2.getValue().get(0).getSort();
+ sort1 = sort1 == null ? 0 : sort1;
+ sort2 = sort2 == null ? 0 : sort2;
+ return sort1.compareTo(sort2);
+ });
+ // 鍒涘缓涓�涓� LinkedHashMap 鏉ヤ繚鎸佹彃鍏ラ『搴�
+ Map<String, List<SampleProductExportDto>> itemClassList = new LinkedHashMap<>();
+ for (Map.Entry<String, List<SampleProductExportDto>> entry : itemClassEntries) {
+ itemClassList.put(entry.getKey(), entry.getValue());
+ }
+
+ if (CollectionUtils.isNotEmpty(itemClassList)) {
+ AtomicInteger finalIndex = new AtomicInteger(1);
+
+ // 鑾峰彇妫�楠岄」鍒嗙被鐩稿悓鐨�
+ itemClassList.forEach((s, sampleClass) -> {
+ // 娣诲姞妫�楠屽垎绫�
+ SampleProductExportDto classDto = new SampleProductExportDto();
+ // 鍒ゆ柇鏄惁鏈夎嫳鏂囧悕绉�
+ SampleProductExportDto temp = sampleClass.get(0);
+ if (StringUtils.isNotBlank(temp.getInspectionItemClassEN())) {
+ classDto.setInspectionName(temp.getInspectionItemClass() + "@" + temp.getInspectionItemClassEN());
+ } else {
+ classDto.setInspectionName(temp.getInspectionItemClass());
+ }
+ classDto.setIndex(Integer.toString(finalIndex.get()));
+ sampleList.add(classDto);
+
+ // 娣诲姞妫�楠岄」
+ Map<String, List<SampleProductExportDto>> sortedMap = sampleClass.stream()
+ .filter(sampleProductDto2 -> StringUtils.isNotBlank(sampleProductDto2.getInspectionItem()))
+ .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItemRadius));
+
+ List<Map.Entry<String, List<SampleProductExportDto>>> entries = new ArrayList<>(sortedMap.entrySet());
+ entries.sort((o1, o2) -> {
+ // 鍐嶆瘮杈� sort
+ Integer sort1 = o1.getValue().get(0).getSort();
+ Integer sort2 = o2.getValue().get(0).getSort();
+ sort1 = sort1 == null ? 0 : sort1;
+ sort2 = sort2 == null ? 0 : sort2;
+ return sort1.compareTo(sort2);
+ });
+ // 鍒涘缓涓�涓� LinkedHashMap 鏉ヤ繚鎸佹彃鍏ラ『搴�
+ Map<String, List<SampleProductExportDto>> item = new LinkedHashMap<>();
+ for (Map.Entry<String, List<SampleProductExportDto>> entry : entries) {
+ item.put(entry.getKey(), entry.getValue());
+ }
+
+ AtomicInteger belowIndex = new AtomicInteger(1);
+ item.forEach((s2, sampleProductDtoInside) -> {
+ // 娣诲姞妫�楠岄」
+ SampleProductExportDto dto2 = new SampleProductExportDto();
+ // 鍒ゆ柇鏄惁鏈夎嫳鏂囧悕绉�
+ SampleProductExportDto temp2 = sampleProductDtoInside.get(0);
+ if (StringUtils.isNotBlank(temp2.getInspectionItemEn())) {
+ dto2.setInspectionName(temp2.getInspectionItem() + "@" + temp2.getInspectionItemEn());
+ } else {
+ dto2.setInspectionName(temp2.getInspectionItem());
+ }
+ // 鍒ゆ柇鏈夋病鏈夋潯浠跺瓧娈靛~鍏呭埌瑕佹眰
+ if (StringUtils.isNotBlank(temp2.getRadius())) {
+ dto2.setTell("(" + temp2.getRadius() + ")");
+ }
+ // 鍒ゆ柇鏄惁鏈夋楠屽瓙椤�,娌℃湁灏辨妸妫�楠屽弬鏁板~鍏�
+ dto2.setIndex(finalIndex.get() + "." + belowIndex.get());
+ if (StringUtils.isBlank(temp2.getInspectionItemSubclass())) {
+ // 澶勭悊闆嗗悎
+ Map<String, SampleProductExportDto> map = new LinkedHashMap<>();
+ for (SampleProductExportDto productDto2 : sampleProductDtoInside) {
+ String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem();
+ if (map.containsKey(productName)) {
+ // 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
+ map.get(productName)
+ .getLastValueList()
+ .add(productDto2.getLastValue());
+ map.get(productName)
+ .getInsResultList()
+ .add(productDto2.getInsResult());
+ // 娣诲姞棰滆壊瀵瑰簲鐨勫�煎拰缁撴灉
+ if (StringUtils.isNotBlank(productDto2.getCableTag())) {
+ map.get(productName)
+ .getCableTagValueMap()
+ .put(productDto2.getCableTag(), productDto2.getLastValue());
+ map.get(productName)
+ .getCableTagResultMap()
+ .put(productDto2.getCableTag(), productDto2.getInsResult());
+ }
+ // 娣诲姞鏍囧噯瑕佹眰鏉ョ‘瀹氬敮涓�鎬�
+ map.get(productName).getTellSet().add(productDto2.getTell());
+ } else {
+ // 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
+ productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
+ productDto2.getLastValueList().add(productDto2.getLastValue());
+ productDto2.setInsResultList(new ArrayList<>()); // 缁撴灉
+ productDto2.getInsResultList().add(productDto2.getInsResult());
+ productDto2.setTellSet(new LinkedHashSet<>());
+ productDto2.getTellSet().add(productDto2.getTell());// 鏍囧噯瑕佹眰
+
+ // 鍒ゆ柇鏄惁鏈夌嚎鑺鑹�, 娣诲姞棰滆壊瀵瑰簲鐨勫�煎拰缁撴灉
+ productDto2.setCableTagValueMap(new TreeMap<>());
+ productDto2.setCableTagResultMap(new TreeMap<>());
+ if (StringUtils.isNotBlank(productDto2.getCableTag())) {
+ productDto2.getCableTagValueMap().put(productDto2.getCableTag(), productDto2.getLastValue());
+ productDto2.getCableTagResultMap().put(productDto2.getCableTag(), productDto2.getInsResult());
+ }
+
+ map.put(productName, productDto2);
+ }
+ }
+ List<SampleProductExportDto> result = new ArrayList<>(map.values());
+
+
+ //娣诲姞妫�楠岄」
+ SampleProductExportDto temp3 = result.get(0);
+ String itemName = temp3.getInspectionItem();
+ if (StringUtils.isNotBlank(temp3.getRadius())) {
+ itemName = itemName + "(" + temp3.getRadius() + ")";
+ }
+ // 鍒ゆ柇鏈夋病鏈夋潯浠跺瓧娈垫湁闇�瑕佹嫾鎺ュ埌鍚嶇О鍚庨潰
+ if (StringUtils.isNotBlank(temp3.getInspectionItemEn())) {
+ temp3.setInspectionName(itemName + "@" + temp3.getInspectionItemEn());
+ } else {
+ temp3.setInspectionName(itemName);
+ }
+ // 鍒ゆ柇鏈夋病鏈夋潯浠跺瓧娈垫湁闇�瑕佹嫾鎺ュ埌鍚嶇О鍚庨潰
+ // 鍒ゆ柇鏈夋病鏈夋潯浠跺瓧娈靛~鍏呭埌瑕佹眰
+ if (StringUtils.isNotBlank(temp3.getRadius())) {
+ temp3.setTell("(" + temp3.getRadius() + ")");
+ }
+ temp3.setIndex(finalIndex.get() + "." + belowIndex.get());
+ sampleList.add(temp3);
+ } else {
+ sampleList.add(dto2);
+ // 鐜板湪闇�瑕佹牴鎹瓙椤瑰幓閲嶇疮鍔犳楠岀粨鏋�
+ // 澶勭悊闆嗗悎
+ Map<String, SampleProductExportDto> map = new LinkedHashMap<>();
+ for (SampleProductExportDto productDto2 : sampleProductDtoInside) {
+ String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getInspectionItemSubclass();
+ if (map.containsKey(productName)) {
+ // 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
+ map.get(productName)
+ .getLastValueList()
+ .add(productDto2.getLastValue());
+ map.get(productName)
+ .getInsResultList()
+ .add(productDto2.getInsResult());
+ // 娣诲姞棰滆壊瀵瑰簲鐨勫�煎拰缁撴灉
+ if (StringUtils.isNotBlank(productDto2.getCableTag())) {
+ map.get(productName)
+ .getCableTagValueMap()
+ .put(productDto2.getCableTag(), productDto2.getLastValue());
+ map.get(productName)
+ .getCableTagResultMap()
+ .put(productDto2.getCableTag(), productDto2.getInsResult());
+ }
+ // 娣诲姞鏍囧噯瑕佹眰鏉ョ‘瀹氬敮涓�鎬�
+ map.get(productName).getTellSet().add(productDto2.getTell());
+ } else {
+ // 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
+ productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
+ productDto2.getLastValueList().add(productDto2.getLastValue());
+ productDto2.setInsResultList(new ArrayList<>()); // 缁撴灉
+ productDto2.getInsResultList().add(productDto2.getInsResult());
+ productDto2.setTellSet(new LinkedHashSet<>());
+ productDto2.getTellSet().add(productDto2.getTell());// 鏍囧噯瑕佹眰
+
+ // 鍒ゆ柇鏄惁鏈夌嚎鑺鑹�, 娣诲姞棰滆壊瀵瑰簲鐨勫�煎拰缁撴灉
+ productDto2.setCableTagValueMap(new TreeMap<>());
+ productDto2.setCableTagResultMap(new TreeMap<>());
+ if (StringUtils.isNotBlank(productDto2.getCableTag())) {
+ productDto2.getCableTagValueMap().put(productDto2.getCableTag(), productDto2.getLastValue());
+ productDto2.getCableTagResultMap().put(productDto2.getCableTag(), productDto2.getInsResult());
+ }
+
+ map.put(productName, productDto2);
+ }
+ }
+ List<SampleProductExportDto> result = new ArrayList<>(map.values());
+
+ //娣诲姞妫�楠屽瓙椤�
+ for (SampleProductExportDto productDto2 : result) {
+ if (StringUtils.isNotBlank(productDto2.getInspectionItemSubclassEn())) {
+ productDto2.setInspectionName("--" + productDto2.getInspectionItemSubclass() + "@"
+ + "--" + productDto2.getInspectionItemSubclassEn());
+ } else {
+ productDto2.setInspectionName("--" + productDto2.getInspectionItemSubclass());
+ }
+ sampleList.add(productDto2);
+ }
+ }
+ belowIndex.incrementAndGet();
+ productSize.incrementAndGet();
+ });
+ finalIndex.incrementAndGet();
+ });
+ } else {
+ // 杞垚Mpa杩涜鎺掑簭
+ Map<String, List<SampleProductExportDto>> sortedMap = sampleProductDto2s.stream()
+ .filter(sampleProductDto2 -> StringUtils.isNotBlank(sampleProductDto2.getInspectionItem()))
+ .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItemRadius));
+ List<Map.Entry<String, List<SampleProductExportDto>>> entries = new ArrayList<>(sortedMap.entrySet());
+ entries.sort((o1, o2) -> {
+ Integer sort1 = o1.getValue().get(0).getSort();
+ Integer sort2 = o2.getValue().get(0).getSort();
+ sort1 = sort1 == null ? 0 : sort1;
+ sort2 = sort2 == null ? 0 : sort2;
+ return sort1.compareTo(sort2);
+ });
+ // 鍒涘缓涓�涓� LinkedHashMap 鏉ヤ繚鎸佹彃鍏ラ『搴�
+ Map<String, List<SampleProductExportDto>> item = new LinkedHashMap<>();
+ for (Map.Entry<String, List<SampleProductExportDto>> entry : entries) {
+ item.put(entry.getKey(), entry.getValue());
+ }
+
+ AtomicInteger finalIndex = new AtomicInteger(1);
+ item.forEach((s, sampleProductDtoInside) -> {
+ // 娣诲姞妫�楠岄」
+ SampleProductExportDto dto2 = new SampleProductExportDto();
+ // 鍒ゆ柇鏄惁鏈夎嫳鏂囧悕绉�
+ SampleProductExportDto temp = sampleProductDtoInside.get(0);
+
+ // 鍒ゆ柇鏄惁鏈夋楠屽瓙椤�,娌℃湁灏辨妸妫�楠屽弬鏁板~鍏�
+ dto2.setIndex(Integer.toString(finalIndex.get()));
+ if (StringUtils.isBlank(temp.getInspectionItemSubclass())) {
+ // 澶勭悊闆嗗悎
+ Map<String, SampleProductExportDto> map = new LinkedHashMap<>();
+ for (SampleProductExportDto productDto2 : sampleProductDtoInside) {
+ String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem();
+ if (map.containsKey(productName)) {
+ // 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
+ map.get(productName)
+ .getLastValueList()
+ .add(productDto2.getLastValue());
+ map.get(productName)
+ .getInsResultList()
+ .add(productDto2.getInsResult());
+ // 娣诲姞棰滆壊瀵瑰簲鐨勫�煎拰缁撴灉
+ if (StringUtils.isNotBlank(productDto2.getCableTag())) {
+ map.get(productName)
+ .getCableTagValueMap()
+ .put(productDto2.getCableTag(), productDto2.getLastValue());
+ map.get(productName)
+ .getCableTagResultMap()
+ .put(productDto2.getCableTag(), productDto2.getInsResult());
+ }
+ // 娣诲姞鏍囧噯瑕佹眰鏉ョ‘瀹氬敮涓�鎬�
+ map.get(productName).getTellSet().add(productDto2.getTell());
+ } else {
+ // 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
+ productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
+ productDto2.getLastValueList().add(productDto2.getLastValue());
+ productDto2.setInsResultList(new ArrayList<>()); // 缁撴灉
+ productDto2.getInsResultList().add(productDto2.getInsResult());
+ productDto2.setTellSet(new LinkedHashSet<>());
+ productDto2.getTellSet().add(productDto2.getTell());// 鏍囧噯瑕佹眰
+
+ // 鍒ゆ柇鏄惁鏈夌嚎鑺鑹�, 娣诲姞棰滆壊瀵瑰簲鐨勫�煎拰缁撴灉
+ productDto2.setCableTagValueMap(new TreeMap<>());
+ productDto2.setCableTagResultMap(new TreeMap<>());
+ if (StringUtils.isNotBlank(productDto2.getCableTag())) {
+ productDto2.getCableTagValueMap().put(productDto2.getCableTag(), productDto2.getLastValue());
+ productDto2.getCableTagResultMap().put(productDto2.getCableTag(), productDto2.getInsResult());
+ }
+
+ map.put(productName, productDto2);
+ }
+ }
+ List<SampleProductExportDto> result = new ArrayList<>(map.values());
+
+ //娣诲姞妫�楠屽瓙椤�
+ SampleProductExportDto temp2 = result.get(0);
+ String itemName = temp2.getInspectionItem();
+ if (StringUtils.isNotBlank(temp2.getRadius())) {
+ itemName = itemName + "(" + temp2.getRadius() + ")";
+ }
+ // 鍒ゆ柇鏈夋病鏈夋潯浠跺瓧娈垫湁闇�瑕佹嫾鎺ュ埌鍚嶇О鍚庨潰
+ if (StringUtils.isNotBlank(temp2.getInspectionItemEn())) {
+ temp2.setInspectionName(itemName + "@" + temp2.getInspectionItemEn());
+ } else {
+ temp2.setInspectionName(itemName);
+ }
+ // 鍒ゆ柇鏈夋病鏈夋潯浠跺瓧娈垫湁闇�瑕佹嫾鎺ュ埌鍚嶇О鍚庨潰
+ temp2.setIndex(Integer.toString(finalIndex.get()));
+ sampleList.add(temp2);
+ } else {
+ if (StringUtils.isNotBlank(temp.getInspectionItemEn())) {
+ dto2.setInspectionName(temp.getInspectionItem() + "@" + temp.getInspectionItemEn());
+ } else {
+ dto2.setInspectionName(temp.getInspectionItem());
+ }
+ // 濉厖鍒拌姹�
+ if (StringUtils.isNotBlank(temp.getRadius())) {
+ dto2.setTell("(" + temp.getRadius() + ")");
+ }
+ sampleList.add(dto2);
+
+ // 鐜板湪闇�瑕佹牴鎹瓙椤瑰幓閲嶇疮鍔犳楠岀粨鏋�
+ // 澶勭悊闆嗗悎
+ Map<String, SampleProductExportDto> map = new LinkedHashMap<>();
+ for (SampleProductExportDto productDto2 : sampleProductDtoInside) {
+ // 鍚嶅瓧鍙栦笁灞傚敮涓�
+ String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getInspectionItemSubclass();
+ if (map.containsKey(productName)) {
+ // 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
+ map.get(productName)
+ .getLastValueList()
+ .add(productDto2.getLastValue());
+ map.get(productName)
+ .getInsResultList()
+ .add(productDto2.getInsResult());
+ // 娣诲姞棰滆壊瀵瑰簲鐨勫�煎拰缁撴灉
+ if (StringUtils.isNotBlank(productDto2.getCableTag())) {
+ map.get(productName)
+ .getCableTagValueMap()
+ .put(productDto2.getCableTag(), productDto2.getLastValue());
+ map.get(productName)
+ .getCableTagResultMap()
+ .put(productDto2.getCableTag(), productDto2.getInsResult());
+ }
+ // 娣诲姞鏍囧噯瑕佹眰鏉ョ‘瀹氬敮涓�鎬�
+ map.get(productName).getTellSet().add(productDto2.getTell());
+ } else {
+ // 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
+ productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
+ productDto2.getLastValueList().add(productDto2.getLastValue());
+ productDto2.setInsResultList(new ArrayList<>()); // 缁撴灉
+ productDto2.getInsResultList().add(productDto2.getInsResult());
+ productDto2.setTellSet(new LinkedHashSet<>());
+ productDto2.getTellSet().add(productDto2.getTell());// 鏍囧噯瑕佹眰
+ productDto2.setCableTagValueMap(new TreeMap<>());
+ // 鍒ゆ柇鏄惁鏈夌嚎鑺鑹�, 娣诲姞棰滆壊瀵瑰簲鐨勫�煎拰缁撴灉
+ productDto2.setCableTagValueMap(new TreeMap<>());
+ productDto2.setCableTagResultMap(new TreeMap<>());
+ if (StringUtils.isNotBlank(productDto2.getCableTag())) {
+ productDto2.getCableTagValueMap().put(productDto2.getCableTag(), productDto2.getLastValue());
+ productDto2.getCableTagResultMap().put(productDto2.getCableTag(), productDto2.getInsResult());
+ }
+ map.put(productName, productDto2);
+ }
+ }
+ List<SampleProductExportDto> result = new ArrayList<>(map.values());
+
+ //娣诲姞妫�楠屽瓙椤�
+ for (SampleProductExportDto productDto2 : result) {
+ if (StringUtils.isNotBlank(productDto2.getInspectionItemSubclassEn())) {
+ productDto2.setInspectionName("--" + productDto2.getInspectionItemSubclass() + "@"
+ + "--" + productDto2.getInspectionItemSubclassEn());
+ } else {
+ productDto2.setInspectionName("--" + productDto2.getInspectionItemSubclass());
+ }
+ sampleList.add(productDto2);
+ }
+ }
+ finalIndex.incrementAndGet();
+ });
+ productSize.set(finalIndex.get());
+ }
+
+ if (CollectionUtils.isEmpty(sampleList)) {
+ return productSize.get() - 1;
+ }
+
+ /* 妫�楠岄」map, 濡傛灉涓嶅悎鏍煎垽鏂槸鍚︽湁澶х被鍜屾楠岄」, 鏈夊ぇ绫讳笉闇�瑕侀噸鍙�, 濡�(缁濈紭鏈烘鐗╃悊鎬ц兘鑰佸寲鍓嶆柇瑁備几闀跨巼銆佺粷缂樻満姊扮墿鐞嗘�ц兘鑰佸寲鍓嶆姉寮犲己搴�)
+ * 闇�瑕佷慨鏀规垚缁濈紭鏈烘鐗╃悊鎬ц兘鑰佸寲鍓嶆柇瑁備几闀跨巼銆佹姉寮犲己搴�
+ * */
+ // 妫�楠岄」鍒嗙被 妫�楠岄」 妫�楠屽瓙椤�
+ Map<String, LinkedHashMap<String, List<String>>> errorClassItemMapCn = new LinkedHashMap<>();
+ Map<String, LinkedHashMap<String, List<String>>> errorClassItemMapEn = new LinkedHashMap<>();
+ // 涓棿妫�娴嬪�兼坊鍔�
+ for (int i = 0; i < sampleList.size(); i++) {
+ SampleProductExportDto sample = sampleList.get(i);
+
+ String fixedValue = "(100鈩冿紝168h)";
+ // 鍒ゆ柇鏄惁鏄� 鎷変几寮哄害鍙樺寲鐜�(100鈩冿紝168h) 鍜� 鏂鎷変几搴斿彉鍙樺寲鐜�(100鈩冿紝168h) 闇�瑕佸幓闄ゆ潯浠�
+ if (StrUtil.isNotBlank(sample.getInspectionName())
+ && sample.getInspectionName().contains("鏂鎷変几搴斿彉鍙樺寲鐜�(100鈩冿紝168h)")) {
+ sample.setInspectionName(sample.getInspectionName().replace(fixedValue, ""));
+ }
+ if (StrUtil.isNotBlank(sample.getInspectionName())
+ && sample.getInspectionName().contains("鎷変几寮哄害鍙樺寲鐜�(100鈩冿紝168h)")) {
+ sample.setInspectionName(sample.getInspectionName().replace(fixedValue, ""));
+ }
+ if (StrUtil.isNotBlank(sample.getInspectionName())
+ && sample.getInspectionName().contains("鑰佸寲鍚庢満姊版�ц兘(100鈩冿紝168h)")) {
+ sample.setInspectionName(sample.getInspectionName().replace(fixedValue, ""));
+ }
+
+ // 鍒ゆ柇鏄惁鏄� 鑰愮熆鐗╂补鈪狅紙150鈩� 72h) 鍜� 鑰愮熆鐗╂补鈪狅紙150鈩� 144h) 闇�瑕佸幓闄ゆ潯浠�
+ if (StrUtil.isNotBlank(sample.getInspectionName())
+ && sample.getInspectionName().contains("鑰愮熆鐗╂补鈪狅紙150鈩� 72h)")) {
+ sample.setInspectionName(sample.getInspectionName().replace("锛�150鈩� 72h)", ""));
+ }
+ if (StrUtil.isNotBlank(sample.getInspectionName())
+ && sample.getInspectionName().contains("鑰愮熆鐗╂补鈪狅紙150鈩� 144h)")) {
+ sample.setInspectionName(sample.getInspectionName().replace("锛�150鈩� 144h)", ""));
+ }
+
+ // 搴忓彿
+ TextRenderData headRenderData1 = new TextRenderData();
+ headRenderData1.setText(sample.getIndex());
+ Style headStyle1 = new Style();
+ headStyle1.setFontFamily("瀹嬩綋");
+ headStyle1.setColor("000000");
+ headRenderData1.setStyle(headStyle1);
+ text.add(headRenderData1);
+
+ // 妫�楠岄」鐩�
+ TextRenderData headRenderData2 = new TextRenderData();
+ headRenderData2.setText(sample.getInspectionName() + "鈭�" + (i + 999));
+ Style headStyle2 = new Style();
+ headStyle2.setFontFamily("瀹嬩綋");
+ headStyle2.setColor("000000");
+ headRenderData2.setStyle(headStyle2);
+ text.add(headRenderData2);
+
+ // 妫�楠岄」鐩�
+ TextRenderData headRenderData3 = new TextRenderData();
+ headRenderData3.setText(sample.getInspectionName() + "鈭�" + (i + 999));
+ Style headStyle3 = new Style();
+ headStyle3.setFontFamily("瀹嬩綋");
+ headStyle3.setColor("000000");
+ headRenderData3.setStyle(headStyle3);
+ text.add(headRenderData3);
+
+ // 鍗曚綅
+ TextRenderData headRenderData4 = new TextRenderData();
+ headRenderData4.setText(sample.getUnit());
+ Style headStyle4 = new Style();
+ headStyle4.setFontFamily("瀹嬩綋");
+ headStyle4.setColor("000000");
+ headRenderData4.setStyle(headStyle4);
+ text.add(headRenderData4);
+
+ //鏍囧噯瑕佹眰
+ String tell = sample.getTell();
+ if (CollectionUtils.isNotEmpty(sample.getTellSet())) {
+ tell = CollUtil.join(sample.getTellSet(), "/");
+ }
+ TextRenderData headRenderData5 = new TextRenderData();
+ headRenderData5.setText(tell);
+ Style headStyle5 = new Style();
+ headStyle5.setFontFamily("瀹嬩綋");
+ headStyle5.setColor("000000");
+ headRenderData5.setStyle(headStyle5);
+ text.add(headRenderData5);
+
+ // 鍒ゆ柇鏄惁鏈夌數缂嗘爣璇唌ap
+ if (CollectionUtils.isNotEmpty(sample.getCableTagValueMap())) {
+ TreeMap<String, String> cableTagValues = new TreeMap<>(Comparator.comparingInt(cableTags::indexOf));
+ cableTagValues.putAll(sample.getCableTagValueMap());
+ sample.setLastValueList(new ArrayList<>(cableTagValues.values()));
+ }
+ if (CollectionUtils.isNotEmpty(sample.getCableTagResultMap())) {
+ sample.setInsResultList(new ArrayList<>(sample.getCableTagResultMap().values()));
+ }
+
+ // 妫�楠岀粨鏋�
+ // 鍒ゆ柇鏄惁鏄娆℃楠�
+ if (CollectionUtils.isNotEmpty(sample.getLastValueList())
+ && sample.getLastValueList().size() == max) {
+
+ for (String s : sample.getLastValueList()) {
+ TextRenderData headRenderData6 = new TextRenderData();
+ headRenderData6.setText(s);
+ Style headStyle6 = new Style();
+ headStyle6.setFontFamily("瀹嬩綋");
+ headStyle6.setColor("000000");
+ headRenderData6.setStyle(headStyle6);
+ text.add(headRenderData6);
+ }
+ } else {
+ for (int j = 0; j < max; j++) {
+ TextRenderData headRenderData6 = new TextRenderData();
+ headRenderData6.setText((StringUtils.isNotEmpty(sample.getLastValue()) ?
+ sample.getLastValue() : "")
+ + "鈭�" + (7 + i));
+ Style headStyle6 = new Style();
+ headStyle6.setFontFamily("瀹嬩綋");
+ headStyle6.setColor("000000");
+ headRenderData6.setStyle(headStyle6);
+ text.add(headRenderData6);
+ }
+ }
+ // 鍒ゅ畾缁撴灉
+ if (showResult) {
+ String result = "";
+ if (sample.getInsResult() != null) {
+ switch (sample.getInsResult()) {
+ case 1:
+ result = "鈭�";
+ break;
+ case 2:
+ result = "脳";
+ break;
+ case 3:
+ result = "-";
+ break;
+ }
+ }
+ if (CollectionUtils.isNotEmpty(sample.getLastValueList())) {
+ // 鍒ゆ柇鏄惁鏈変竴涓敊璇�
+ if (sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 3))) {
+ result = "-";
+ } else {
+ boolean error = sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 0));
+ if (error) {
+ List<String> collect = new ArrayList<>();
+ int index = 0;
+ for (Integer count : sample.getInsResultList()) {
+ String type;
+ if (Objects.equals(count, 0)) {
+ String itemCh = "";
+ String itemEn = "";
+ // 娣诲姞涓嶅悎鏍兼弿杩�
+ // 鍒ゆ柇闀垮害鏄惁涓�1
+ if (sample.getLastValueList().size() == 1) {
+ this.fillReportErrorResult(errorClassItemMapCn, errorClassItemMapEn, sample, itemCh, itemEn);
+ } else if (CollectionUtils.isNotEmpty(cableTags)) {
+ // 鍒ゆ柇鏄惁鏈夌數缂嗛厤缃�, 涓嶆槸鐨勮瘽鍙兘涓哄師鏉愭枡
+ // 娣诲姞涓嶅悎鏍兼弿杩�
+ itemCh = (max == 1 ? "" : cableTags.get(index));
+ itemEn = (max == 1 ? "" : "The " + Integer.toString(index + 1) + " time ");
+ this.fillReportErrorResult(errorClassItemMapCn, errorClassItemMapEn, sample, itemCh, itemEn);
+ } else {
+ // 娣诲姞涓嶅悎鏍兼弿杩�
+ itemCh = (max == 1 ? "" : "绗�" + Integer.toString(index + 1) + "娆�");
+ itemEn = (max == 1 ? "" : "The " + Integer.toString(index + 1) + " time ");
+ this.fillReportErrorResult(errorClassItemMapCn, errorClassItemMapEn, sample, itemCh, itemEn);
+ }
+ type = "脳";
+ } else {
+ type = "鈭�";
+ }
+ collect.add(type);
+ index++;
+ }
+ result = CollUtil.join(collect, " ");
+ ;
+ } else {
+ result = "鈭�";
+ }
+ }
+ }
+
+ if (showResult) {
+ TextRenderData headRenderData7 = new TextRenderData();
+ headRenderData7.setText(result);
+ Style headStyle7 = new Style();
+ headStyle7.setFontFamily("瀹嬩綋");
+ headStyle7.setColor("000000");
+ headRenderData7.setStyle(headStyle7);
+ text.add(headRenderData7);
+ }
+ }
+
+ TextRenderData[] text2 = text.toArray(new TextRenderData[0]);
+ rowRenderData = Rows.of(text2).center().rowAtleastHeight(1).create();
+ rows.add(rowRenderData);
+ text = new ArrayList<>();
+
+ }
+ if (CollectionUtils.isNotEmpty(errorClassItemMapCn)) {
+ // 寰幆妫�楠岄」鍒嗙被
+ errorClassItemMapCn.forEach((errorClass, errorItemMap) -> {
+ if (StringUtils.isNotBlank(resultCh.get())) {
+ resultCh.set(resultCh.get() + "锛�" + errorClass);
+ } else {
+ resultCh.set(errorClass);
+ }
+ // 寰幆妫�楠岄」
+ AtomicBoolean flag = new AtomicBoolean(false);
+ errorItemMap.forEach((errorItem, errorSubClassList) -> {
+ if (flag.get()) {
+ resultCh.set(resultCh.get() + "锛�" + errorItem);
+ } else {
+ resultCh.set(resultCh.get() + errorItem);
+ }
+ flag.set(true);
+ // 寰幆妫�楠岄」鍒嗙被
+ if (CollectionUtils.isNotEmpty(errorSubClassList)) {
+ for (int i = 0; i < errorSubClassList.size(); i++) {
+ // 鍒ゆ柇鏄惁鏄浜屼釜, 绗簩涓坊鍔犻】鍙�
+ if (i > 0) {
+ resultCh.set(resultCh.get() + "銆�" + errorSubClassList.get(i));
+ } else {
+ resultCh.set(resultCh.get() + errorSubClassList.get(i));
+ }
+ }
+ }
+ });
+ });
+ // 寰幆妫�楠岄」鍒嗙被
+ errorClassItemMapEn.forEach((errorClass, errorItemMap) -> {
+ if (StringUtils.isNotBlank(resultEn.get())) {
+ resultEn.set(resultEn.get() + "锛�" + errorClass);
+ } else {
+ resultEn.set(errorClass);
+ }
+ // 寰幆妫�楠岄」
+ errorItemMap.forEach((errorItem, errorSubClassList) -> {
+ resultEn.set(resultEn.get() + errorItem);
+ // 寰幆妫�楠岄」鍒嗙被
+ if (CollectionUtils.isNotEmpty(errorSubClassList)) {
+ for (int i = 0; i < errorSubClassList.size(); i++) {
+ // 鍒ゆ柇鏄惁鏄浜屼釜, 绗簩涓坊鍔犻】鍙�
+ if (i > 0) {
+ resultEn.set(resultEn.get() + "銆�" + errorSubClassList.get(i));
+ } else {
+ resultEn.set(resultEn.get() + errorSubClassList.get(i));
+ }
+ }
+ }
+ });
+ });
+ }
+
+ if (StringUtils.isNotBlank(resultCh.get())) {
+ String resultChString = resultCh.get();
+ String resultEnString = resultEn.get();
+ // 鍒ゆ柇鏍峰搧鏄惁鏈夊涓�, 鏈夊涓渶瑕佹嫾鎺ユ牱鍝佺紪鍙�
+ if (!isOneSample) {
+ resultChString = a.getSampleCode() + resultChString;
+ resultEnString = a.getSampleCode() + resultEnString;
+ }
+ resultChList.add(resultChString);
+ resultEhList.add(resultEnString);
+ }
+
+
+ return productSize.get() - 1;
+ }
+
+ /**
+ * NBSP锛堥潪闂存柇绌烘牸锛� 杞垚 鏅�氱┖鏍�
+ *
+ * @param oldStr
+ * @return
+ */
+ private String normalizedSpaces(String oldStr) {
+ if (StringUtils.isBlank(oldStr)) {
+ return oldStr;
+ }
+ return oldStr.replaceAll("\u00A0", " ").trim();
+ }
+
+ /**
+ * 娣诲姞鎶ュ憡缁撹涓嫳鏂�
+ *
+ * @param sample
+ * @param itemCh
+ * @param itemEn
+ */
+ private void fillReportErrorResult(Map<String, LinkedHashMap<String, List<String>>> errorClassItemMapCn,
+ Map<String, LinkedHashMap<String, List<String>>> errorClassItemMapEn,
+ SampleProductExportDto sample,
+ String itemCh,
+ String itemEn) {
+ // 鍒ゆ柇鏄惁鏈夋楠岄」鍒嗙被map
+ String classTiemName = itemCh + (StringUtils.isBlank(sample.getInspectionItemClass()) ? "" : normalizedSpaces(sample.getInspectionItemClass()));
+ String classTiemNameEn = itemEn + (StringUtils.isBlank(sample.getInspectionItemClassEN()) ? "" : normalizedSpaces(sample.getInspectionItemClassEN()));
+ String classTiemNameItemEN = StringUtils.isBlank(sample.getInspectionItemEn()) ? "" : normalizedSpaces(sample.getInspectionItemEn());
+
+ if (errorClassItemMapCn.containsKey(classTiemName)) {
+ // 鍒ゆ柇鏄惁鏈夋楠岄」map
+ if (errorClassItemMapCn.get(classTiemName).containsKey(sample.getInspectionItem())) {
+ // 娣诲姞妫�楠岄」鍒嗙被
+ if (StringUtils.isNotBlank(sample.getInspectionItemSubclass())) {
+ errorClassItemMapCn.get(classTiemName).get(sample.getInspectionItem()).add(sample.getInspectionItemSubclass());
+ }
+ if (StringUtils.isNotBlank(sample.getInspectionItemSubclassEn())) {
+ errorClassItemMapEn.get(classTiemNameEn).get(classTiemNameItemEN).add(sample.getInspectionItemSubclassEn());
+ }
+ } else {
+ // 娣诲姞妫�楠岄」map
+ List<String> errorItemSubClassList = new ArrayList<>();
+ if (StringUtils.isNotBlank(sample.getInspectionItemSubclass())) {
+ errorItemSubClassList.add(sample.getInspectionItemSubclass());
+ }
+ List<String> errorItemSubClassListEn = new ArrayList<>();
+ if (StringUtils.isNotBlank(sample.getInspectionItemSubclassEn())) {
+ errorItemSubClassListEn.add(sample.getInspectionItemSubclassEn());
+ }
+ errorClassItemMapCn.get(classTiemName).put(sample.getInspectionItem(), errorItemSubClassList);
+ errorClassItemMapEn.get(classTiemNameEn).put(classTiemNameItemEN, errorItemSubClassListEn);
+ }
+ } else {
+ // map娣诲姞妫�楠岄」鍒嗙被
+ List<String> errorItemSubClassList = new ArrayList<>();
+ if (StringUtils.isNotBlank(sample.getInspectionItemSubclass())) {
+ errorItemSubClassList.add(sample.getInspectionItemSubclass());
+ }
+ List<String> errorItemSubClassListEn = new ArrayList<>();
+ if (StringUtils.isNotBlank(sample.getInspectionItemSubclassEn())) {
+ errorItemSubClassListEn.add(sample.getInspectionItemSubclassEn());
+ }
+ errorClassItemMapCn.put(classTiemName, new LinkedHashMap<String, List<String>>() {{
+ put(sample.getInspectionItem(), errorItemSubClassList);
+ }});
+ errorClassItemMapEn.put(classTiemNameEn, new LinkedHashMap<String, List<String>>() {{
+ put(classTiemNameItemEN, errorItemSubClassListEn);
+ }});
+ }
+ }
+
+
+ /**
+ * 鏍煎紡鍖栦慨鏀规楠岄」
+ *
+ * @param sampleProductDto2s
+ */
+ private void formatProducts(List<SampleProductExportDto> sampleProductDto2s) {
+ sampleProductDto2s.forEach(sampleProductDto2 -> {
+ // 娓呴櫎鍏ㄩ儴缁撴灉鐨勫墠鍚庣┖鏍�, 鎹㈣绗�
+ if (StrUtil.isNotBlank(sampleProductDto2.getLastValue())) {
+ sampleProductDto2.setLastValue(sampleProductDto2.getLastValue().trim());
+ }
+
+ if (Objects.equals(sampleProductDto2.getInsResult(), 0)) {
+ // 鏌ヨ涓嶅悎鏍煎娴�
+ Long count = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery()
+ .eq(InsUnqualifiedRetestProduct::getInsProductId, sampleProductDto2.getInsProductId())
+ .ne(InsUnqualifiedRetestProduct::getInsResult, 0));
+ if (count == 2) {
+ // 澶嶆祴鍐呭閮藉悎鏍煎氨鍙栫涓�涓粨鏋�
+ InsUnqualifiedRetestProduct retestProduct = insUnqualifiedRetestProductMapper.selectOne(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery()
+ .eq(InsUnqualifiedRetestProduct::getInsProductId, sampleProductDto2.getInsProductId())
+ .last("limit 1"));
+ sampleProductDto2.setLastValue(retestProduct.getLastValue());
+ sampleProductDto2.setInsResult(retestProduct.getInsResult());
+ }
+ }
+ // 鍒ゆ柇鏄惁鏄暟瀛楃被鍨�
+ if ("1".equals(sampleProductDto2.getInspectionValueType())) {
+ // 鎶婃楠屽唴瀹瑰鏋滄纭寲鐐瑰拰鐒︾儳鏃堕棿鎶� . 鍒囧壊鎴� :
+ String lastValue = sampleProductDto2.getLastValue();
+ if (sampleProductDto2.getInspectionItem().contains("姝g~鍖栫偣") || sampleProductDto2.getInspectionItem().contains("鐒︾儳鏃堕棿")) {
+ sampleProductDto2.setLastValue(sampleProductDto2.getLastValue().replace('.', ':'));
+ } else {
+ // 鍒ゆ柇褰撳墠缁撴灉鏄惁鏄瀛﹁鏁版硶
+ boolean scientificNotation = isScientificNotation(lastValue);
+ if (scientificNotation) {
+ // 淇敼瑕佹眰鎻忚堪
+ sampleProductDto2.setTell(convertToScientificNotation(sampleProductDto2.getTell()));
+
+ // 淇敼瑕佹眰鍊�
+ sampleProductDto2.setLastValue(toScientificNotationWithTimes(lastValue));
+ } else {
+ // 鎺掗櫎姘ф寚鏁�
+ if (sampleProductDto2.getInspectionItem().contains("姘ф寚鏁�")) {
+
+ // 鐗规畩澶勭悊鍒ゆ柇妫�楠岄」鏄惁绛変簬澶栨姢濂楃數瀵肩巼, 鏄殑璇濆彧闇�瑕佷繚鐣欎竴浣嶅皬鏁�
+ } else if (StringUtils.isNotBlank(sampleProductDto2.getInspectionItemSubclass())
+ && sampleProductDto2.getInspectionItemSubclass().contains("澶栨姢濂楃數瀵肩巼")) {
+ BigDecimal bd = new BigDecimal(lastValue);
+ bd = bd.setScale(1, RoundingMode.HALF_UP);
+ sampleProductDto2.setLastValue(bd.stripTrailingZeros().toPlainString());
+ } else {
+ // 淇敼灏忔暟鐐逛綅鏁版牴鎹姹傚�兼潵
+ sampleProductDto2.setLastValue(modifyNumber(sampleProductDto2.getAsk(), lastValue));
+ }
+ }
+ }
+ }
+ // 鍒ゆ柇鏄惁鏄� 鎷変几寮哄害鍙樺寲鐜�(100鈩冿紝168h) 鍜� 鏂鎷変几搴斿彉鍙樺寲鐜�(100鈩冿紝168h) 闇�瑕佸幓闄ゆ潯浠�
+ if (StrUtil.isNotBlank(sampleProductDto2.getInspectionItemSubclass())
+ && sampleProductDto2.getInspectionItemSubclass().equals("鎷変几寮哄害鍙樺寲鐜�(100鈩冿紝168h)")) {
+ sampleProductDto2.setInspectionItem("鑰佸寲鍚庢満姊版�ц兘(100鈩冿紝168h)");
+ }
+ if (StrUtil.isNotBlank(sampleProductDto2.getInspectionItemSubclass())
+ && sampleProductDto2.getInspectionItemSubclass().equals("鏂鎷変几搴斿彉鍙樺寲鐜�(100鈩冿紝168h)")) {
+ sampleProductDto2.setInspectionItem("鑰佸寲鍚庢満姊版�ц兘(100鈩冿紝168h)");
+ }
+ });
+ }
+
+ /**
+ * 娣诲姞缁撳熬
+ *
+ * @param text
+ * @param rowRenderData
+ * @param rows
+ */
+ private static void addEnding(List<TextRenderData> text, RowRenderData rowRenderData, List<RowRenderData> rows, int max, boolean showResult) {
+ for (int i = 0; i < 2; i++) {
+ TextRenderData endingRenderData = new TextRenderData();
+ endingRenderData.setText("澶囨敞鈭�1999");
+ Style endingStyle = new Style();
+ endingStyle.setFontFamily("瀹嬩綋");
+ endingStyle.setColor("000000");
+ endingRenderData.setStyle(endingStyle);
+ text.add(endingRenderData);
+ }
+
+ for (int i = 0; i < (showResult ? 5 : 4) + max - 1; i++) {
+ TextRenderData endingRenderData = new TextRenderData();
+ endingRenderData.setText(showResult ? "鈥溾垰鈥濊〃绀洪」鐩悎鏍�,鈥溍椻�濊〃绀洪」鐩笉鍚堟牸,鈥�-鈥濊〃绀轰笉瑕佸垽瀹氾紝鈥�/鈥濊〃绀烘病鏈夋爣鍑嗚姹傘�侤鈥溾垰鈥� indicates test ltem is qualified,鈥溍椻�� indicates test ltem is unqualified,鈥�-鈥� indicates test ltem judgment is not required,鈥�/鈥� indicates test ltem is no test requirement.鈭�2000" : "");
+ Style endingStyle = new Style();
+ endingStyle.setFontFamily("瀹嬩綋");
+ endingStyle.setColor("000000");
+ endingRenderData.setStyle(endingStyle);
+ text.add(endingRenderData);
+ }
+ TextRenderData[] text3 = text.toArray(new TextRenderData[0]);
+ rowRenderData = Rows.of(text3).center().rowAtleastHeight(1).create();
+ rows.add(rowRenderData);
+ }
+
+ /**
+ * 鍒ゆ柇褰撳墠鍐呭鏄惁鏄瀛﹁鏁版硶
+ *
+ * @param str
+ * @return
+ */
+ public static boolean isScientificNotation(String str) {
+ if (StringUtils.isEmpty(str)) {
+ return false;
+ }
+ // 姝e垯琛ㄨ揪寮忓尮閰嶇瀛﹁鏁版硶锛屽寘鎷鏁板拰璐熸暟
+ String regex = "^[+|-]?\\d*[.]?\\d*e[+|-]?\\d+$";
+ Pattern pattern = Pattern.compile(regex);
+ return pattern.matcher(str).matches();
+ }
+
+
+ /**
+ * 淇敼瑕佹眰鎻忚堪鐨勭瀛﹁鏁版硶
+ *
+ * @param input
+ */
+ public static String convertToScientificNotation(String input) {
+ // 淇濆瓨鍘熷杈撳叆
+ String originalInput = input;
+
+ // 鍘绘帀闈炵瀛﹁鏁版硶鐨勫瓧绗�
+ String cleanedInput = input.replaceAll("[^0-9eE+-.]", "");
+
+ // 鍒ゆ柇瑕佹眰鎻忚堪鏄惁鏄瀛﹁鏁版硶
+ boolean scientificNotation = isScientificNotation(cleanedInput);
+ if (!scientificNotation) {
+ return input;
+ }
+
+ // 鎵惧嚭琚幓鎺夌殑瀛楃
+ String removedChars = originalInput.replace(cleanedInput, "");
+
+ try {
+ String scientificNotationWithTimes = toScientificNotationWithTimes(cleanedInput);
+ return removedChars + scientificNotationWithTimes;
+ } catch (Exception e) {
+ return input;
+ }
+
+ }
+
+ /**
+ * 灞曠ず鎴愮瀛﹁鏁版硶
+ *
+ * @param number
+ * @return
+ */
+ public static String toScientificNotationWithTimes(String number) {
+ Double value = Double.valueOf(number);
+
+ // 鎻愬彇灏忔暟閮ㄥ垎鍜屾寚鏁伴儴鍒�
+ String scientificFormat = String.format("%.1e", value);
+ String[] parts = scientificFormat.split("e");
+
+ // 澶勭悊鏁板瓧閮ㄥ垎鍜屾寚鏁伴儴鍒�
+ String mantissa = parts[0]; // 灏忔暟閮ㄥ垎
+ int exponent = Integer.parseInt(parts[1]); // 鎸囨暟閮ㄥ垎
+
+ String power = "";
+ switch (exponent) {
+ case 2:
+ power = "虏";
+ break;
+ case 3:
+ power = "鲁";
+ break;
+ case 4:
+ power = "鈦�";
+ break;
+ case 5:
+ power = "鈦�";
+ break;
+ case 6:
+ power = "鈦�";
+ break;
+ case 7:
+ power = "鈦�";
+ break;
+ case 8:
+ power = "鈦�";
+ break;
+ case 9:
+ power = "鈦�";
+ break;
+ case 10:
+ power = "鹿鈦�";
+ break;
+ case 11:
+ power = "鹿鹿";
+ break;
+ case 12:
+ power = "鹿虏";
+ break;
+ case 13:
+ power = "鹿鲁";
+ break;
+ case 14:
+ power = "鹿鈦�";
+ break;
+ case 15:
+ power = "鹿鈦�";
+ break;
+ case 16:
+ power = "鹿鈦�";
+ break;
+ case 17:
+ power = "鹿鈦�";
+ break;
+ case 18:
+ power = "鹿鈦�";
+ break;
+ case 19:
+ power = "鹿鈦�";
+ break;
+ case 20:
+ power = "虏鈦�";
+ break;
+
+ }
+
+ // 鏋勫缓鏈�缁堢殑绉戝璁℃暟娉曟牸寮忓瓧绗︿覆
+ return String.format("%s脳10%s", mantissa, power);
+ }
+
+
+ // 鍒ゆ柇鏄惁鏄暟瀛�
+ public static boolean isNumeric(String str) {
+ if (str == null || str.isEmpty()) {
+ return false;
+ }
+ try {
+ Double.parseDouble(str); // 灏濊瘯灏嗗瓧绗︿覆瑙f瀽涓哄弻绮惧害娴偣鏁�
+ return true;
+ } catch (NumberFormatException e) {
+ return false; // 瑙f瀽澶辫触鍒欒繑鍥瀎alse
+ }
+ }
+
+ /**
+ * 鏍规嵁瑕佹眰鎻忚堪淇濈暀缁撴灉灏忔暟鐐逛綅鏁�
+ *
+ * @param reference
+ * @param value
+ * @return
+ */
+ public static String modifyNumber(String reference, String value) {
+ if (reference.equals("/") || reference.equals("-") || reference.equals("鈥�")) {
+ // 涓嶅垽瀹氶粯璁や繚鐣欎竴浣嶅皬鏁� > 榛樿灏忔暟浣�
+// BigDecimal bd = new BigDecimal(value);
+// bd = bd.setScale(1, RoundingMode.HALF_UP);
+ return value;
+ }
+
+ // 鍒ゆ柇鏄惁鏄暟瀛�
+ if (!isNumeric(value)) {
+ try {
+ // 鍙兘鏄墹95.1A杩欐牱鐨�, 闇�瑕佹埅鍙栦繚鐣欎綅鏁�
+ // 浣跨敤姝e垯琛ㄨ揪寮忔彁鍙栨暟瀛楅儴鍒�
+ String numberPart = value.replaceAll("[^0-9.]", "");
+ // 灏嗘暟瀛楅儴鍒嗘浛鎹㈡垚鍗犱綅绗�
+ String withPlaceholder = value.replaceAll(numberPart, "**");
+ // 鎻愬彇灏忔暟鐐逛綅鏁�
+ int decimalPlaces = getDecimalPlaces(reference);
+ // 澶勭悊绗簩涓瓧绗︿覆
+ BigDecimal number = new BigDecimal(numberPart);
+ number = number.setScale(decimalPlaces, RoundingMode.HALF_UP);
+ // 绛変簬0闇�瑕佽繘涓�姝ュ鐞�
+ if (number.compareTo(BigDecimal.ZERO) == 0) {
+ return formatNumber(value, decimalPlaces);
+ }
+ // 灏嗗崰浣嶇鏇挎崲鎴愭寚瀹氭暟瀛�
+ String finalResult = withPlaceholder.replace("**", number.toString());
+ return finalResult;
+ } catch (Exception e) {
+ return value;
+ }
+ }
+
+ // 鎻愬彇灏忔暟鐐逛綅鏁�
+ int decimalPlaces = getDecimalPlaces(reference);
+
+ // 澶勭悊绗簩涓瓧绗︿覆
+ BigDecimal number = new BigDecimal(value);
+ number = number.setScale(decimalPlaces, RoundingMode.HALF_UP);
+
+ // 绛変簬0闇�瑕佽繘涓�姝ュ鐞�
+ if (number.compareTo(BigDecimal.ZERO) == 0) {
+ return formatNumber(value, decimalPlaces);
+ }
+
+ return number.toString();
+ }
+
+
+ private static int getDecimalPlaces(String str) {
+ // 鏌ユ壘灏忔暟鐐逛綅缃�
+ int decimalPointIndex = str.lastIndexOf('.');
+
+ if (decimalPointIndex == -1) {
+ // 濡傛灉娌℃湁灏忔暟鐐癸紝杩斿洖0浣嶅皬鏁�
+ return 0;
+ }
+
+ // 璁$畻灏忔暟鐐瑰悗鐨勪綅鏁�
+ return str.length() - decimalPointIndex - 1;
+ }
+
+ /**
+ * 淇濈暀浣嶆暟, 濡傛灉绛変簬0 杩斿洖鎵惧埌鐨勪竴涓潪0浣嶆暟
+ *
+ * @param number 褰撳墠鏁板瓧
+ * @param scale 鍘熸湰淇濈暀鐨勪綅鏁�
+ * @return
+ */
+ public static String formatNumber(String number, int scale) {
+ // 灏嗚緭鍏ョ殑瀛楃涓茶浆鎹负 BigDecimal
+ BigDecimal bd = new BigDecimal(number);
+
+ // 淇濈暀鎸囧畾鐨勫皬鏁颁綅鏁帮紝骞朵娇鐢ㄥ洓鑸嶄簲鍏ユā寮�
+ bd = bd.setScale(scale, RoundingMode.HALF_UP);
+
+ // 妫�鏌ヤ繚鐣欑殑灏忔暟鏄惁绛変簬 0
+ if (bd.stripTrailingZeros().scale() <= 0) {
+ // 闇�瑕佹壘鍒扮涓�涓笉涓� 0 鐨勫皬鏁颁綅
+ String decimalPart = number.substring(number.indexOf('.') + 1);
+ int firstNonZeroIndex = findFirstNonZeroIndex(decimalPart);
+
+ if (firstNonZeroIndex != -1) {
+ // 璁$畻闇�瑕佷繚鐣欑殑灏忔暟浣嶆暟
+ int newScale = firstNonZeroIndex + 1;
+ bd = new BigDecimal(number).setScale(newScale, RoundingMode.HALF_UP);
+ }
+ }
+
+ return bd.toString();
+ }
+
+ private static int findFirstNonZeroIndex(String decimalPart) {
+ for (int i = 0; i < decimalPart.length(); i++) {
+ if (decimalPart.charAt(i) != '0') {
+ return i;
+ }
+ }
+ return -1; // 濡傛灉娌℃湁鎵惧埌闈為浂鐨勬暟瀛�
+ }
+
+ /**
+ * *****淇濆瓨鍏冩闃块噷杩涜揣楠岃瘉鍘熷璁板綍*****
+ *
+ * @param insOrderId 璁㈠崟Id
+ * @param examineUserId 澶嶆牳浜篒d
+ * @param writeUserId 妫�楠屽憳Id
+ */
+ private void reportFactoryVerify(Integer insOrderId, Integer examineUserId, Integer writeUserId) {
+ // 鏌ヨ杩涜揣楠岃瘉鍘熷璁板綍
+ InsOrderFactoryVerify factoryVerify = insOrderFactoryVerifyMapper.selectOne(Wrappers.<InsOrderFactoryVerify>lambdaQuery()
+ .eq(InsOrderFactoryVerify::getInsOrderId, insOrderId)
+ .last("limit 1"));
+
+ // 娌℃湁灏辩粨鏉�
+ if (factoryVerify == null) {
+ return;
+ }
+
+ //1.鏉愭枡鍚嶇О
+ factoryVerify.setBasicName(this.formatBasic(factoryVerify.getBasicName()));
+ //2.瑙勬牸鍨嬪彿
+ factoryVerify.setBasicModel(this.formatBasic(factoryVerify.getBasicModel()));
+ //3.鏉愭枡鎵瑰彿
+ factoryVerify.setBasicBatchNo(this.formatBasic(factoryVerify.getBasicBatchNo()));
+ //4.鎵ц鏍囧噯
+ factoryVerify.setBasicStandard(this.formatBasic(factoryVerify.getBasicStandard()));
+ //5.鐢熶骇鏃ユ湡
+ factoryVerify.setBasicDate(this.formatBasic(factoryVerify.getBasicDate()));
+ //6.渚涜揣鏁伴噺
+ factoryVerify.setBasicNumber(this.formatBasic(factoryVerify.getBasicNumber()));
+ //7.鏉愭枡鍚嶇О
+ factoryVerify.setBasicColor(this.formatBasic(factoryVerify.getBasicColor()));
+
+ //8.鍏朵粬
+ // 鍐呭
+ if (factoryVerify.getBasicOtherValue() == null) {
+ factoryVerify.setBasicOtherValue("");
+ }
+ // 鍊�
+ if (factoryVerify.getBasicOther() == null) {
+ factoryVerify.setBasicOther("");
+ }
+ switch (factoryVerify.getBasicOther()) {
+ case "1":
+ factoryVerify.setBasicOther("鈽戠鍚� 鈻′笉绗﹀悎");
+ break;
+ case "2":
+ factoryVerify.setBasicOther("鈻$鍚� 鈽戜笉绗﹀悎");
+ break;
+ default:
+ factoryVerify.setBasicOther("鈻$鍚� 鈻′笉绗﹀悎");
+ }
+
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ String declareDate = factoryVerify.getDeclareDate().format(formatter);
+
+ // 淇敼楠岃瘉椤圭洰
+ List<InsOrderFactoryVerifyItem> verifyItems = insOrderFactoryVerifyItemService.list(Wrappers.<InsOrderFactoryVerifyItem>lambdaQuery()
+ .eq(InsOrderFactoryVerifyItem::getFactoryVerifyId, factoryVerify.getFactoryVerifyId())
+ .orderByAsc(InsOrderFactoryVerifyItem::getSort));
+
+ for (InsOrderFactoryVerifyItem verifyItem : verifyItems) {
+ if (verifyItem.getResult() == null) {
+ verifyItem.setResult("");
+ }
+ switch (verifyItem.getResult()) {
+ case "1":
+ verifyItem.setResult("鈽戠鍚� 鈻′笉绗﹀悎 鈻′笉閫傜敤");
+ break;
+ case "2":
+ verifyItem.setResult("鈻$鍚� 鈽戜笉绗﹀悎 鈻′笉閫傜敤");
+ break;
+ case "3":
+ verifyItem.setResult("鈻$鍚� 鈻′笉绗﹀悎 鈽戜笉閫傜敤");
+ break;
+ default:
+ verifyItem.setResult("鈻$鍚� 鈻′笉绗﹀悎 鈻′笉閫傜敤");
+ }
+ }
+
+ //鑾峰彇鎻愪氦浜虹殑绛惧悕鍦板潃
+ String writeUrl;
+ try {
+ writeUrl = userMapper.selectById(writeUserId).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+ if (ObjectUtils.isEmpty(writeUrl) || writeUrl.equals("")) {
+ throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�");
+ }
+
+ //鑾峰彇澶嶆牳浜虹殑绛惧悕鍦板潃
+ String examineUrl;
+ try {
+ examineUrl = userMapper.selectById(examineUserId).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒板鏍镐汉鐨勭鍚�");
+ }
+ if (ObjectUtils.isEmpty(examineUrl) || examineUrl.equals("")) {
+ throw new ErrorException("鎵句笉鍒板鏍镐汉鐨勭鍚�");
+ }
+
+
+ InputStream inputStream = this.getClass().getResourceAsStream("/static/factory_verify.docx");
+ ConfigureBuilder builder = Configure.builder();
+ builder.useSpringEL(true);
+
+ XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render(
+ new HashMap<String, Object>() {{
+ put("report", factoryVerify);
+ put("declareDate", declareDate);
+ put("factoryVerifyItemList", verifyItems);
+ put("writeUrl", Pictures.ofLocal(imgUrl + "/" + writeUrl).create());
+ put("examineUrl", Pictures.ofLocal(imgUrl + "/" + examineUrl).create());
+ put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
+ put("examineDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
+ }});
+
+ MultipartFile multipartFile = xwpfDocumentToMockMultipartFile(template.getXWPFDocument());
+
+ // 淇濆瓨鍒伴檮浠堕噷闈�
+ uploadFile(insOrderId, multipartFile);
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ /**
+ * XWPFDocument 杞� MultipartFile(MockMultipartFile)
+ *
+ * @param document 鏂囨。瀵硅薄
+ * @return
+ */
+ public static MultipartFile xwpfDocumentToMockMultipartFile(XWPFDocument document) {
+ String fileName = "鍘熸潗鏂欒繘璐ч獙璇佽褰�.docx";
+ try {
+ String contentType = "text/plain";
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ document.write(bos);
+ //XWPFDocument 杞� byte[]
+ byte[] barray = bos.toByteArray();
+ //byte[] 杞� InputStream
+ InputStream is = new ByteArrayInputStream(barray);
+ //InputStream 杞� MultipartFile
+ MultipartFile multipartFile = new MockMultipartFile(fileName, fileName, contentType, is);
+ return multipartFile;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+
+ /**
+ * ***鏍煎紡鍖栬繘鍘傞獙璇佸唴瀹�****
+ *
+ * @param basicType
+ * @return
+ */
+ private String formatBasic(String basicType) {
+ if (basicType == null) {
+ basicType = "";
+ }
+
+ //鏍煎紡鍖栧瓧娈�
+ String basic = "";
+ switch (basicType) {
+ case "1":
+ basic = "鈽戠鍚� 鈻′笉绗﹀悎 鈻′笉閫傜敤";
+ break;
+ case "2":
+ basic = "鈻$鍚� 鈽戜笉绗﹀悎 鈻′笉閫傜敤";
+ break;
+ case "3":
+ basic = "鈻$鍚� 鈻′笉绗﹀悎 鈽戜笉閫傜敤";
+ break;
+ default:
+ basic = "鈻$鍚� 鈻′笉绗﹀悎 鈻′笉閫傜敤";
+ }
+
+ return basic;
+ }
+
+ /**
+ * ***word杞崲pdf***
+ *
+ * @param path
+ * @return
+ */
+ @Override
+ public String wordToPdfTemp(String path) {
+ try {
+ return wordToPdf(path, path.replace(".docx", "-涓存椂.pdf"));
+ } catch (Exception e) {
+ throw new ErrorException("杞崲澶辫触");
+ }
+ }
+
+ private String wordToPdf(String wordPath, String pdfPath) {
+ FileOutputStream os = null;
+ try {
+ //鍑瘉 涓嶇劧鍒囨崲鍚庢湁姘村嵃
+ InputStream is = new ClassPathResource("/lib/license.xml").getInputStream();
+ License license = new License();
+ license.setLicense(is);
+ if (!license.getIsLicensed()) {
+ return null;
+ }
+ //鐢熸垚涓�涓┖鐨凱DF鏂囦欢
+ File file;
+ //鍒ゆ柇鏄惁鏄繘鍘傛姤鍛�
+ file = new File(pdfPath);
+ os = new FileOutputStream(file);
+ //瑕佽浆鎹㈢殑word鏂囦欢
+ com.aspose.words.Document doc = new com.aspose.words.Document(wordPath);
+ doc.save(os, SaveFormat.PDF);
+ String name = file.getName();
+ return file.getName();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (os != null) {
+ try {
+ os.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * *****淇敼鎴愬搧鎶芥牱鐘舵��******
+ *
+ * @param insSamples
+ * @param order
+ */
+ private void addProductSpotCheck(List<InsSample> insSamples, InsOrder order) {
+ Long unqualifiedCount = 0L;
+ if (CollectionUtils.isNotEmpty(insSamples)) {
+ unqualifiedCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
+ .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList()))
+ .eq(InsProduct::getInsResult, 0));
+
+ // 鍒ゆ柇濡傛灉鏈変笉鍚堟牸鐨勬楠岄」, 鍒ゆ柇鏈夋病鏈夋楠岄」澶嶆祴, 澶嶆牳鍚堟牸涔熺畻鍚堟牸閫氳繃
+ if (!unqualifiedCount.equals(0L)) {
+ List<InsProduct> productList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList()))
+ .eq(InsProduct::getInsResult, 0));
+
+ boolean flag = true;
+ for (InsProduct insProduct : productList) {
+ Long unqualifiedProductCount = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery()
+ .eq(InsUnqualifiedRetestProduct::getInsProductId, insProduct.getId())
+ .ne(InsUnqualifiedRetestProduct::getInsResult, 0));
+ if (unqualifiedProductCount != 2) {
+ flag = false;
+ }
+ }
+ if (flag) {
+ unqualifiedCount = 0L;
+ }
+ }
+ }
+ spotCheckQuarterItemMapper.update(null, Wrappers.<SpotCheckQuarterItem>lambdaUpdate()
+ .eq(SpotCheckQuarterItem::getQuarterItemId, order.getQuarterItemId())
+ .set(SpotCheckQuarterItem::getResult, unqualifiedCount.equals(0L) ? "鍚堟牸" : "涓嶅悎鏍�"));
+ }
+
+ /**
+ * 娣诲姞宸ユ椂
+ *
+ * @param userId
+ * @param insProduct
+ * @param insOrder
+ */
+ private synchronized void addAuxiliary(Integer userId, InsProduct insProduct, InsOrder insOrder) {
+ if (insProduct.getIsBinding().equals(1)) {
+ return;
+ }
+
+ //鏍¢獙濡傛灉杩欎釜浜鸿繖涓娴嬮」鐩凡缁忔坊鍔犺繃浜�
+ List<AuxiliaryOutputWorkingHours> count2s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
+ .eq(AuxiliaryOutputWorkingHours::getCheck, userId)
+ .eq(AuxiliaryOutputWorkingHours::getInsProductId, insProduct.getId()));
+ if (CollectionUtils.isNotEmpty(count2s)) {
+ for (AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours : count2s) {
+ auxiliaryOutputWorkingHours.setCheck(userId);//妫�娴嬩汉
+ }
+ auxiliaryOutputWorkingHoursService.updateBatchById(count2s);
+ } else {
+ if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && StringUtils.isNotBlank(insProduct.getLastValue())) {
+ AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
+ auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//妫�娴嬮」鍒嗙被
+ auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//妫�娴嬬埗椤�
+ auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//妫�娴嬪瓙椤�
+ auxiliaryOutputWorkingHours.setSample(insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode());//鏍峰搧缂栧彿
+ auxiliaryOutputWorkingHours.setOrderId(insOrder.getId());//璁㈠崟id
+ auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙�
+ auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//闈炲姞鐝伐鏃�
+ auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲�
+ auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//浜ч噺宸ユ椂
+ auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//鏃ユ湡
+ LocalDateTime localDateTime = LocalDateTime.now();
+ DateTime parse = DateUtil.parse(localDateTime.format(formatter));
+ auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡
+ auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ
+ auxiliaryOutputWorkingHours.setCheck(userId);//妫�娴嬩汉
+ auxiliaryOutputWorkingHours.setPrice(insProduct.getPrice());//鍗曚环
+ auxiliaryOutputWorkingHours.setSampleId(insProduct.getInsSampleId());//鏍峰搧id
+ auxiliaryOutputWorkingHours.setInsProductId(insProduct.getId());//妫�楠岄」id
+
+ auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
+
+ }
+ }
+ }
+
+
+ public static String getWeek(String dayStr) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ try {
+ Date date = sdf.parse(dayStr);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
+ int day = calendar.get(Calendar.DAY_OF_MONTH);
+ return getWeekDay(dayOfWeek);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static String getWeekDay(int dayOfWeek) {
+ switch (dayOfWeek) {
+ case Calendar.MONDAY:
+ return "鍛ㄤ竴";
+ case Calendar.TUESDAY:
+ return "鍛ㄤ簩";
+ case Calendar.WEDNESDAY:
+ return "鍛ㄤ笁";
+ case Calendar.THURSDAY:
+ return "鍛ㄥ洓";
+ case Calendar.FRIDAY:
+ return "鍛ㄤ簲";
+ case Calendar.SATURDAY:
+ return "鍛ㄥ叚";
+ case Calendar.SUNDAY:
+ return "鍛ㄦ棩";
+ default:
+ return "鏈煡";
+ }
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderRatesServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderRatesServiceImpl.java
new file mode 100644
index 0000000..9b3066f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderRatesServiceImpl.java
@@ -0,0 +1,39 @@
+package com.ruoyi.inspect.service.impl;
+
+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.common.utils.QueryWrappers;
+import com.ruoyi.inspect.dto.SampleOrderDto;
+import com.ruoyi.inspect.dto.TemplateRateDto;
+import com.ruoyi.inspect.mapper.InsOrderRatesMapper;
+import com.ruoyi.inspect.pojo.InsOrderRates;
+import com.ruoyi.inspect.service.InsOrderRatesService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 璁㈠崟璐圭敤琛�
+ *
+ * @author zhuo
+ * @since 2025-02-28
+ */
+@Service
+public class InsOrderRatesServiceImpl extends ServiceImpl<InsOrderRatesMapper, InsOrderRates> implements InsOrderRatesService {
+
+ /**
+ * 鏌ヨ璁㈠崟璐圭敤鍒楄〃
+ * @param page
+ * @param sampleOrderDto
+ * @return
+ */
+ @Override
+ public IPage<SampleOrderDto> selectInsOrderRates(Page page, SampleOrderDto sampleOrderDto) {
+ return baseMapper.selectInsOrderRates(page, QueryWrappers.queryWrappers(sampleOrderDto));
+ }
+
+ @Override
+ public IPage<TemplateRateDto> selectTemplateRatesDetail(Page page, Integer insOrderId) {
+ return baseMapper.selectTemplateRatesDetail(page, insOrderId);
+ }
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
new file mode 100644
index 0000000..ed0874d
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -0,0 +1,1738 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.dto.InventoryDetailDTO;
+import com.ruoyi.basic.dto.StandardTreeTemplateBindingVo;
+import com.ruoyi.basic.dto.TemplateInspectionItemDto;
+import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
+import com.ruoyi.basic.mapper.StandardProductListMapper;
+import com.ruoyi.basic.mapper.StructureItemParameterMapper;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.pojo.StandardProductList;
+import com.ruoyi.basic.pojo.StandardMethod;
+import com.ruoyi.basic.pojo.StructureItemParameter;
+import com.ruoyi.basic.pojo.StructureTestObject;
+import com.ruoyi.basic.pojo.StandardTree;
+import com.ruoyi.basic.pojo.StandardTemplate;
+import com.ruoyi.basic.service.StandardTemplateService;
+import com.ruoyi.basic.service.StandardMethodService;
+import com.ruoyi.basic.service.StandardTreeService;
+import com.ruoyi.basic.utils.StandardTreePathParser;
+import com.ruoyi.common.constant.InsOrderTypeConstants;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.common.enums.OrderType;
+import com.ruoyi.common.numgen.NumberGenerator;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.api.IfsApiUtils;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.*;
+import com.ruoyi.inspect.mapper.*;
+import com.ruoyi.inspect.pojo.*;
+import com.ruoyi.inspect.service.InsOrderService;
+import com.ruoyi.inspect.service.InsOrderStateService;
+import com.ruoyi.inspect.service.InsProductService;
+import com.ruoyi.inspect.service.InsSampleService;
+import com.ruoyi.inspect.vo.IfsOrderVO;
+import com.ruoyi.inspect.vo.InsOrderPrintingVo;
+import com.ruoyi.inspect.vo.OrderTemplateSummaryVo;
+import com.ruoyi.inspect.vo.TemplateConditionVo;
+import com.ruoyi.system.mapper.UserMapper;
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.Month;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
+/**
+ * @author gaoaoy
+ * @description 閽堝琛ㄣ�恑ns_order(妫�楠屼笅鍗�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+ * @createDate 2024-03-12 16:17:55
+ */
+@Service
+@AllArgsConstructor
+public class InsOrderServiceImpl extends ServiceImpl<InsOrderMapper, InsOrder>
+ implements InsOrderService {
+
+ private static final String DIRECT_TEMPLATE_LABORATORY = "鏂拌仛";
+
+ private InsOrderMapper insOrderMapper;
+ private InsSampleService insSampleService;
+ private InsSampleMapper insSampleMapper;
+ private InsProductService insProductService;
+ private InsProductMapper insProductMapper;
+ private InsSampleUserMapper insSampleUserMapper;
+ private InsOrderStateService insOrderStateService;
+ private UserMapper userMapper;
+ private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
+ private final NumberGenerator<InsOrder> numberGenerator;
+ private InsReportMapper insReportMapper;
+ private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper;
+ private IfsApiUtils ifsApiUtils;
+ private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper;
+ private StandardProductListMapper standardProductListMapper;
+ private StructureItemParameterMapper structureItemParameterMapper;
+ private StandardTreeService standardTreeService;
+ private StandardMethodService standardMethodService;
+ private StandardTemplateService standardTemplateService;
+ private InsOrderStandardTemplateMapper insOrderStandardTemplateMapper;
+ private InsOrderTemplateDeviceMapper insOrderTemplateDeviceMapper;
+ private InsSampleReceiptMapper insSampleReceiptMapper;
+ private ApplicationEventPublisher applicationEventPublisher;
+
+
+
+ //鑾峰彇妫�楠屼笅鍗曟暟鎹�
+ @Override
+ public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) {
+ String laboratory = null;
+ // 鍒ゆ柇鏄惁鏄叏閮�
+ String isOrderAll = null;
+ if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) {
+ isOrderAll = "1";
+ sampleOrderDto.setState(null);
+ }
+ // 妫�楠屼腑锛氭柊鑱氫笅鍗曞厤瀹℃牳鍗冲彈鐞嗭紝闇�鏍峰搧鎺ユ敹鎻愪氦鍚庯紙ins_sample_receipt.status=1锛夋墠灞曠ず
+ String receiptSubmitted = sampleOrderDto.getState() != null && sampleOrderDto.getState() == 1 ? "1" : null;
+ return insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), laboratory,
+ isOrderAll, receiptSubmitted);
+ }
+
+
+ /**
+ * 鍒嗛厤妫�楠屼汉
+ *
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId, String sonLaboratory) {
+ InsOrder insOrder = new InsOrder();
+ insOrder.setId(orderId);
+ insOrder.setAppointed(StringUtils.isNotEmpty(appointed) ? LocalDate.parse(appointed) : null);
+ insOrder.setSendTime(LocalDateTime.now());
+ insOrderMapper.updateById(insOrder);
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
+ List<Integer> ids = insSamples.stream().map(InsSample::getId).collect(Collectors.toList());
+ List<InsProduct> insProducts = ids.isEmpty()
+ ? Collections.emptyList()
+ : insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .in(InsProduct::getInsSampleId, ids)
+ .eq(InsProduct::getState, 1)
+ .select(InsProduct::getSonLaboratory).groupBy(InsProduct::getSonLaboratory));
+
+ InsOrder order = insOrderMapper.selectById(orderId);
+ boolean directTemplateOrder = isDirectTemplateOrder(order, insSamples);
+ Set<String> taskLaboratories = directTemplateOrder
+ ? Collections.singleton(DIRECT_TEMPLATE_LABORATORY)
+ : insProducts.stream()
+ .map(InsProduct::getSonLaboratory)
+ .filter(StringUtils::isNotBlank)
+ .collect(Collectors.toCollection(LinkedHashSet::new));
+ if (!directTemplateOrder && taskLaboratories.size() != insProducts.size()) {
+ throw new ErrorException("璇ユ楠屽崟鏈夋湭缁存姢瀹為獙瀹ょ殑妫�楠岄」鐩�");
+ }
+
+ // 鎵归噺娣诲姞妫�楠屼换鍔$姸鎬佽〃
+ List<InsOrderState> insOrderStateList = taskLaboratories.stream()
+ .filter(laboratory -> insOrderStateService.count(Wrappers.<InsOrderState>lambdaQuery()
+ .eq(InsOrderState::getInsOrderId, orderId)
+ .eq(InsOrderState::getLaboratory, laboratory)) == 0)
+ .map(laboratory -> {
+ InsOrderState insOrderState = new InsOrderState();
+ insOrderState.setInsOrderId(orderId);
+ insOrderState.setLaboratory(laboratory);
+ insOrderState.setInsState(0);
+ return insOrderState;
+ }).collect(Collectors.toList());
+ if (!insOrderStateList.isEmpty()) {
+ insOrderStateService.saveBatch(insOrderStateList);
+ }
+
+ if (userId != null) {
+ Set<String> assignedLaboratories = StringUtils.isBlank(sonLaboratory)
+ ? taskLaboratories
+ : Collections.singleton(sonLaboratory);
+ for (String laboratory : assignedLaboratories) {
+ InsSampleUser insSampleUser = new InsSampleUser();
+ insSampleUser.setState(0);
+ insSampleUser.setUserId(userId);
+ insSampleUser.setInsSampleId(orderId);
+ insSampleUser.setSonLaboratory(laboratory);
+ insSampleUserMapper.insert(insSampleUser);
+ }
+ }
+
+ // 鍒ゆ柇璁㈠崟鏈夋病鏈夌粦瀹氭娊鏍疯鍒�
+ if (order.getQuarterItemId() != null) {
+ // 闇�瑕佹坊鍔犱笅鍙戞椂闂村埌鎶芥牱鏃堕棿, 鍙栨牱浜哄憳灏辨槸妫�娴嬩汉
+ SpotCheckQuarterItem spotCheckQuarterItem = spotCheckQuarterItemMapper.selectById(order.getQuarterItemId());
+ spotCheckQuarterItem.setSpotCheckTime(order.getSendTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+ User user = userMapper.selectById(userId);
+ spotCheckQuarterItem.setSamplingUser(user.getName());
+ spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem);
+ }
+
+ return 1;
+ }
+
+ private boolean isDirectTemplateOrder(InsOrder order, List<InsSample> samples) {
+ if (order == null || CollectionUtils.isEmpty(samples)) {
+ return false;
+ }
+ Long snapshotCount = insOrderStandardTemplateMapper.selectCount(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, order.getId()));
+ return snapshotCount > 0 && samples.stream().anyMatch(sample ->
+ sample.getStandardMethodListId() == null
+ && StringUtils.isBlank(sample.getFactory())
+ && StringUtils.isBlank(sample.getSampleType())
+ && StringUtils.isBlank(sample.getModel())
+ && StringUtils.isBlank(order.getFactory())
+ && StringUtils.isBlank(order.getSampleType()));
+ }
+
+
+ public static String getWeek(String dayStr) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ try {
+ Date date = sdf.parse(dayStr);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
+ int day = calendar.get(Calendar.DAY_OF_MONTH);
+ return getWeekDay(dayOfWeek);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static String getWeekDay(int dayOfWeek) {
+ switch (dayOfWeek) {
+ case Calendar.MONDAY:
+ return "鍛ㄤ竴";
+ case Calendar.TUESDAY:
+ return "鍛ㄤ簩";
+ case Calendar.WEDNESDAY:
+ return "鍛ㄤ笁";
+ case Calendar.THURSDAY:
+ return "鍛ㄥ洓";
+ case Calendar.FRIDAY:
+ return "鍛ㄤ簲";
+ case Calendar.SATURDAY:
+ return "鍛ㄥ叚";
+ case Calendar.SUNDAY:
+ return "鍛ㄦ棩";
+ default:
+ return "鏈煡";
+ }
+ }
+
+
+ // 濡傛灉浣犱娇鐢� Java 8+锛屼篃鍙互鐢� Stream API 绠�鍖栦唬鐮侊細
+ public List<StandardProductList> findMissingItemsWithStream(List<StandardProductList> standardList,
+ List<InsProduct> insList) {
+ Set<Integer> insIds = insList.stream()
+ .map(InsProduct::getStructureItemParameterId)
+ .collect(Collectors.toSet());
+
+ return standardList.stream()
+ .filter(product -> !insIds.contains(product.getStructureItemParameterId()))
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int addInsOrder(List<SampleProductDto> list, InsOrder insOrder) {
+ // todo: 涓嬪崟鍒ゆ柇鎶芥牱璁″垝鐨勫敮涓�鎬�
+ if (insOrder.getQuarterItemId() != null) {
+ Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId())
+ .notIn(InsOrder::getState, -1 ,2 ,3));
+ if (quarterItemCount > 0) {
+ throw new ErrorException("璇ユ娊鏍疯鍒掑凡琚粦瀹氳繃");
+ }
+ }
+ insOrder.setState(0);
+
+ LocalDate appointed = insOrder.getAppointed();
+
+ insOrderMapper.insert(insOrder); // 涓昏〃
+
+ list.forEach(a -> {
+ a.setId(null);
+ a.setInsOrderId(insOrder.getId());
+ insSampleMapper.insert(a);
+ if (ObjectUtil.isNotEmpty(a.getInsProduct())) {
+ // 鍒ゆ柇鏄惁濉啓寰呮椤规暟閲�
+ if (a.getQuantity() != null) {
+ List<InsProduct> ip2 = new ArrayList<>();
+ for (Integer i = 1; i <= a.getQuantity(); i++) {
+ // 閲嶆柊鎷疯礉 鍒涘缓鏂板璞�
+ AtomicInteger atomicInteger = new AtomicInteger(i);
+ List<InsProduct> insProducts = a.getInsProduct().stream().map(insProduct -> {
+ insProduct.setRawMaterialTag(String.valueOf(atomicInteger.get()));
+ InsProduct product = new InsProduct();
+ BeanUtils.copyProperties(insProduct, product);
+ return product;
+ }).collect(Collectors.toList());
+
+ ip2.addAll(insProducts);
+ }
+ addInsProductMethod(a.getId(), ip2);
+ } else {
+ addInsProductMethod(a.getId(), a.getInsProduct());
+ }
+ }
+ // 鍒ゆ柇鏄惁鏈夌數缂嗛厤缃�
+ if (ObjectUtil.isNotEmpty(a.getInsulating())) {
+ // 鍒ゆ柇鏄惁鏈夎緟鍔╃嚎鑺�
+ if (ObjectUtil.isNotEmpty(a.getAuxiliaryWireCore())) {
+ if (a.getAuxiliaryWireCore().getInsProduct().stream().filter(insProduct -> insProduct.getState() == 1).count() !=
+ a.getInsulating().getInsProduct().stream().filter(insProduct -> insProduct.getState() == 1).count()) {
+ throw new ErrorException("鐢电紗閰嶇疆杈呭姪绾胯姱妫�楠岄」鏁伴噺涓嶇粺涓�, 璇锋鏌�");
+ }
+ }
+ List<InsProduct> ip2 = new ArrayList<>();
+ for (String s : a.getInsulating().getNum()) {
+ // 閲嶆柊鎷疯礉 鍒涘缓鏂板璞�
+ List<InsProduct> insProducts = a.getInsulating().getInsProduct().stream().map(insProduct -> {
+ insProduct.setCableTag(s);
+ InsProduct product = new InsProduct();
+ BeanUtils.copyProperties(insProduct, product);
+ return product;
+ }).collect(Collectors.toList());
+ ip2.addAll(insProducts);
+ }
+ for (InsProduct product : ip2) {
+ product.setStandardMethodListId(a.getInsulating().getStandardMethodListId());
+ }
+ addInsProductMethod(a.getId(), ip2);
+ }
+ // 鍒ゆ柇鏄惁鏈夎緟鍔╃嚎鑺�
+ if (ObjectUtil.isNotEmpty(a.getAuxiliaryWireCore())) {
+ List<InsProduct> ip2 = new ArrayList<>();
+ for (String s : a.getAuxiliaryWireCore().getNum()) {
+ // 閲嶆柊鎷疯礉 鍒涘缓鏂板璞�
+ List<InsProduct> insProducts = a.getAuxiliaryWireCore().getInsProduct().stream().map(insProduct -> {
+ insProduct.setCableTag(s);
+ InsProduct product = new InsProduct();
+ BeanUtils.copyProperties(insProduct, product);
+ return product;
+ }).collect(Collectors.toList());
+ ip2.addAll(insProducts);
+ }
+ for (InsProduct product : ip2) {
+ product.setStandardMethodListId(a.getAuxiliaryWireCore().getStandardMethodListId());
+ }
+ addInsProductMethod(a.getId(), ip2);
+ }
+ // 瀛愭牱鍝侀厤缃�
+ if (ObjectUtil.isNotEmpty(a.getChildSampleList())) {
+ for (SampleProductDto b : a.getChildSampleList()) {
+ for (int i = 0; i < b.getNum(); i++) {
+ b.setId(null);
+ b.setInsOrderId(insOrder.getId());
+ b.setParentId(a.getId());
+ insSampleMapper.insert(b);
+ if (ObjectUtil.isNotEmpty(b.getInsProduct())) {
+ addInsProductMethod(b.getId(), b.getInsProduct());
+ }
+ }
+ }
+ }
+ });
+ // 涓嬪崟鏃剁敓鎴愬鎵樼紪鍙峰苟鏍¢獙鍞竴鎬э紱瀛e害妫�楠屽鐢ㄨ繘鍘傛楠岀紪鍙凤紝鐣欏緟瀹℃牳澶勭悊銆�
+ if (!InsOrderTypeConstants.QUARTERLY_TEST.equals(insOrder.getOrderType())) {
+ String entrustCode = buildEntrustCode(insOrder, Collections.emptyList());
+ assertEntrustCodeUnique(entrustCode, insOrder.getId());
+ insOrder.setEntrustCode(entrustCode);
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, insOrder.getId())
+ .set(InsOrder::getEntrustCode, entrustCode));
+ }
+ //鍘熸潗鏂欎笅鍗曟垨澶栬喘鎴愬搧涓嬪崟
+ if (Objects.nonNull(insOrder.getTypeSource())&&Objects.nonNull(insOrder.getIfsInventoryId())) {
+ // 濮旀墭浜哄氨鏄姤妫�浜�, 鐢熶骇鍗曚綅灏辨槸渚涘簲鍟嗗崟浣�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId());
+ Integer declareUserId = ifsInventoryQuantity.getDeclareUserId();
+ User user = userMapper.selectById(declareUserId);
+ if (user == null) {
+ throw new ErrorException("缂哄皯鎶ユ浜轰俊鎭�");
+ }
+ // 渚涘簲鍟嗗悕绉�
+ insOrder.setProduction(ifsInventoryQuantity.getSupplierName());
+ insOrder.setProductionEn("");
+ // 濮旀墭浜哄悕绉�
+ insOrder.setPrepareUserId(user.getId());
+ insOrder.setPrepareUser(user.getName());
+ insOrder.setPrepareUserEn(user.getNameEn());
+ insOrder.setPhone(user.getPhone());
+ insOrder.setState(1);
+ Long count1 = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getIfsInventoryId, insOrder.getIfsInventoryId())
+ .ne(InsOrder::getState, -1)
+ .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY)
+ .ne(InsOrder::getId, insOrder.getId()));
+ // 鍒ゆ柇涔嬪墠鏄惁鏈夎繘鍘傛楠�
+ if (count1 == 0) {
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>().set(IfsInventoryQuantity::getState, 1)
+ .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()));
+ }
+
+ // 鍒ゆ柇缁撴潫鐘舵�佷慨鏀瑰悎鏍肩姸鎬�
+ if (ifsInventoryQuantity.getIsFinish().equals(0)) {
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())
+ .set(IfsInventoryQuantity::getInspectStatus, 0));
+ }
+
+ // 瀹℃牳妫�楠屽崟
+ upInsOrderOfState(insOrder);
+
+ // 瀹℃牳閫氳繃鍚庝粎杩涘叆鏍峰搧鎺ユ敹锛涚敱鏍峰搧鎺ユ敹椤甸潰閫夋嫨涓绘楠屼汉鍚庡啀鍒涘缓妫�楠屼换鍔°��
+
+ //鏄惁涓哄師鏉愭枡涓嬪崟
+ if(insOrder.getTypeSource().equals(1)){
+ // 鏍规嵁闆朵欢鍙峰垽鏂槸鍚︽槸杈呮潗
+ boolean isRaw = false;
+ StructureTestObject productObject = insOrderMapper.selectProductByPartNo(ifsInventoryQuantity.getPartNo());
+ // 鏌ヨ浜у搧
+ if (productObject != null && StrUtil.isNotBlank(productObject.getObjectType()) && productObject.getObjectType().equals("1")) {
+ isRaw = true;
+ } else {
+ // 鏌ヨ瀵硅薄
+ StructureTestObject testObject = insOrderMapper.selectByPartNo(ifsInventoryQuantity.getPartNo());
+ if (testObject != null && StrUtil.isNotBlank(testObject.getObjectType()) && testObject.getObjectType().equals("1")) {
+ isRaw = true;
+ }
+ }
+
+ if (isRaw) {
+ // 鑾峰彇褰撳墠瀛e害鐨勫紑濮嬫椂闂村拰缁撴潫鏃堕棿
+ LocalDateTime now = LocalDateTime.now();
+ // 鑾峰彇褰撳墠鏈堜唤
+ int month = now.getMonthValue();
+ // 纭畾褰撳墠瀛e害鐨勫紑濮嬫湀浠�
+ int startMonth = (month - 1) / 3 * 3 + 1;
+ // 鏋勯�犲搴︾殑寮�濮嬫椂闂�
+ LocalDateTime startOfQuarter = LocalDateTime.of(now.getYear(), Month.of(startMonth), 1, 0, 0);
+ // 璁$畻涓嬩竴涓搴︾殑寮�濮嬫椂闂�
+ LocalDateTime startOfNextQuarter = startOfQuarter.plusMonths(3);
+ // 璁$畻褰撳墠瀛e害鐨勭粨鏉熸椂闂�
+ LocalDateTime endOfQuarter = startOfNextQuarter.minusSeconds(1);
+
+ // 鏍规嵁涓嬪崟鐨勮鏍煎瀷鍙峰垽鏂槸鍚︿负瀛e害棣栨鍑虹幇
+ Integer count = ifsInventoryQuantityMapper.selectIsFirst(insOrder.getPartDetail(),
+ ifsInventoryQuantity.getSupplierName(),
+ startOfNextQuarter,
+ endOfQuarter);
+
+ if (count == 0) {
+ ifsInventoryQuantity.setIsFirst(1);
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())
+ .set(IfsInventoryQuantity::getIsFirst, 1));
+ }
+ }
+ }
+ }
+ return insOrder.getId();
+ }
+
+ /**
+ * 鏂拌仛鏍囧噯搴撶洿缁戞ā鏉跨殑涓嬪崟娴佺▼锛氫竴涓鍗曘�佷竴涓牱鍝侊紝妫�楠岃褰曞畬鍏ㄧ敱妯℃澘鏍囪鐢熸垚銆�
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int addNewJuInsOrder(InsPlaceOrderDto dto) {
+ if (dto == null || dto.getInsOrder() == null || dto.getStandardTreeId() == null) {
+ throw new ErrorException("涓嬪崟淇℃伅鎴栨爣鍑嗕笉鑳戒负绌�");
+ }
+ String sampleCode = StringUtils.trim(dto.getSampleCode());
+ if (StringUtils.isBlank(sampleCode) || sampleCode.length() < 2) {
+ throw new ErrorException("鏍峰搧缂栧彿涓嶈兘涓虹┖涓斾笉鑳藉皯浜�2浣�");
+ }
+ // 濮旀墭瑕佹眰瀛楁鏍¢獙锛氬洓缁勫崟閫夊繀閫夛紝鍒嗗寘/蹇�掕仈鍔ㄥ繀濉�
+ InsOrder reqOrder = dto.getInsOrder();
+ if (reqOrder.getSubcontractType() == null || reqOrder.getSampleDisposal() == null
+ || reqOrder.getResultEvaluation() == null || reqOrder.getReportDelivery() == null) {
+ throw new ErrorException("璇烽�夋嫨鍒嗗寘鍐呭銆佹牱鍝佸缃�佸缁撴灉璇勪环鍜屾姤鍛婁氦浠樻柟寮�");
+ }
+ if (Integer.valueOf(1).equals(reqOrder.getSubcontractType())
+ && StringUtils.isBlank(reqOrder.getSubcontractCompany())) {
+ throw new ErrorException("鍒嗗寘鍐呭涓烘湁鏃讹紝鍒嗗寘鍗曚綅淇℃伅涓嶈兘涓虹┖");
+ }
+ if (Integer.valueOf(2).equals(reqOrder.getReportDelivery())) {
+ if (StringUtils.isBlank(reqOrder.getReportAddress())) {
+ throw new ErrorException("鎶ュ憡浜や粯鏂瑰紡涓哄揩閫掓椂锛屾姤鍛婂瘎閫佸湴鍧�涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isBlank(reqOrder.getReportReceiver())) {
+ throw new ErrorException("鎶ュ憡浜や粯鏂瑰紡涓哄揩閫掓椂锛屾敹浠朵汉鍙婄數璇濅笉鑳戒负绌�");
+ }
+ }
+ StandardTree standard = standardTreeService.getById(dto.getStandardTreeId());
+ if (standard == null || StringUtils.isBlank(standard.getSample())
+ || standard.getSampleType() != null || standard.getModel() != null) {
+ throw new ErrorException("璇烽�夋嫨鏍囧噯搴撲簩绾ф爣鍑�");
+ }
+ List<StandardTreeTemplateBindingVo> bindings = standardTreeService.selectTemplateBindings(dto.getStandardTreeId());
+ if (bindings.isEmpty()) {
+ throw new ErrorException("璇ユ爣鍑嗗皻鏈粦瀹氬彲鐢ㄧ殑鍘熷璁板綍妯℃澘");
+ }
+ Map<Integer, StandardTreeTemplateBindingVo> bindingMap = bindings.stream()
+ .collect(Collectors.toMap(StandardTreeTemplateBindingVo::getTemplateId,
+ binding -> binding, (first, ignored) -> first));
+ List<OrderTemplateSelectionDto> selections = dto.getTemplateList();
+ if (selections == null) {
+ selections = bindings.stream().map(binding -> {
+ OrderTemplateSelectionDto selection = new OrderTemplateSelectionDto();
+ selection.setTemplateId(binding.getTemplateId());
+ selection.setSort(binding.getSort());
+ return selection;
+ }).collect(Collectors.toList());
+ }
+ if (selections.isEmpty()) {
+ throw new ErrorException("璇疯嚦灏戜繚鐣欎竴涓師濮嬭褰曟ā鏉�");
+ }
+ Set<Integer> selectedTemplateIds = new HashSet<>();
+ for (int index = 0; index < selections.size(); index++) {
+ OrderTemplateSelectionDto selection = selections.get(index);
+ if (selection == null || selection.getTemplateId() == null
+ || !bindingMap.containsKey(selection.getTemplateId())) {
+ throw new ErrorException("鎵�閫夊師濮嬭褰曟ā鏉夸笉灞炰簬褰撳墠鏍囧噯");
+ }
+ if (!selectedTemplateIds.add(selection.getTemplateId())) {
+ throw new ErrorException("鍘熷璁板綍妯℃澘涓嶈兘閲嶅閫夋嫨");
+ }
+ if (selection.getSort() == null) {
+ selection.setSort(index);
+ }
+ }
+ selections.sort(Comparator.comparing(OrderTemplateSelectionDto::getSort)
+ .thenComparing(OrderTemplateSelectionDto::getTemplateId));
+ Map<Integer, Integer> templateSortMap = selections.stream()
+ .collect(Collectors.toMap(OrderTemplateSelectionDto::getTemplateId,
+ OrderTemplateSelectionDto::getSort));
+ List<TemplateInspectionItemDto> templateItems = standardTreeService
+ .selectTemplateInspectionItems(dto.getStandardTreeId()).stream()
+ .filter(item -> selectedTemplateIds.contains(item.getTemplateId()))
+ .sorted(Comparator
+ .comparing((TemplateInspectionItemDto item) -> templateSortMap.get(item.getTemplateId()))
+ .thenComparing(item -> item.getTemplateRowIndex() == null
+ ? Integer.MAX_VALUE : item.getTemplateRowIndex()))
+ .collect(Collectors.toList());
+
+ StandardMethod standardMethod = standardMethodService.getById(standard.getStandardMethodId());
+ if (standardMethod == null || StringUtils.isBlank(standardMethod.getCode())) {
+ throw new ErrorException("鏍囧噯缂栧彿涓嶅瓨鍦�");
+ }
+ String standardCode = standardMethod.getCode().trim();
+
+ InsOrder order = dto.getInsOrder();
+ order.setId(null);
+ // 鏂拌仛涓嬪崟鍏嶅鏍革細鐩存帴鍙楃悊锛屼笅鍗曞嵆娴佽浆鍒版牱鍝佹帴鏀�
+ order.setState(1);
+ order.setExamineTime(LocalDateTime.now());
+ order.setIsExemption(0);
+ order.setFactory(null);
+ order.setLaboratory(standard.getLaboratory());
+ order.setSampleType(null);
+ order.setSample(standardCode);
+ order.setPrepareUserEn(null);
+ order.setPrepareCode(null);
+ order.setRemarkEn(null);
+ // 鏂拌仛璁㈠崟鐨勭幆澧冩潯浠剁敱妫�楠屼换鍔″~鍐欙紝閬垮厤涓嬪崟妯℃澘鎴栨祻瑙堝櫒缂撳瓨甯﹀叆鏃у�笺��
+ order.setTemperature(null);
+ order.setHumidity(null);
+ // 鏈懡涓仈鍔ㄦ潯浠舵椂娓呯┖瀵瑰簲鏂囨湰瀛楁锛岄伩鍏嶆ā鏉垮揩鐓ф垨娴忚鍣ㄧ紦瀛樺甫鍏ユ棫鍊笺��
+ if (!Integer.valueOf(1).equals(order.getSubcontractType())) {
+ order.setSubcontractCompany(null);
+ }
+ if (!Integer.valueOf(2).equals(order.getReportDelivery())) {
+ order.setReportAddress(null);
+ order.setReportReceiver(null);
+ }
+ insOrderMapper.insert(order);
+
+ InsSample sample = new InsSample();
+ sample.setInsOrderId(order.getId());
+ sample.setSampleCode(sampleCode);
+ sample.setFactory(null);
+ sample.setLaboratory(standard.getLaboratory());
+ sample.setSampleType(null);
+ sample.setSample(standardCode);
+ sample.setModel(null);
+ sample.setQuantity(1);
+ sample.setStandardMethodListId(null);
+ insSampleMapper.insert(sample);
+
+ int productSort = 0;
+ for (TemplateInspectionItemDto item : templateItems) {
+ InsProduct product = new InsProduct();
+ product.setInsSampleId(sample.getId());
+ product.setInspectionItem(item.getInspectionItem());
+ product.setInspectionItemClass("");
+ product.setInspectionItemSubclass("");
+ product.setFactory(null);
+ product.setLaboratory(standard.getLaboratory());
+ product.setSampleType(null);
+ product.setSample(standardCode);
+ product.setModel(null);
+ product.setTemplateId(item.getTemplateId());
+ product.setTemplateRowIndex(item.getTemplateRowIndex());
+ product.setSonLaboratory(DIRECT_TEMPLATE_LABORATORY);
+ product.setState(1);
+ product.setSort(productSort++);
+ insProductMapper.insert(product);
+ }
+ saveTemplateSnapshots(order.getId(), selections, bindingMap);
+
+ // 涓嬪崟鏃剁敓鎴愬鎵樼紪鍙峰苟鏍¢獙鍞竴鎬э紝閲嶅鍒欐彁绀猴紝閬垮厤鐣欏埌瀹℃牳鎵嶆姤閿欍��
+ String entrustCode = buildEntrustCode(order, Collections.singletonList(sample));
+ assertEntrustCodeUnique(entrustCode, order.getId());
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, order.getId())
+ .set(InsOrder::getEntrustCode, entrustCode));
+ // 鍏嶅鏍稿悗鐢变笅鍗曠敓鎴愬緟鎺ユ敹鐨勬牱鍝佹帴鏀惰褰曪紝涓绘楠屼汉浠嶅湪鏍峰搧鎺ユ敹椤甸潰閫夋嫨鍚庢墠鍒涘缓妫�楠屼换鍔�
+ insSampleReceiptMapper.insertIgnore(order.getId(), sample.getId());
+ // 鍚屼簨鍔″唴鍙戝竷涓嬪崟浜嬩欢锛岀敱 cnas-process 鑷姩鐢熸垚妫�楠屽鎵樺崟锛涚洃鍚櫒寮傚父浼氳繛甯︿笅鍗曞洖婊�
+ applicationEventPublisher.publishEvent(new com.ruoyi.inspect.event.NewJuOrderPlacedEvent(order.getId()));
+ return order.getId();
+ }
+
+ private void saveTemplateSnapshots(Integer orderId, List<OrderTemplateSelectionDto> selections,
+ Map<Integer, StandardTreeTemplateBindingVo> bindingMap) {
+ for (OrderTemplateSelectionDto selection : selections) {
+ StandardTemplate template = standardTemplateService.getById(selection.getTemplateId());
+ if (template == null) {
+ throw new ErrorException("鍘熷璁板綍妯℃澘涓嶅瓨鍦�");
+ }
+ InsOrderStandardTemplate snapshot = new InsOrderStandardTemplate();
+ snapshot.setInsOrderId(orderId);
+ snapshot.setTemplateId(template.getId());
+ snapshot.setName(template.getName());
+ snapshot.setNumber(template.getNumber());
+ snapshot.setRemark(template.getRemark());
+ snapshot.setThing(template.getThing());
+ snapshot.setSort(selection.getSort());
+ insOrderStandardTemplateMapper.insert(snapshot);
+
+ StandardTreeTemplateBindingVo binding = bindingMap.get(selection.getTemplateId());
+ List<Integer> deviceIds = binding == null || binding.getDeviceIds() == null
+ ? Collections.emptyList() : binding.getDeviceIds();
+ for (int index = 0; index < deviceIds.size(); index++) {
+ InsOrderTemplateDevice relation = new InsOrderTemplateDevice();
+ relation.setInsOrderId(orderId);
+ relation.setTemplateId(selection.getTemplateId());
+ relation.setDeviceId(deviceIds.get(index));
+ relation.setSort(index);
+ insOrderTemplateDeviceMapper.insert(relation);
+ }
+ }
+ }
+
+ /**
+ * 娣诲姞妫�楠岄」
+ * @param sampleId
+ * @param productList
+ */
+ private void addInsProductMethod(Integer sampleId, List<InsProduct> productList) {
+ for (InsProduct product : productList) {
+ if (product.getState() == 1) {
+ product.setId(null);
+ product.setCreateTime(null);
+ product.setCreateUser(null);
+ product.setUpdateTime(null);
+ product.setUpdateUser(null);
+ product.setInsSampleId(sampleId);
+ if (product.getInspectionItemSubclass() == null) {
+ product.setInspectionItemSubclass("");
+ }
+ if (StringUtils.isBlank(product.getAsk()) || StringUtils.isBlank(product.getTell())) {
+ throw new ErrorException("鏈夋楠岄」鐨勮姹傚�兼垨瑕佹眰鎻忚堪涓虹┖, 璇峰厛鍘绘爣鍑嗗簱閰嶇疆瑕佹眰鍊兼垨瑕佹眰鎻忚堪");
+ }
+ if (StringUtils.isBlank(product.getSonLaboratory())) {
+ throw new ErrorException("鏈夋楠岄」鐨勭殑瀛愬疄楠屽涓虹粦瀹�, 璇峰厛缁戝畾瀛愬疄楠屽");
+ }
+ insProductMapper.insert(product);
+ }
+ }
+ }
+
+
+ @Override
+ public Map<String, Object> getInsOrder(Integer id) {
+ Map<String, Object> map = new HashMap<>();
+ InsOrder insOrder = insOrderMapper.selectById(id);
+ List<SampleProductDto> list;
+ // 鍒ゆ柇鏄惁鏄繘鍘傛姤鍛婂厤妫�
+ if (insOrder.getIsExemption().equals(1)) {
+ list = insSampleMapper.selectExemptionByOrderId(id);
+ } else {
+ list = insSampleMapper.selectSampleProductListByOrderId2(id);
+ }
+ Map<String, Object> map1 = insSampleMapper.selectInsOrder(id);
+ List<InsSample> orderSamples = insSampleMapper.selectList(
+ Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, id)
+ .select(InsSample::getSampleCode)
+ .orderByAsc(InsSample::getId));
+ List<OrderTemplateSummaryVo> templateList = insOrderStandardTemplateMapper.selectList(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, id)
+ .orderByAsc(InsOrderStandardTemplate::getSort,
+ InsOrderStandardTemplate::getId))
+ .stream()
+ .map(template -> {
+ OrderTemplateSummaryVo summary = new OrderTemplateSummaryVo();
+ summary.setTemplateId(template.getTemplateId());
+ summary.setName(template.getName());
+ summary.setNumber(template.getNumber());
+ summary.setRemark(template.getRemark());
+ summary.setSort(template.getSort());
+ return summary;
+ })
+ .collect(Collectors.toList());
+ map.put("insOrder", insOrder);
+ map.put("sampleProduct", list);
+ // 鏍峰搧缂栧彿鐩存帴浠庢牱鍝佽〃璇诲彇锛屼笉渚濊禆妫�楠岄」鐩叧鑱旀煡璇㈡槸鍚︽湁缁撴灉銆�
+ map.put("sampleCode", orderSamples.isEmpty() ? null : orderSamples.get(0).getSampleCode());
+ map.put("insOrderTemplate", map1);
+ map.put("templateList", templateList);
+ return map;
+ }
+
+ /**
+ * 瀹℃牳妫�楠屽崟
+ * @param insOrder
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int upInsOrderOfState(InsOrder insOrder) {
+ insOrder.setExamineTime(LocalDateTime.now());
+ if (insOrder.getState() == 1) {
+ //濮旀墭缂栧彿宸插湪涓嬪崟鏃剁敓鎴愬苟鏍¢獙鍞竴鎬э紝瀹℃牳鏃跺鐢紱鍘嗗彶/瀛e害妫�楠岃鍗曞厹搴曠敓鎴愩��
+ InsOrder order = this.getById(insOrder.getId());
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, insOrder.getId())
+ .orderByAsc(InsSample::getId));
+ String no = order.getEntrustCode();
+ // 鍒ゆ柇鏄惁鏄搴︽楠�, 鏄搴︽楠屽彇娑堝師鏉愭枡瀛e害妫�楠屼笅鍗�
+ if (InsOrderTypeConstants.QUARTERLY_TEST.equals(order.getOrderType())) {
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())
+ .set(IfsInventoryQuantity::getIsQuarter, 0));
+
+ // 鏌ヨ鏄惁鏈夎繃杩涘巶妫�楠�, 鏈夎幏鍙栭噷闈㈢殑缂栧彿
+ InsOrder order1 = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getIfsInventoryId, order.getIfsInventoryId())
+ .ne(InsOrder::getState, -1)
+ .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY));
+ if (order1 != null) {
+ no = order1.getEntrustCode();
+ }
+ }
+ if (StringUtils.isBlank(no)) {
+ no = buildEntrustCode(order, insSamples);
+ }
+ assertEntrustCodeUnique(no, order.getId());
+
+ int count = 1;
+ for (InsSample insSample : insSamples) {
+ if (StringUtils.isBlank(insSample.getSampleCode())) {
+ // 濡傛灉鍙湁涓�涓牱鍝佸氨涓嶉渶瑕佹嫾鎺ユ暟瀛�
+ if (insSamples.size() != 1) {
+ insSample.setSampleCode(no + "-" + count);
+ count++;
+ } else {
+ insSample.setSampleCode(no);
+ }
+ }
+ }
+ insSampleService.updateBatchById(insSamples);
+
+ insOrder.setEntrustCode(no);
+ }
+ int updated = insOrderMapper.updateById(insOrder);
+ if (updated > 0 && Integer.valueOf(1).equals(insOrder.getState())) {
+ List<InsSample> samples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, insOrder.getId())
+ .orderByAsc(InsSample::getId));
+ if (samples.size() != 1) {
+ throw new ErrorException("濮旀墭鍗曞繀椤讳笖鍙兘鍖呭惈涓�涓牱鍝侊紝涓嶈兘杩涘叆鏍峰搧鎺ユ敹娴佺▼");
+ }
+ insSampleReceiptMapper.insertIgnore(insOrder.getId(), samples.get(0).getId());
+ }
+ return updated;
+ }
+
+ /**
+ * 濮旀墭缂栧彿鍏ㄥ眬鍞竴锛岀敓鎴愮紪鍙峰拰鍚庣画鎻愪氦鍓嶅潎闇�鎺掗櫎褰撳墠璁㈠崟鍚庢牎楠屻��
+ */
+ private void assertEntrustCodeUnique(String entrustCode, Integer currentOrderId) {
+ Long count = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getEntrustCode, entrustCode)
+ .ne(currentOrderId != null, InsOrder::getId, currentOrderId));
+ if (count > 0) {
+ throw new ErrorException("鏍峰搧/濮旀墭鍗曞凡瀛樺湪锛岃纭鏍峰搧缂栧彿");
+ }
+ }
+
+ /**
+ * 鐢熸垚濮旀墭缂栧彿锛氭柊鑱氱洿缁戞ā鏉胯鍗曟湯涓や綅鍙栨牱鍝佺紪鍙锋湯涓や綅锛屽叾浣欐寜閫佹牱鏃ユ湡鐢熸垚搴忓彿銆�
+ */
+ private String buildEntrustCode(InsOrder order, List<InsSample> insSamples) {
+ LocalDate entrustDate = order.getSampleDate() == null ? LocalDate.now() : order.getSampleDate();
+ String entrustCodePrefix = "LMSY-"
+ + entrustDate.format(DateTimeFormatter.BASIC_ISO_DATE)
+ + "-";
+ if (isDirectTemplateOrder(order, insSamples)) {
+ String sampleCode = insSamples.get(0).getSampleCode();
+ if (StringUtils.isBlank(sampleCode) || sampleCode.trim().length() < 2) {
+ throw new ErrorException("鏍峰搧缂栧彿涓嶈兘涓虹┖涓斾笉鑳藉皯浜�2浣�");
+ }
+ sampleCode = sampleCode.trim();
+ return entrustCodePrefix + sampleCode.substring(sampleCode.length() - 2);
+ }
+ return numberGenerator.generateNumberWithPrefix(2, entrustCodePrefix, InsOrder::getEntrustCode);
+ }
+
+ @Override
+ public Map<String, Object> getInsOrderAndSample(Integer id, String laboratory) {
+ Map<String, Object> map = new HashMap<>();
+// InsOrder insOrder = insOrderMapper.selectById(id);
+ IfsOrderVO ifsOrderVO = insOrderMapper.selectOrderInfoById(id);
+ Map<Integer, List<Integer>> templateDeviceIds = insOrderTemplateDeviceMapper.selectList(
+ Wrappers.<InsOrderTemplateDevice>lambdaQuery()
+ .eq(InsOrderTemplateDevice::getInsOrderId, id)
+ .orderByAsc(InsOrderTemplateDevice::getSort,
+ InsOrderTemplateDevice::getId))
+ .stream().collect(Collectors.groupingBy(
+ InsOrderTemplateDevice::getTemplateId,
+ LinkedHashMap::new,
+ Collectors.mapping(InsOrderTemplateDevice::getDeviceId, Collectors.toList())));
+ List<TemplateConditionVo> templateConditions = insOrderStandardTemplateMapper.selectList(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, id)
+ .select(InsOrderStandardTemplate::getTemplateId,
+ InsOrderStandardTemplate::getTemperature,
+ InsOrderStandardTemplate::getHumidity,
+ InsOrderStandardTemplate::getDetectionTime,
+ InsOrderStandardTemplate::getDetectionPlace,
+ InsOrderStandardTemplate::getInsResult)
+ .orderByAsc(InsOrderStandardTemplate::getSort,
+ InsOrderStandardTemplate::getId))
+ .stream().map(snapshot -> {
+ TemplateConditionVo condition = new TemplateConditionVo();
+ condition.setTemplateId(snapshot.getTemplateId());
+ condition.setTemperature(snapshot.getTemperature());
+ condition.setHumidity(snapshot.getHumidity());
+ condition.setDetectionTime(snapshot.getDetectionTime());
+ condition.setDetectionPlace(snapshot.getDetectionPlace());
+ condition.setInsResult(snapshot.getInsResult());
+ condition.setDeviceIds(templateDeviceIds.getOrDefault(
+ snapshot.getTemplateId(), Collections.emptyList()));
+ return condition;
+ }).collect(Collectors.toList());
+ ifsOrderVO.setTemplateConditions(templateConditions);
+ List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory);
+ map.put("insOrder", ifsOrderVO);
+ map.put("sampleProduct", list);
+ //鏌ヨ鎵�鏈夎褰曟ā鐗堝幓閲�
+ List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(id, laboratory);
+ map.put("reportModel", list2);
+ return map;
+ }
+
+ @Override
+ public IPage<SampleProductDto2> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, SampleProductDto2 sampleProductDto) {
+ IPage<SampleProductDto2> productDto2IPage = insOrderMapper.selectSampleAndProductByOrderId(page,
+ QueryWrappers.queryWrappers(sampleProductDto)
+ .orderByAsc("sample_code")
+ .orderByAsc("cable_tag")
+ .orderByAsc("sort"),
+ sampleProductDto.getId());
+ return productDto2IPage;
+ }
+
+
+ @Override
+ public int updateStatus(Integer id) {
+ return insOrderMapper.updateStatus(id);
+ }
+
+
+ /**
+ * 鑾峰彇ifs搴撳瓨淇℃伅
+ * @param
+ * @return
+ */
+ @Override
+ public void getIfsOrder(Map<String, Object> map,Boolean isSplitOrder) {
+ List<Map<String, Object>> inventory = ifsApiUtils.getInventory(JSONUtil.toJsonStr(map));
+ if(inventory.isEmpty()) {
+ return;
+ }
+ // 杩涜淇濆瓨
+ for (Map<String, Object> map1 : inventory) {
+ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // 鏃堕棿鏍煎紡鍖�
+ IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity();
+ ifsInventoryQuantity.setContract(map1.get("CONTRACT") == null ? "" : map1.get("CONTRACT").toString()); // 鍩�
+ ifsInventoryQuantity.setPartNo(map1.get("PART_NO") == null ? "" : map1.get("PART_NO").toString() ); // 闆朵欢鍙�
+ ifsInventoryQuantity.setPartDesc(map1.get("PART_DESC") == null ? "" : map1.get("PART_DESC").toString()); // 闆朵欢鎻忚堪
+ ifsInventoryQuantity.setOrderNo(map1.get("ORDER_NO") == null ? "" : map1.get("ORDER_NO").toString()); // 璁㈠崟鍙�
+ ifsInventoryQuantity.setLineNo(map1.get("LINE_NO") == null ? "" : map1.get("LINE_NO").toString()); // 琛屽彿
+ ifsInventoryQuantity.setReleaseNo(map1.get("RELEASE_NO") == null ? "" : map1.get("RELEASE_NO").toString()); // 涓嬭揪鍙�
+ ifsInventoryQuantity.setReceiptNo(Integer.parseInt(map1.get("RECEIPT_NO") == null ? "" : map1.get("RECEIPT_NO").toString())); // 鎺ユ敹鍙�
+ ifsInventoryQuantity.setStatus(map1.get("STATE") == null ? "" : map1.get("STATE").toString()); // 鐘舵�佹弿杩�
+ ifsInventoryQuantity.setStatusDb(map1.get("STATE_DB") == null ? "" : map1.get("STATE_DB").toString()); // 鐘舵��
+ if(map1.get("QTY_ARRIVED") != null) {
+ ifsInventoryQuantity.setQtyArrived(new BigDecimal(map1.get("QTY_ARRIVED").toString())); // 鎶佃揪鐨勯噰璐暟閲�
+ }
+ if(map1.get("QTY_INSPECTED") != null) {
+ ifsInventoryQuantity.setQtyInspected(new BigDecimal(map1.get("QTY_INSPECTED").toString())); // 宸叉楠岀殑璐拱鏁伴噺
+ }
+ if(map1.get("QTY_TO_INSPECT") != null) {
+ ifsInventoryQuantity.setQtyToInspect(new BigDecimal(map1.get("QTY_TO_INSPECT").toString())); // 瑕佹楠岀殑閲囪喘鏁伴噺
+ }
+ if(map1.get("INV_QTY_IN_STORE") != null) {
+ ifsInventoryQuantity.setInvQtyInStore(new BigDecimal(map1.get("INV_QTY_IN_STORE").toString())); // 鎶佃揪鐨勫簱瀛樻暟閲�
+ }
+ if(map1.get("PUR_QTY_IN_STORE") != null) {
+ ifsInventoryQuantity.setPurQtyInStore(new BigDecimal( map1.get("PUR_QTY_IN_STORE").toString())); // 鎶佃揪鐨勯噰璐暟閲�
+
+ }
+ ifsInventoryQuantity.setSupplierId(map1.get("SUPPLIER_ID") == null ? "" : map1.get("SUPPLIER_ID").toString()); // 渚涘簲鍟咺D
+ ifsInventoryQuantity.setSupplierName(map1.get("SUPPLIER_NAME") == null ? "" : map1.get("SUPPLIER_NAME").toString()); // 渚涘簲鍟嗗悕绉�
+ ifsInventoryQuantity.setConfigurationId(map1.get("CONFIGURATION_ID") == null ? "" : map1.get("CONFIGURATION_ID").toString()); // 閰嶇疆鏍囪瘑
+ ifsInventoryQuantity.setLotBatchNo(map1.get("LOT_BATCH_NO") == null ? "" : map1.get("LOT_BATCH_NO").toString()); // 鎵规鍙�
+ ifsInventoryQuantity.setUpdateBatchNo(map1.get("LOT_BATCH_NO") == null ? "" : map1.get("LOT_BATCH_NO").toString()); // 鎵规鍙�
+ ifsInventoryQuantity.setWaivDevRejNo(map1.get("WAIV_DEV_REJ_NO") == null ? "" : map1.get("WAIV_DEV_REJ_NO").toString()); // WDR鍙�
+ ifsInventoryQuantity.setActivitySeq(map1.get("ACTIVITY_SEQ") == null ? null : Integer.parseInt(map1.get("ACTIVITY_SEQ").toString())); // 娲诲姩搴忓垪
+ ifsInventoryQuantity.setSerialNo(map1.get("SERIAL_NO") == null ? "" : map1.get("SERIAL_NO").toString()); // 搴忓垪鍙�
+ ifsInventoryQuantity.setLocationNo(map1.get("LOCATION_NO") == null ? "" : map1.get("LOCATION_NO").toString()); // 搴撲綅鍙�
+ ifsInventoryQuantity.setEngChgLevel(map1.get("ENG_CHG_LEVEL") == null ? "" : map1.get("ENG_CHG_LEVEL").toString()); // 鐗堟湰鍙�
+ ifsInventoryQuantity.setReceiver(map1.get("RECEIVER") == null ? "" : map1.get("RECEIVER").toString()); // 鎺ユ敹浜�
+ ifsInventoryQuantity.setReceiverName(map1.get("RECEIVER_NAME") == null ? "" : map1.get("RECEIVER_NAME").toString()); // 鎺ユ敹浜哄悕绉�
+ ifsInventoryQuantity.setBuyerCode(map1.get("BUYER_CODE") == null ? "" : map1.get("BUYER_CODE").toString()); // 閲囪喘鍛�
+ ifsInventoryQuantity.setBuyerName(map1.get("BUYER_NAME") == null ? "" : map1.get("BUYER_NAME").toString()); // 閲囪喘鍛樺悕绉�
+
+ if(map1.get("ARRIVE_DATE") != null) {
+ ifsInventoryQuantity.setArriveDate(LocalDateTime.parse(map1.get("ARRIVE_DATE").toString(),dateTimeFormatter)); // 瀹為檯鍒拌揣鏃ユ湡
+ }
+ if(map1.get("DELIVERY_DATE") != null) {
+ ifsInventoryQuantity.setDeliveryDate(LocalDateTime.parse(map1.get("DELIVERY_DATE").toString(),dateTimeFormatter)); // 瀹為檯浜よ揣鏃ユ湡
+ }
+ if(map1.get("PRODUCT_DATE") != null) {
+ ifsInventoryQuantity.setProductDate(LocalDateTime.parse(map1.get("PRODUCT_DATE").toString(),dateTimeFormatter)); // 鐢熶骇鏃ユ湡
+
+ }
+ if(map1.get("INVALID_DATE") != null) {
+ ifsInventoryQuantity.setInvalidDate(LocalDateTime.parse(map1.get("INVALID_DATE").toString(),dateTimeFormatter)); // 澶辨晥鏃ユ湡
+ }
+ if(map1.get("APPROVED_DATE") != null) {
+ ifsInventoryQuantity.setApprovedDate(LocalDateTime.parse(map1.get("APPROVED_DATE").toString(),dateTimeFormatter)); // 瀹℃壒鏃ユ湡
+ }
+ ifsInventoryQuantity.setReqCeater(map1.get("REQ_CEATER") == null ? "" : map1.get("REQ_CEATER").toString()); // 閲囪喘鐢宠鍒涘缓浜�
+ ifsInventoryQuantity.setReqCeaterName(map1.get("REQ_CEATER_NAME") == null ? "" : map1.get("REQ_CEATER_NAME").toString()); // 閲囪喘鐢宠鍒涘缓浜哄悕绉�
+ ifsInventoryQuantity.setLineRemarks(map1.get("LINE_REMARKS") == null ? "" : map1.get("LINE_REMARKS").toString()); // 閲囪喘璁㈠崟琛屽娉�
+ ifsInventoryQuantity.setBuyUnitMeas(map1.get("BUY_UNIT_MEAS") == null ? "" : map1.get("BUY_UNIT_MEAS").toString()); // 閲囪喘鍗曚綅
+ ifsInventoryQuantity.setReceiverDate(LocalDateTime.now()); // 鎺ユ敹鏃ユ湡
+ ifsInventoryQuantity.setIsSource(1);
+ ifsInventoryQuantity.setState(0);
+
+ Long count = ifsInventoryQuantityMapper.selectCount(new LambdaQueryWrapper<IfsInventoryQuantity>()
+ .eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo())
+ .eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo())
+ .eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo())
+ .eq(IfsInventoryQuantity::getReceiptNo, ifsInventoryQuantity.getReceiptNo())
+ .eq(IfsInventoryQuantity::getLocationNo, ifsInventoryQuantity.getLocationNo())
+ .eq(IfsInventoryQuantity::getLotBatchNo, ifsInventoryQuantity.getLotBatchNo())
+ .eq(IfsInventoryQuantity::getSerialNo, ifsInventoryQuantity.getSerialNo())
+ .eq(IfsInventoryQuantity::getEngChgLevel, ifsInventoryQuantity.getEngChgLevel())
+ .eq(IfsInventoryQuantity::getWaivDevRejNo, ifsInventoryQuantity.getWaivDevRejNo())
+ .eq(IfsInventoryQuantity::getActivitySeq, ifsInventoryQuantity.getActivitySeq())
+ );
+ if(count == 0) {
+ ifsInventoryQuantity.setIsFirst(0);
+ if(isSplitOrder){
+ ifsInventoryQuantity.setIsSplitOrder(1);
+ }
+ ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
+ }
+ }
+ }
+
+ /**
+ * id鏄師鏉愭枡鐨刬d
+ *
+ * 淇敼璁㈠崟鍗曞彿
+ * @param insOrder
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void updateEntrustCode(InsOrder insOrder) {
+ // 鍒ゆ柇褰撳墠璁㈠崟鏄惁鐢熸垚浜嗘姤鍛�, 鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀瑰崟鍙�
+ List<InsOrder> insOrders = insOrderMapper.selectList(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getIfsInventoryId, insOrder.getId())
+ .ne(InsOrder::getState, -1));
+ List<Integer> insOrderIds = insOrders.stream().map(InsOrder::getId).collect(Collectors.toList());
+ Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery()
+ .in(InsReport::getInsOrderId, insOrderIds));
+ if (count > 0 ) {
+ throw new ErrorException("褰撳墠璁㈠崟宸茬粡鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀圭紪鍙�");
+ }
+
+
+ Long count1 = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getEntrustCode, insOrder.getEntrustCode())
+ .ne(InsOrder::getIfsInventoryId, insOrder.getId())
+ .ne(InsOrder::getInsState, -1));
+ if (count1 > 0) {
+ throw new ErrorException("璇ョ紪鍙烽噸澶�");
+ }
+
+ //淇敼鎶ュ憡鐨勭紪鍙�
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getIfsInventoryId, insOrder.getId())
+ .set(InsOrder::getEntrustCode, insOrder.getEntrustCode()));
+
+ // 淇敼鏍峰搧鐨勭紪鍙�
+ // 鏌ヨ鎵�鏈夌殑鏍峰搧
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .in(InsSample::getInsOrderId, insOrderIds));
+ for (InsSample insSample : insSamples) {
+ String sampleCode = insSample.getSampleCode();
+ String updateCode = insOrder.getEntrustCode();
+ // 鏌ユ壘鏈�鍚庝竴涓�'-'鐨勪綅缃�
+ int lastDashIndex = sampleCode.lastIndexOf('-');
+ if (lastDashIndex != -1) {
+ int secondLastDashIndex = sampleCode.lastIndexOf('-', lastDashIndex - 1);
+ // 澶勭悊鏈�鍚庝竴涓�'-'鍓嶇殑閮ㄥ垎
+ if (secondLastDashIndex != -1) {
+ // 澶勭悊鏈�鍚庝竴涓�'-'鍙婁箣鍚庣殑閮ㄥ垎
+ String afterLastDash = sampleCode.substring(lastDashIndex);
+
+ updateCode = updateCode + afterLastDash;
+ }
+ }
+ insSampleMapper.update(null, Wrappers.<InsSample>lambdaUpdate()
+ .eq(InsSample::getId, insSample.getId())
+ .set(InsSample::getSampleCode, updateCode));
+
+ }
+ }
+
+ @Override
+ public List<InsUnqualifiedRetestProduct> getRetestResult(Integer insProductId) {
+ return insUnqualifiedRetestProductMapper.selectList(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery()
+ .eq(InsUnqualifiedRetestProduct::getInsProductId, insProductId));
+ }
+
+ /**
+ * 淇敼閲囪喘璁㈠崟鎺ユ敹鐘舵��, 閬垮厤鍥炴粴
+ * @param id
+ */
+ @Transactional
+ public void updateIfsInventoryQuantity(Long id) {
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .set(IfsInventoryQuantity::getIsRegister, 1)
+ .eq(IfsInventoryQuantity::getId, id));
+ }
+
+ /**
+ * 鏂板閾滃崟涓濅笅鍗�
+ * @param list
+ * @param insOrder
+ * @return
+ */
+ @Override
+ public int addRawCopperOrder(List<SampleProductDto> list, CopperInsOrderDto insOrder) {
+ insOrder.setState(1);
+ insOrder.setTypeSource(1);
+
+ LocalDate appointed = insOrder.getAppointed();
+
+ insOrderMapper.insert(insOrder); // 涓昏〃
+
+ list.forEach(a -> {
+ a.setId(null);
+ a.setInsOrderId(insOrder.getId());
+ insSampleMapper.insert(a);
+ if (ObjectUtil.isNotEmpty(a.getInsProduct())) {
+ // 鍒ゆ柇鏄惁濉啓寰呮椤规暟閲�
+ if (a.getQuantity() != null) {
+ List<InsProduct> ip2 = new ArrayList<>();
+ for (Integer i = 1; i <= a.getQuantity(); i++) {
+ // 閲嶆柊鎷疯礉 鍒涘缓鏂板璞�
+ AtomicInteger atomicInteger = new AtomicInteger(i);
+ List<InsProduct> insProducts = a.getInsProduct().stream().map(insProduct -> {
+ insProduct.setRawMaterialTag(String.valueOf(atomicInteger.get()));
+ InsProduct product = new InsProduct();
+ BeanUtils.copyProperties(insProduct, product);
+ return product;
+ }).collect(Collectors.toList());
+
+ ip2.addAll(insProducts);
+ }
+ addInsProductMethod(a.getId(), ip2);
+ } else {
+ addInsProductMethod(a.getId(), a.getInsProduct());
+ }
+ }
+ if (ObjectUtil.isNotEmpty(a.getChildSampleList())) {
+ for (SampleProductDto b : a.getChildSampleList()) {
+ for (int i = 0; i < b.getNum(); i++) {
+ b.setId(null);
+ b.setInsOrderId(insOrder.getId());
+ b.setParentId(a.getId());
+ insSampleMapper.insert(b);
+ if (ObjectUtil.isNotEmpty(b.getInsProduct())) {
+ addInsProductMethod(b.getId(), b.getInsProduct());
+ }
+ }
+ }
+ }
+ });
+
+ // 娣诲姞鍘熸潗鏂欎俊鎭�
+ IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity();
+ // 鍩烘湰淇℃伅
+ ifsInventoryQuantity.setIsSource(0);
+ ifsInventoryQuantity.setIsInspect(1);
+ ifsInventoryQuantity.setState(1);
+ ifsInventoryQuantity.setIsFinish(0);
+ ifsInventoryQuantity.setIsCopper(1);
+ ifsInventoryQuantity.setIsQuarter(0);
+ ifsInventoryQuantity.setInspectStatus(0);
+ //閾滄潗鏂欎笅鍗曢粯璁ゅ��
+ ifsInventoryQuantity.setOrderType(OrderType.RAW.getValue());
+ ifsInventoryQuantity.setMaterialProp("01Cu");
+
+ ifsInventoryQuantity.setQtyArrived(insOrder.getQtyArrived());
+ ifsInventoryQuantity.setBuyUnitMeas(insOrder.getBuyUnitMeas());
+ ifsInventoryQuantity.setSupplierName(insOrder.getSupplierName());
+ ifsInventoryQuantity.setUpdateBatchNo(insOrder.getUpdateBatchNo());
+ ifsInventoryQuantity.setDeclareDate(insOrder.getDeclareDate());
+
+ ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
+
+ insOrder.setIfsInventoryId(ifsInventoryQuantity.getId());
+ insOrder.setState(1);
+
+ upInsOrderOfState(insOrder);
+ // 瀹℃牳閫氳繃鍚庝粎杩涘叆鏍峰搧鎺ユ敹锛涚敱鏍峰搧鎺ユ敹椤甸潰閫夋嫨涓绘楠屼汉鍚庡啀鍒涘缓妫�楠屼换鍔°��
+
+ return insOrder.getId();
+ }
+
+ /**
+ * 淇敼濮旀墭涓嬪崟缂栧彿
+ * @param insOrder
+ */
+ @Override
+ public void updateOrderEntrustCode(InsOrder insOrder) {
+ // 鍒ゆ柇褰撳墠璁㈠崟鏄惁鐢熸垚浜嗘姤鍛�, 鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀瑰崟鍙�
+ Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getInsOrderId, insOrder.getId()));
+ if (count > 0 ) {
+ throw new ErrorException("褰撳墠璁㈠崟宸茬粡鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀圭紪鍙�");
+ }
+
+ Long count1 = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getEntrustCode, insOrder.getEntrustCode()));
+ if (count1 > 0) {
+ throw new ErrorException("璇ョ紪鍙烽噸澶�");
+ }
+
+ //淇敼鎶ュ憡鐨勭紪鍙�
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, insOrder.getId())
+ .set(InsOrder::getEntrustCode, insOrder.getEntrustCode()));
+
+ // 淇敼鏍峰搧鐨勭紪鍙�
+ // 鏌ヨ鎵�鏈夌殑鏍峰搧
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, insOrder.getId()));
+ for (InsSample insSample : insSamples) {
+ String sampleCode = insSample.getSampleCode();
+ String updateCode = insOrder.getEntrustCode();
+ // 鏌ユ壘鏈�鍚庝竴涓�'-'鐨勪綅缃�
+ int lastDashIndex = sampleCode.lastIndexOf('-');
+ if (lastDashIndex != -1) {
+ int secondLastDashIndex = sampleCode.lastIndexOf('-', lastDashIndex - 1);
+ // 澶勭悊鏈�鍚庝竴涓�'-'鍓嶇殑閮ㄥ垎
+ if (secondLastDashIndex != -1) {
+ // 澶勭悊鏈�鍚庝竴涓�'-'鍙婁箣鍚庣殑閮ㄥ垎
+ String afterLastDash = sampleCode.substring(lastDashIndex);
+
+ updateCode = updateCode + afterLastDash;
+ }
+ }
+ insSampleMapper.update(null, Wrappers.<InsSample>lambdaUpdate()
+ .eq(InsSample::getId, insSample.getId())
+ .set(InsSample::getSampleCode, updateCode));
+
+ }
+ }
+
+ /**
+ * 淇敼妫�楠屼笅鍗曞唴瀹�
+ * @param insOrderUpdateDto
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean updateInsOrder(InsOrderUpdateDto insOrderUpdateDto) {
+ InsOrder currentOrder = insOrderMapper.selectById(insOrderUpdateDto.getInsOrder().getId());
+ if (currentOrder == null || !Objects.equals(currentOrder.getState(), 2)) {
+ throw new ErrorException("鍙湁閫�鍥炵殑妫�楠屽崟鍙互淇敼");
+ }
+ boolean hasSelectedProduct = CollectionUtils.isNotEmpty(insOrderUpdateDto.getSampleProduct())
+ && insOrderUpdateDto.getSampleProduct().stream()
+ .filter(sample -> CollectionUtils.isNotEmpty(sample.getInsProduct()))
+ .flatMap(sample -> sample.getInsProduct().stream())
+ .anyMatch(product -> Objects.equals(product.getState(), 1));
+ if (!hasSelectedProduct) {
+ throw new ErrorException("璇疯嚦灏戦�夋嫨涓�涓楠岄」");
+ }
+
+ // 淇敼璁㈠崟
+ insOrderUpdateDto.getInsOrder().setState(0);
+ insOrderUpdateDto.getInsOrder().setTell("");
+ insOrderMapper.updateById(insOrderUpdateDto.getInsOrder());
+
+ // 淇敼妫�楠岄」
+ for (SampleProductDto sampleProductDto : insOrderUpdateDto.getSampleProduct()) {
+ Long sampleCount = insSampleMapper.selectCount(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getId, sampleProductDto.getId())
+ .eq(InsSample::getInsOrderId, insOrderUpdateDto.getInsOrder().getId()));
+ if (sampleCount == 0) {
+ throw new ErrorException("妫�楠屾牱鍝佹暟鎹紓甯�");
+ }
+
+ insSampleService.update(Wrappers.<InsSample>lambdaUpdate()
+ .eq(InsSample::getId, sampleProductDto.getId())
+ .set(InsSample::getSpecialStandardMethod, sampleProductDto.getSpecialStandardMethod()));
+
+ List<InsProduct> products = sampleProductDto.getInsProduct();
+ if (CollectionUtils.isEmpty(products)) {
+ continue;
+ }
+
+ Set<Integer> productIds = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, sampleProductDto.getId()))
+ .stream()
+ .map(InsProduct::getId)
+ .collect(Collectors.toSet());
+ if (products.stream().anyMatch(product -> product.getId() != null && !productIds.contains(product.getId()))) {
+ throw new ErrorException("妫�楠岄」鏁版嵁寮傚父");
+ }
+
+ List<Integer> removedIds = products.stream()
+ .filter(product -> product.getId() != null && !Objects.equals(product.getState(), 1))
+ .map(InsProduct::getId)
+ .collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(removedIds)) {
+ insProductService.removeByIds(removedIds);
+ }
+
+ List<InsProduct> existingProducts = products.stream()
+ .filter(product -> product.getId() != null && Objects.equals(product.getState(), 1))
+ .collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(existingProducts)) {
+ insProductService.updateBatchById(existingProducts);
+ }
+
+ List<InsProduct> newProducts = products.stream()
+ .filter(product -> product.getId() == null && Objects.equals(product.getState(), 1))
+ .collect(Collectors.toList());
+ addInsProductMethod(sampleProductDto.getId(), newProducts);
+ }
+
+ return true;
+ }
+
+ /**
+ * 鎴愬搧鏍囩鎵撳嵃
+ * @param ids
+ * @return
+ */
+ @Override
+ public List<InsOrderPrintingVo> labelOrderPrinting(List<Integer> ids) {
+ return insOrderMapper.labelOrderPrinting(ids);
+ }
+
+ @Override
+ public List<InventoryDetailDTO> labelOutsideOrderPrinting(List<Integer> ids) {
+ return insOrderMapper.labelOutsideOrderPrinting(ids);
+ }
+
+ /**
+ * 鏍规嵁鏍峰搧id鏌ヨ妫�楠岄」鏍�
+ * @param insSampleId
+ * @return
+ */
+ @Override
+ public List<StandardProductList> getProductTreeBySampleId(Integer insSampleId) {
+ // 鏌ヨ绗竴涓楠岄」鑾峰彇妫�楠岄」鏍�
+ InsProduct insProduct = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, insSampleId)
+ .last("limit 1"));
+ String tree;
+ if (insProduct.getSampleType() == null && insProduct.getModel() == null
+ && StringUtils.isNotBlank(insProduct.getLaboratory())
+ && StringUtils.isNotBlank(insProduct.getSample())) {
+ tree = StandardTreePathParser.canonical(insProduct.getLaboratory(), insProduct.getSample());
+ } else {
+ tree = insProduct.getFactory() + " - " +
+ insProduct.getLaboratory() + " - " +
+ insProduct.getSampleType() + " - " +
+ insProduct.getSample() + " - " +
+ insProduct.getModel();
+ }
+ // 鏌ヨ鏍囧噯鏍�
+ List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
+ .eq(StandardProductList::getStandardMethodListId, insProduct.getStandardMethodListId())
+ .eq(StandardProductList::getTree, tree)
+ .orderByAsc(StandardProductList::getSort));
+ for (StandardProductList standardProductList : standardProductLists) {
+ standardProductList.setId(null);
+ }
+
+ return standardProductLists;
+ }
+
+ /**
+ * 娣诲姞閬楁紡鐨勬楠岄」
+ * @param omitOrderProductDto
+ * @return
+ */
+ @Override
+ public boolean addOmitOrderProduct(OmitOrderProductDto omitOrderProductDto) {
+ if (omitOrderProductDto.getInsSampleId() == null) {
+ throw new ErrorException("缂哄皯鏍峰搧Id");
+ }
+ for (InsProduct product : omitOrderProductDto.getInsProductBindingList()) {
+ if (product.getState() == 1) {
+ product.setId(null);
+ product.setCreateTime(null);
+ product.setCreateUser(null);
+ product.setUpdateTime(null);
+ product.setUpdateUser(null);
+ product.setSection(null);
+ product.setInsSampleId(omitOrderProductDto.getInsSampleId());
+ if (StringUtils.isBlank(product.getCableTag())) {
+ product.setCableTag(null);
+ }
+ if (product.getInspectionItemSubclass() == null) {
+ product.setInspectionItemSubclass("");
+ }
+ if (StringUtils.isBlank(product.getAsk()) || StringUtils.isBlank(product.getTell())) {
+ throw new ErrorException("鏈夋楠岄」鐨勮姹傚�兼垨瑕佹眰鎻忚堪涓虹┖, 璇峰~鍐欒姹傚�兼垨瑕佹眰鎻忚堪");
+ }
+ insProductMapper.insert(product);
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * 鎴愬搧妫�楠屽崟瀵煎嚭
+ * @param sampleOrderDto
+ * @param response
+ */
+ @Override
+ public void rawAllInsOrderExport(SampleOrderDto sampleOrderDto, HttpServletResponse response) {
+ List<SampleOrderDto> sampleOrderDtoList = new ArrayList<>();
+ if (StringUtils.isNotBlank(sampleOrderDto.getIds())) {
+ List<String> orderIds = StrUtil.split(sampleOrderDto.getIds(), ",");
+ sampleOrderDtoList = insOrderMapper.getInsOrderExportByIds(orderIds);
+ } else {
+ String laboratory = null;
+ // 鍒ゆ柇鏄惁鏄叏閮�
+ String isOrderAll = null;
+ if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) {
+ isOrderAll = "1";
+ sampleOrderDto.setState(null);
+ }
+ sampleOrderDto.setIds(null);
+ sampleOrderDtoList = insOrderMapper.rawAllInsOrderExport(QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll);
+ }
+
+ // 鍒ゆ柇鏄惁鏄笉鍚堟牸, 涓嶅悎鏍兼煡璇笉鍚堟牸椤�
+ for (SampleOrderDto orderDto : sampleOrderDtoList) {
+ if (orderDto.getInsResult() != null && orderDto.getInsResult() == 0){
+ // 鏌ヨ涓嶅悎鏍奸」
+ List<String> unqualifiedList = insProductMapper.selectUnqualifiedList(orderDto.getId());
+ orderDto.setUnqualifiedItem(CollUtil.join(unqualifiedList, ","));
+ }
+ orderDto.setCreateTimeString(orderDto.getCreateTime() == null ? "" : orderDto.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+
+ }
+
+ response.setContentType("application/vnd.ms-excel");
+ response.setCharacterEncoding("UTF-8");
+ try {
+ // 杩欓噷URLEncoder.encode鍙互闃叉涓枃涔辩爜 褰撶劧鍜宔asyexcel娌℃湁鍏崇郴
+ String fileName = URLEncoder.encode("濮旀墭妫�娴嬩俊鎭鍑�", "UTF-8");
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+ //鏂板缓ExcelWriter
+ ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build();
+ //鑾峰彇sheet0瀵硅薄
+ WriteSheet mainSheet = EasyExcel.writerSheet(0, "濮旀墭妫�娴嬩俊鎭鍑�").head(SampleOrderDto.class).build();
+
+ //鍚憇heet0鍐欏叆鏁版嵁 浼犲叆绌簂ist杩欐牱鍙鍑鸿〃澶�
+ excelWriter.write(sampleOrderDtoList, mainSheet);
+ //鍏抽棴娴�
+ excelWriter.finish();
+ } catch (IOException e) {
+ throw new RuntimeException("瀵煎嚭澶辫触");
+ }
+ }
+
+ /**
+ * 淇敼鏍峰搧鍨嬪彿
+ * @param insSample
+ */
+ @Override
+ public void updateSampleModel(InsSample insSample) {
+ // 鍒ゆ柇褰撳墠璁㈠崟鏄惁鐢熸垚浜嗘姤鍛�, 鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀瑰崟鍙�
+ Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getInsOrderId, insSample.getInsOrderId()));
+ if (count > 0 ) {
+ throw new ErrorException("褰撳墠璁㈠崟宸茬粡鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀圭紪鍙�");
+ }
+
+ insSampleService.update(Wrappers.<InsSample>lambdaUpdate()
+ .eq(InsSample::getId, insSample.getId())
+ .set(InsSample::getModel, insSample.getModel()));
+ }
+
+ /**
+ * 鏌ヨ褰撳墠鏃堕棿鏄惁娌℃湁璇ユ娴嬮」鐨勬娊鏍疯鍒�
+ * @param sampleList
+ * @param insOrder
+ * @return
+ */
+ @Override
+ public Result judgeNotSpotCheckOrder(List<SampleProductDto> sampleList, InsOrder insOrder) {
+ // todo: 涓嬪崟鍒ゆ柇鎶芥牱璁″垝鐨勫敮涓�鎬�
+ if (insOrder.getQuarterItemId() != null) {
+ Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId())
+ .notIn(InsOrder::getState, -1 ,2 ,3));
+ if (quarterItemCount > 0) {
+ throw new ErrorException("璇ユ娊鏍疯鍒掑凡琚粦瀹氳繃");
+ }
+ }
+
+ // 鍒ゆ柇鏄惁鏄娊鏍锋娴�
+ if (insOrder.getOrderType().equals(InsOrderTypeConstants.SPOT_CHECK)) {
+ Set<String> monthMessageSet = new HashSet<>();
+ Set<String> quarterMessageSet = new HashSet<>();
+ Set<String> yearMessageSet = new HashSet<>();
+
+ String formatTime = "yyyy-MM-dd HH:mm:ss";
+ // 鏌ヨ褰撳墠鎵�鏈夋牱鍝佺殑妫�楠岄」
+ for (SampleProductDto sampleProductDto : sampleList) {
+ List<StandardProductList> standardProductList = getProductTreeBySampleId(sampleProductDto.getId());
+
+ Set<Integer> insIds = sampleProductDto.getInsProduct().stream()
+ .map(InsProduct::getStructureItemParameterId)
+ .collect(Collectors.toSet());
+
+ List<StandardProductList> productLists = standardProductList.stream()
+ .filter(product -> !insIds.contains(product.getStructureItemParameterId()))
+ .collect(Collectors.toList());
+
+ // 鏌ヨ妫�楠岄」鍩虹琛�, 鏌ヨ鏄惁鏈夋湀搴�, 瀛e害, 骞村害鐨勬楠岄」
+ List<StructureItemParameter> itemParameterList = structureItemParameterMapper.selectList(Wrappers.<StructureItemParameter>lambdaQuery()
+ .in(StructureItemParameter::getId, productLists.stream().map(StandardProductList::getStructureItemParameterId).collect(Collectors.toList())));
+
+ for (StructureItemParameter item : itemParameterList) {
+ if (StringUtils.isNotBlank(item.getSpotCheckType())) {
+ switch (item.getSpotCheckType()) {
+ case "1": // 鏈堝害
+ // 鏌ヨ褰撴湀鏄惁鏈夎妫�娴嬮」鐨勬娊鏍疯鍒�
+ // 褰撴湀寮�濮嬫椂闂�
+ DateTime monthStart = DateUtil.beginOfMonth(DateUtil.date());
+ String monthStartTime = monthStart.toString(formatTime);
+ // 褰撴湀缁撴潫鏃堕棿
+ DateTime monthEnd = DateUtil.endOfMonth(DateUtil.date());
+ String monthEndTime = monthEnd.toString(formatTime);
+ Integer count = insOrderMapper.selectNotSpotCheckOrder(item.getId(), monthStartTime, monthEndTime);
+ if (count == 0) {
+ String monthMessage = item.getInspectionItemClass() +
+ item.getInspectionItem() +
+ item.getInspectionItemSubclass();
+ monthMessageSet.add(monthMessage);
+ }
+ break;
+ case "2": // 瀛e害
+ DateTime quarterStart = DateUtil.beginOfQuarter(DateUtil.date());
+ String quarterStartTime = quarterStart.toString(formatTime);
+ // 褰撴湀缁撴潫鏃堕棿
+ DateTime quarterEnd = DateUtil.endOfQuarter(DateUtil.date());
+ String quarterEndTime = quarterEnd.toString(formatTime);
+ Integer quarterCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), quarterStartTime, quarterEndTime);
+ if (quarterCount == 0) {
+ String quarterMessage = item.getInspectionItemClass() +
+ item.getInspectionItem() +
+ item.getInspectionItemSubclass();
+ quarterMessageSet.add(quarterMessage);
+ }
+
+ break;
+ case "3": // 骞村害
+ DateTime yearStart = DateUtil.beginOfQuarter(DateUtil.date());
+ String yearStartTime = yearStart.toString(formatTime);
+ // 褰撴湀缁撴潫鏃堕棿
+ DateTime yearEnd = DateUtil.endOfQuarter(DateUtil.date());
+ String yearEndTime = yearEnd.toString(formatTime);
+ Integer yearCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), yearStartTime, yearEndTime);
+ if (yearCount == 0) {
+ String yearMessage = item.getInspectionItemClass() +
+ item.getInspectionItem() +
+ item.getInspectionItemSubclass();
+ yearMessageSet.add(yearMessage);
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ String message = "";
+ if (CollectionUtils.isNotEmpty(monthMessageSet)) {
+ message += StrUtil.format("<p>妫�楠岄」<span style=\"color: red\">{}</span>褰撴湀杩樻湭杩涜鎶芥牱妫�娴�, 璇锋煡鐪嬫槸鍚﹂渶瑕佹坊鍔犲綋鍓嶆楠岄」</p>", CollUtil.join(monthMessageSet, ", "));
+ }
+
+ if (CollectionUtils.isNotEmpty(quarterMessageSet)) {
+ message += StrUtil.format("<p>妫�楠岄」<span style=\"color: red\">{}</span>褰撳墠瀛e害杩樻湭杩涜鎶芥牱妫�娴�, 璇风湅鏄惁闇�瑕佹坊鍔犲綋鍓嶆楠岄」</p>", CollUtil.join(quarterMessageSet, ", "));
+ }
+
+ if (CollectionUtils.isNotEmpty(yearMessageSet)) {
+ message += StrUtil.format("<p>妫�楠岄」<span style=\"color: red\">{}</span>浠婂勾杩樻湭杩涜鎶芥牱妫�娴�, 璇风湅鏄惁闇�瑕佹坊鍔犲綋鍓嶆楠岄」</p>", CollUtil.join(yearMessageSet, ", "));
+ }
+
+ if (StringUtils.isNotBlank(message)) {
+ return Result.success(false, message);
+ }
+ }
+ return Result.success(true);
+
+ }
+
+ /**
+ * ifs绉诲簱鎿嶄綔
+ * @param inventoryQuantity
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
+ public String moveRawMaterial(IfsInventoryQuantity inventoryQuantity) {
+ //鏌ヨifs璁㈠崟璇︽儏
+ IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectById(inventoryQuantity.getId());
+ String toLocation;
+ // 鐧昏閲囪喘妫�楠岀粨鏋淪TD
+ if (one.getIsRegister().equals(0)) {
+ Map<String, Object> resultMap = new HashMap<>();
+ List<Map<String, Object>> resultList = new ArrayList<>();
+ Map<String, Object> map = new HashMap<>();
+ map.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ map.put("LINE_NO", one.getLineNo()); // 琛屽彿
+ map.put("RELEASE_NO", one.getReleaseNo()); // 涓嬭揪鍙�
+ map.put("RECEIPT_NO", one.getReceiptNo()); // 鎺ユ敹鍙�
+ map.put("PURCH_QTY", one.getQtyToInspect()); // 瑕佹楠岀殑閲囪喘鏁伴噺
+ resultList.add(map);
+ resultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ resultMap.put("SYSCODE", "LIMS");
+ resultMap.put("SYSMODEL", "鐧昏閲囪喘妫�楠岀粨鏋�");
+ resultMap.put("BATCH_INFO", resultList);
+ Result result = ifsApiUtils.getProcurementResults(JSONUtil.toJsonStr(resultMap));
+ if (result.getCode() != 200) {
+ throw new ErrorException("IFS鐧昏閲囪喘妫�楠岀粨鏋滃け璐�: " + result.getMsg());
+ }
+ //濡傛灉鏄媶鍒嗚鍗曪紝鍒欏皢鍚屼竴鎺ユ敹鍙风殑璁㈠崟鏍囪宸茬櫥璁版牎楠�
+ if(one.getIsSplitOrder()==1){
+ //鏌ヨ鍏朵綑鎷嗗垎鐨勮鍗�
+ List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+ .eq(IfsInventoryQuantity::getOrderNo, one.getOrderNo())
+ .eq(IfsInventoryQuantity::getPartNo, one.getPartNo())
+ .eq(IfsInventoryQuantity::getLineNo, one.getLineNo())
+ .eq(IfsInventoryQuantity::getReleaseNo, one.getReleaseNo())
+ .eq(IfsInventoryQuantity::getReceiptNo, one.getReceiptNo())
+ .eq(IfsInventoryQuantity::getIsSplitOrder, 1)
+ );
+ if(Objects.nonNull(quantityList) && !quantityList.isEmpty()){
+ //淇敼閲囪喘璁㈠崟鐧昏鐘舵��
+ List<Long> ids = quantityList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList());
+ ifsInventoryQuantityMapper.update(null,Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .set(IfsInventoryQuantity::getIsRegister,1)
+ .in(IfsInventoryQuantity::getId, ids)
+ );
+ }
+ }else{
+ this.updateIfsInventoryQuantity(one.getId());
+ }
+ }
+ /**
+ * TODO 鍚庣画闇�瑕佽皟鐢↖FS鐨勬帴鍙� 绉诲叆鐨勫簱浣嶅彿 toLocation
+ */
+ // 妫�楠屽悗绉诲簱
+ //1301:鍘熸潗鏂欏悎鏍煎簱锛孋P-02-001:鎴愬搧搴�
+ if(StringUtils.equals(inventoryQuantity.getOrderType(), OrderType.RAW.getValue())){
+ toLocation = "1301";
+ }else if(StringUtils.equals(inventoryQuantity.getOrderType(), OrderType.WG.getValue())){
+ toLocation = "CP-02-001";
+ }else{
+ toLocation = "1301";
+ }
+ Map<String, Object> moveResultMap = new HashMap<>();
+ List<Map<String, Object>> moveResultList = new ArrayList<>();
+ Map<String, Object> moveMap = new HashMap<>();
+ moveMap.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ moveMap.put("LINE_NO", one.getLineNo());
+ moveMap.put("RELEASE_NO", one.getReleaseNo());
+ moveMap.put("RECEIPT_NO", one.getReceiptNo());
+ moveMap.put("PART_NO", one.getPartNo());
+ moveMap.put("QTY", one.getPurQtyInStore());
+ moveMap.put("LOCATION_NO", one.getLocationNo());
+ moveMap.put("TO_LOCATION_NO", toLocation);
+ moveMap.put("LOT_BATCH_NO", one.getLotBatchNo());
+ moveMap.put("SERIAL_NO", one.getSerialNo());
+ moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo());
+ moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel());
+ moveMap.put("ACTIVITY_SEQ", one.getActivitySeq());
+ moveResultList.add(moveMap);
+ moveResultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ moveResultMap.put("SYSCODE", "LIMS");
+ moveResultMap.put("SYSMODEL", "妫�楠屽悗绉诲簱");
+ moveResultMap.put("BATCH_INFO", moveResultList);
+
+ Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap));
+ // 濡傛灉鏈夊繀椤讳负闆朵欢鎸囧畾鎵瑰彿鎶ラ敊闇�瑕侀噸鏂版彁浜ょЩ搴撲俊鎭幓鎸囧畾鎵瑰彿
+ if (result1.getCode() != 200) {
+ String message = result1.getMsg();
+ if (message.contains("蹇呴』涓洪浂浠�") && message.contains("鎸囧畾鎵瑰彿")) {
+ updaeBatch(one, toLocation);
+ } else {
+ throw new ErrorException("IFS妫�楠屽悗绉诲簱澶辫触: " + result1.getMsg());
+ }
+ }
+ return toLocation;
+ }
+
+
+ /**
+ * 鍏堜慨鏀归噰璐鍗曟壒娆″彿, 鍚庤繘琛岀Щ搴撴搷浣�
+ * @param one
+ * @param toLocation
+ */
+ private void updaeBatch(IfsInventoryQuantity one, String toLocation) {
+ if (one.getIsUpdateBatch().equals(0)) {
+ // 鍏堜慨鏀规壒娆″彿鍚庤繘琛岀Щ搴�
+ Map<String, Object> resultMap = new HashMap<>();
+ List<Map<String, Object>> resultList = new ArrayList<>();
+ Map<String, Object> map = new HashMap<>();
+ map.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ map.put("LINE_NO", one.getLineNo()); // 琛屽彿
+ map.put("RELEASE_NO", one.getReleaseNo()); // 涓嬭揪鍙�
+ map.put("RECEIPT_NO", one.getReceiptNo()); // 鎺ユ敹鍙�
+ map.put("PART_NO", one.getPartNo()); //闆朵欢鍙�
+ map.put("CONFIGURATION_ID", one.getConfigurationId()); // 閰嶇疆鏍囪瘑
+ map.put("LOCATION_NO", one.getLocationNo()); // 搴撲綅鍙�
+ map.put("LOT_BATCH_NO", one.getLotBatchNo());// 鎵规鍙�
+ map.put("NEW_LOT_BATCH_NO", one.getUpdateBatchNo()); // 鐩爣鎵规鍙�
+ map.put("SERIAL_NO", one.getSerialNo()); // 搴忓垪鍙�
+ map.put("ENG_CHG_LEVEL", one.getEngChgLevel()); // 鐗堟湰鍙�
+ map.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); // wdr鍙�
+ map.put("ACTIVITY_SEQ", one.getActivitySeq()); // 娲诲姩搴忓彿
+ map.put("QTY_TO_CHANGE", one.getQtyArrived()); // 鍙樻洿鏁伴噺
+ resultList.add(map);
+ resultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ resultMap.put("SYSCODE", "LIMS");
+ resultMap.put("SYSMODEL", "淇敼閲囪喘璁㈠崟鎵规鍙�");
+ resultMap.put("BATCH_INFO", resultList);
+
+ Result result = ifsApiUtils.updateMoveReceiptLot(JSONUtil.toJsonStr(resultMap));
+
+ if (result.getCode() != 200) {
+ throw new ErrorException("IFS淇敼鎵规鍙峰け璐�: " + result.getMsg());
+ }
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .set(IfsInventoryQuantity::getIsUpdateBatch, 1)
+ .eq(IfsInventoryQuantity::getId, one.getId()));
+ }
+
+ Map<String, Object> moveResultMap = new HashMap<>();
+ List<Map<String, Object>> moveResultList = new ArrayList<>();
+ Map<String, Object> moveMap = new HashMap<>();
+ moveMap.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ moveMap.put("LINE_NO", one.getLineNo());
+ moveMap.put("RELEASE_NO", one.getReleaseNo());
+ moveMap.put("RECEIPT_NO", one.getReceiptNo());
+ moveMap.put("PART_NO", one.getPartNo());
+ moveMap.put("QTY", one.getQtyArrived());
+ moveMap.put("LOCATION_NO", one.getLocationNo());
+ moveMap.put("TO_LOCATION_NO", toLocation);
+ moveMap.put("LOT_BATCH_NO", one.getUpdateBatchNo());
+ moveMap.put("SERIAL_NO", one.getSerialNo());
+ moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo());
+ moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel());
+ moveMap.put("ACTIVITY_SEQ", one.getActivitySeq());
+ moveResultList.add(moveMap);
+ moveResultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ moveResultMap.put("SYSCODE", "LIMS");
+ moveResultMap.put("SYSMODEL", "妫�楠屽悗绉诲簱");
+ moveResultMap.put("BATCH_INFO", moveResultList);
+
+ Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap));
+ if (result1.getCode() != 200) {
+ throw new ErrorException("IFS妫�楠屽悗绉诲簱澶辫触: " + result1.getMsg());
+ }
+
+ }
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderStandardTemplateServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderStandardTemplateServiceImpl.java
new file mode 100644
index 0000000..3bf2e55
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderStandardTemplateServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.InsOrderStandardTemplateMapper;
+import com.ruoyi.inspect.pojo.InsOrderStandardTemplate;
+import com.ruoyi.inspect.service.InsOrderStandardTemplateService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 璁㈠崟鏍囧噯妯℃澘澶嶅埗
+ *
+ * @author zhuo
+ * @since 2024-11-05
+ */
+@Service
+public class InsOrderStandardTemplateServiceImpl extends ServiceImpl<InsOrderStandardTemplateMapper, InsOrderStandardTemplate> implements InsOrderStandardTemplateService {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderStateServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderStateServiceImpl.java
new file mode 100644
index 0000000..25c0e0f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderStateServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.InsOrderStateMapper;
+import com.ruoyi.inspect.pojo.InsOrderState;
+import com.ruoyi.inspect.service.InsOrderStateService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 妫�楠屼换鍔$姸鎬�
+ *
+ * @author zhuo
+ * @since 2025-02-28
+ */
+@Service
+public class InsOrderStateServiceImpl extends ServiceImpl<InsOrderStateMapper, InsOrderState> implements InsOrderStateService {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderTemplateServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderTemplateServiceImpl.java
new file mode 100644
index 0000000..0de8550
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderTemplateServiceImpl.java
@@ -0,0 +1,93 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.dto.StandardTreeTemplateBindingVo;
+import com.ruoyi.basic.service.StandardTreeService;
+import com.ruoyi.inspect.mapper.InsOrderTemplateMapper;
+import com.ruoyi.inspect.pojo.InsOrderTemplate;
+import com.ruoyi.inspect.service.InsOrderTemplateService;
+import com.ruoyi.inspect.vo.InsOrderTemplateDetailVo;
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 閽堝琛ㄣ�恑ns_order_template銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+ * @createDate 2024-03-18 14:14:54
+ */
+@Service
+@AllArgsConstructor
+public class InsOrderTemplateServiceImpl extends ServiceImpl<InsOrderTemplateMapper, InsOrderTemplate>
+ implements InsOrderTemplateService {
+
+ private InsOrderTemplateMapper insOrderTemplateMapper;
+
+ private StandardTreeService standardTreeService;
+
+ @Override
+ public int addInsOrderTemplate(InsOrderTemplate insOrderTemplate) {
+ return insOrderTemplateMapper.insert(insOrderTemplate);
+ }
+
+ @Override
+ public List<InsOrderTemplate> selectInsOrderTemplate(String company) {
+ if (ObjectUtils.isEmpty(company) || company.equals("")) {
+ return insOrderTemplateMapper.selectList(Wrappers.<InsOrderTemplate>lambdaQuery()
+ .select(InsOrderTemplate.class, info -> !info.getColumn().equals("thing")));
+ } else {
+ //鏍规嵁濮旀墭鍗曚綅杩涜绛涢��
+ return insOrderTemplateMapper.selectList(Wrappers.<InsOrderTemplate>lambdaQuery()
+ .like(InsOrderTemplate::getThing,"\"company\":\""+ company+"\"")
+ .select(InsOrderTemplate.class, info -> !info.getColumn().equals("thing")));
+ }
+ }
+
+ @Override
+ public InsOrderTemplateDetailVo selectInsOrderTemplateById(Integer id) {
+ InsOrderTemplate template = insOrderTemplateMapper.selectById(id);
+ InsOrderTemplateDetailVo vo = new InsOrderTemplateDetailVo();
+ if (template == null) {
+ vo.setTemplateBindings(new ArrayList<>());
+ return vo;
+ }
+ vo.setThing(template.getThing());
+ // 浼樺厛鍙栨ā鏉垮垪涓婃寔涔呭寲鐨勬爣鍑咺D锛屽巻鍙叉暟鎹洖閫�鍒颁粠琛ㄥ崟蹇収 addObj.standardTreeId 瑙f瀽
+ Integer standardTreeId = template.getStandardTreeId();
+ if (standardTreeId == null) {
+ standardTreeId = parseStandardTreeId(template.getThing());
+ }
+ vo.setStandardTreeId(standardTreeId);
+ if (standardTreeId != null) {
+ List<StandardTreeTemplateBindingVo> bindings = standardTreeService.selectTemplateBindings(standardTreeId);
+ vo.setTemplateBindings(bindings == null ? new ArrayList<>() : bindings);
+ } else {
+ vo.setTemplateBindings(new ArrayList<>());
+ }
+ return vo;
+ }
+
+ private Integer parseStandardTreeId(String thing) {
+ if (StringUtils.isBlank(thing)) {
+ return null;
+ }
+ try {
+ JSONObject addObj = JSON.parseObject(thing).getJSONObject("addObj");
+ return addObj == null ? null : addObj.getInteger("standardTreeId");
+ } catch (Exception ignored) {
+ return null;
+ }
+ }
+
+ @Override
+ public int delInsOrderTemplate(Integer id) {
+ return insOrderTemplateMapper.deleteById(id);
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningDetailServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningDetailServiceImpl.java
new file mode 100644
index 0000000..8a71136
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningDetailServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail;
+import com.ruoyi.inspect.mapper.InsProductDeviationWarningDetailMapper;
+import com.ruoyi.inspect.service.InsProductDeviationWarningDetailService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 妫�楠岄」鍋忓樊棰勮璇︽儏琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author
+ * @since 2025-03-28 02:18:58
+ */
+@Service
+public class InsProductDeviationWarningDetailServiceImpl extends ServiceImpl<InsProductDeviationWarningDetailMapper, InsProductDeviationWarningDetail> implements InsProductDeviationWarningDetailService {
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningServiceImpl.java
new file mode 100644
index 0000000..89f9ab8
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningServiceImpl.java
@@ -0,0 +1,34 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.inspect.dto.InsProductDeviationWarningDto;
+import com.ruoyi.inspect.pojo.InsProductDeviationWarning;
+import com.ruoyi.inspect.mapper.InsProductDeviationWarningMapper;
+import com.ruoyi.inspect.service.InsProductDeviationWarningService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 妫�楠岄」鍋忓樊棰勮涓昏〃 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author
+ * @since 2025-03-28 02:18:02
+ */
+@Service
+public class InsProductDeviationWarningServiceImpl extends ServiceImpl<InsProductDeviationWarningMapper, InsProductDeviationWarning> implements InsProductDeviationWarningService {
+
+ /**
+ * 鏌ョ湅棰勮鍒楄〃
+ * @param page
+ * @param deviationWarningDto
+ * @return
+ */
+ @Override
+ public IPage<InsProductDeviationWarningDto> selectDeviationWarningPage(Page page, InsProductDeviationWarningDto deviationWarningDto) {
+ return baseMapper.selectDeviationWarningPage(page, QueryWrappers.queryWrappers(deviationWarningDto));
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductServiceImpl.java
new file mode 100644
index 0000000..b5d0e0f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductServiceImpl.java
@@ -0,0 +1,316 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.mapper.StandardProductListMapper;
+import com.ruoyi.basic.pojo.StandardProductList;
+import com.ruoyi.basic.utils.StandardTreePathParser;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.InsProductBindingDto;
+import com.ruoyi.inspect.dto.WriteInspectionConditionDto;
+import com.ruoyi.inspect.mapper.InsOrderMapper;
+import com.ruoyi.inspect.mapper.InsOrderStandardTemplateMapper;
+import com.ruoyi.inspect.mapper.InsOrderTemplateDeviceMapper;
+import com.ruoyi.inspect.mapper.InsProductMapper;
+import com.ruoyi.inspect.mapper.InsSampleMapper;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsOrderStandardTemplate;
+import com.ruoyi.inspect.pojo.InsOrderTemplateDevice;
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.inspect.pojo.InsSample;
+import com.ruoyi.inspect.service.InsProductService;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+@AllArgsConstructor
+@Transactional(rollbackFor = Exception.class)
+public class InsProductServiceImpl extends ServiceImpl<InsProductMapper, InsProduct>
+ implements InsProductService {
+
+ private InsProductMapper insProductMapper;
+
+ private InsOrderMapper insOrderMapper;
+
+ private InsSampleMapper insSampleMapper;
+
+ private StandardProductListMapper standardProductListMapper;
+
+ private InsOrderStandardTemplateMapper insOrderStandardTemplateMapper;
+
+ private InsOrderTemplateDeviceMapper insOrderTemplateDeviceMapper;
+
+ @Override
+ public int selectOrderManDay(Integer orderId) {
+ return insProductMapper.selectOrderManDay(orderId);
+ }
+
+ @Override
+ public int updateInspected(Integer id, String ids) {
+ InsOrder insOrder = new InsOrder();
+ insOrder.setId(id);
+ insOrder.setIsRevocation(1);//闇�瑕佸鏍�
+ insOrder.setRevocationInsProductIds(ids);
+ return insOrderMapper.updateById(insOrder);
+ }
+
+ @Override
+ public boolean write(WriteInspectionConditionDto dto) {
+ if (dto == null || dto.getId() == null) {
+ throw new ErrorException("璁㈠崟ID涓嶈兘涓虹┖");
+ }
+ if (dto.getTemplateId() != null) {
+ InsOrderStandardTemplate snapshot = insOrderStandardTemplateMapper.selectOne(
+ Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, dto.getId())
+ .eq(InsOrderStandardTemplate::getTemplateId, dto.getTemplateId())
+ .last("limit 1"));
+ if (snapshot == null) {
+ throw new ErrorException("鏈壘鍒板綋鍓嶆ā鏉跨殑鍘熷璁板綍蹇収");
+ }
+ boolean hasSnapshotField = dto.isTemperaturePresent() || dto.isHumidityPresent()
+ || dto.isDetectionTimePresent() || dto.isDetectionPlacePresent()
+ || dto.isInsResultPresent();
+ if (hasSnapshotField) {
+ insOrderStandardTemplateMapper.update(null,
+ Wrappers.<InsOrderStandardTemplate>lambdaUpdate()
+ .eq(InsOrderStandardTemplate::getId, snapshot.getId())
+ .set(dto.isTemperaturePresent(),
+ InsOrderStandardTemplate::getTemperature, dto.getTemperature())
+ .set(dto.isHumidityPresent(),
+ InsOrderStandardTemplate::getHumidity, dto.getHumidity())
+ .set(dto.isDetectionTimePresent(),
+ InsOrderStandardTemplate::getDetectionTime, dto.getDetectionTime())
+ .set(dto.isDetectionPlacePresent(),
+ InsOrderStandardTemplate::getDetectionPlace, dto.getDetectionPlace())
+ .set(dto.isInsResultPresent(),
+ InsOrderStandardTemplate::getInsResult, dto.getInsResult()));
+ }
+ if (dto.isDeviceIdsPresent()) {
+ insOrderTemplateDeviceMapper.delete(
+ Wrappers.<InsOrderTemplateDevice>lambdaQuery()
+ .eq(InsOrderTemplateDevice::getInsOrderId, dto.getId())
+ .eq(InsOrderTemplateDevice::getTemplateId, dto.getTemplateId()));
+ List<Integer> deviceIds = dto.getDeviceIds() == null
+ ? Collections.emptyList()
+ : dto.getDeviceIds().stream()
+ .filter(Objects::nonNull)
+ .distinct()
+ .collect(Collectors.toList());
+ if (!deviceIds.isEmpty()
+ && insOrderTemplateDeviceMapper.selectExistingDeviceIds(deviceIds).size() != deviceIds.size()) {
+ throw new ErrorException("鎵�閫夎澶囦笉瀛樺湪锛岃鍒锋柊璁惧鍒楄〃鍚庨噸璇�");
+ }
+ for (int index = 0; index < deviceIds.size(); index++) {
+ InsOrderTemplateDevice relation = new InsOrderTemplateDevice();
+ relation.setInsOrderId(dto.getId());
+ relation.setTemplateId(dto.getTemplateId());
+ relation.setDeviceId(deviceIds.get(index));
+ relation.setSort(index);
+ insOrderTemplateDeviceMapper.insert(relation);
+ }
+ }
+ if (!hasSnapshotField && !dto.isDeviceIdsPresent()) {
+ throw new ErrorException("娌℃湁闇�瑕佷繚瀛樼殑妯℃澘妫�楠屾潯浠�");
+ }
+ return true;
+ }
+ InsOrder insOrder = new InsOrder();
+ insOrder.setId(dto.getId());
+ insOrder.setRemark(dto.getRemark());
+ insOrderMapper.updateById(insOrder);
+ return true;
+ }
+
+ //鏌ヨ寰呮椤圭洰
+ @Override
+ public IPage<InsProduct> selectNoProducts(Page page, InsProduct insProduct, Integer orderId, String ids) {
+ List<Integer> noIds = null;
+ if (StringUtils.isNotBlank(ids)) {
+ noIds = Arrays.asList(ids.split(",")).stream()
+ .map(Integer::parseInt)
+ .collect(Collectors.toList());
+ }
+ IPage<InsProduct> insProductIPage = baseMapper.selectNoProducts(page, orderId, noIds);
+ return insProductIPage;
+ }
+
+ //瀹℃牳寰呮鎾ら攢
+ @Override
+ public void checkUpdate(Integer orderId, Integer state) {
+ InsOrder insOrder = insOrderMapper.selectById(orderId);
+ if (state == 1) {
+ List<String> list = new ArrayList<>();
+ try {
+ list = Arrays.asList(insOrder.getRevocationInsProductIds().split(","));
+ } catch (Exception e) {
+ throw new ErrorException("杩樻病鏈夐�夋嫨搴旇瑕佹挙閿�鐨勬楠岄」鐩�");
+ }
+ List<Integer> ids = list.stream()
+ .map(Integer::parseInt)
+ .collect(Collectors.toList());
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
+ List<Integer> collect = insSamples.stream().map(InsSample::getId).collect(Collectors.toList());
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).in(InsProduct::getInsSampleId, collect));
+ if (insProducts.stream().map(InsProduct::getId).collect(Collectors.toList()).equals(ids)) {
+ //濡傛灉璇ユ楠屽崟涓嬬殑鎵�鏈夐」鐩叏閮ㄩ兘鎾ら攢,閭d箞杩欎釜鍗曞瓙涔熼渶瑕佹挙閿�
+ insOrder.setState(3);
+ } else {
+ List<InsProduct> products = insProductMapper.selectBatchIds(ids);
+ //棣栧厛鏍规嵁閫夋嫨鐨勯」鐩甶d杩涜鎾ら攢椤圭洰
+ updateBatchById(products.stream().map(insProduct -> {
+ insProduct.setState(0);
+ return insProduct;
+ }).collect(Collectors.toList()));
+ }
+ //insProductMapper.updateInspected(id);
+ }
+ //涓嶉�氳繃
+ insOrder.setIsRevocation(0);
+ insOrderMapper.updateById(insOrder);
+
+ }
+
+
+ /**
+ * 鏍规嵁妫�楠岄」id鏌ヨ妫�楠岄」鏍戜俊鎭�
+ * @param productId
+ * @return
+ */
+ @Override
+ public List<InsProduct> getProductTreeByProductId(Integer productId) {
+ // 鏌ヨ妫�楠岄」淇℃伅
+ InsProduct insProduct = insProductMapper.selectById(productId);
+ String tree;
+ if (insProduct.getSampleType() == null && insProduct.getModel() == null
+ && StringUtils.isNotBlank(insProduct.getLaboratory())
+ && StringUtils.isNotBlank(insProduct.getSample())) {
+ tree = StandardTreePathParser.canonical(insProduct.getLaboratory(), insProduct.getSample());
+ } else {
+ tree = insProduct.getFactory() + " - " +
+ insProduct.getLaboratory() + " - " +
+ insProduct.getSampleType() + " - " +
+ insProduct.getSample() + " - " +
+ insProduct.getModel();
+ }
+ // 鏌ヨ鏍囧噯鏍�
+ List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
+ .eq(StandardProductList::getStandardMethodListId, insProduct.getStandardMethodListId())
+ .eq(StandardProductList::getTree, tree));
+
+ List<InsProduct> insProducts = standardProductLists.stream().map(standardProductList -> {
+ InsProduct product = new InsProduct();
+ BeanUtils.copyProperties(standardProductList, product);
+ // 闃叉搴忓垪鍖栭敊璇�
+ product.setTemplate(null);
+ product.setStyle(null);
+ return product;
+ }).sorted((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort())
+ - (o2.getSort() == null ? 0 : o2.getSort())).collect(Collectors.toList());
+ return insProducts;
+ }
+
+ /**
+ * 鐗规畩妫�楠岄」缁戝畾
+ * @param insProductBindingDto
+ * @return
+ */
+ @Override
+ public boolean bindingProductTreeByProductId(InsProductBindingDto insProductBindingDto) {
+ if (insProductBindingDto.getInsProductId() == null) {
+ throw new ErrorException("缂哄皯妫�楠岄」缁戝畾id");
+ }
+
+ List<InsProduct> insProductBindingList = insProductBindingDto.getInsProductBindingList();
+ // 鏌ヨ鍘熸湰妫�楠岄」
+ InsProduct insProduct = insProductMapper.selectById(insProductBindingDto.getInsProductId());
+
+ for (InsProduct product : insProductBindingList) {
+ product.setBindingProductId(insProductBindingDto.getInsProductId());
+ product.setAsk(null);
+ product.setTell(null);
+ product.setPrice(null);
+ product.setManHour(null);
+ product.setSection(null);
+ // 鍏宠仈鏍囪瘑
+ product.setRawMaterialTag(insProduct.getRawMaterialTag());
+ product.setRepetitionTag(insProduct.getRepetitionTag());
+ product.setInsSampleId(insProduct.getInsSampleId());
+ product.setIsBinding(1);
+ product.setState(1);
+ }
+
+ // 鍒ゆ柇鏄惁鏄數缂嗘槸鐢电紗闇�瑕佹坊鍔犳墍鏈夌數缂嗗叧鑱斿叧绯�
+ if (StringUtils.isNotBlank(insProduct.getCableTag())) {
+ // 鏌ヨ鍏朵粬鐢电紗
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, insProduct.getInsSampleId())
+ .eq(InsProduct::getStructureItemParameterId, insProduct.getStructureItemParameterId())
+ .isNotNull(InsProduct::getCableTag));
+ for (InsProduct product : insProducts) {
+ for (InsProduct insProduct1 : insProductBindingList) {
+ insProduct1.setId(null);
+ insProduct1.setBindingProductId(product.getId());
+ insProduct1.setCableTag(product.getCableTag());
+ }
+ this.saveBatch(insProductBindingList);
+ }
+ } else {
+ this.saveBatch(insProductBindingList);
+ }
+
+ return true;
+ }
+
+ /**
+ * 鍒犻櫎鐗规畩妫�楠岄」缁戝畾淇℃伅
+ * @param productId
+ * @return
+ */
+ @Override
+ public boolean removeBindingProductTree(Integer productId) {
+ // 鏌ヨ妫�楠岄」
+ InsProduct insProduct = insProductMapper.selectById(productId);
+ // 鍒ゆ柇鏄惁鏄數缂嗛厤缃�, 闇�瑕佸垹闄ゅ叧鑱旂殑鎵�鏈夌殑妫�楠岄」
+ if (StringUtils.isNotBlank(insProduct.getCableTag())) {
+ insProductMapper.delete(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, insProduct.getInsSampleId())
+ .eq(InsProduct::getIsBinding, 1)
+ .isNotNull(InsProduct::getBindingProductId)
+ .eq(InsProduct::getStructureItemParameterId, insProduct.getStructureItemParameterId())
+ .isNotNull(InsProduct::getCableTag));
+ } else {
+ insProductMapper.deleteById(productId);
+ }
+ return false;
+ }
+
+ @Override
+ public List<InsProduct> getRevocationInsProductList(Integer orderId) {
+ InsOrder insOrder = insOrderMapper.selectById(orderId);
+ if(Objects.isNull(insOrder)){
+ throw new RuntimeException("鏈壘鍒拌璁㈠崟");
+ }
+ String revocationInsProductIds = insOrder.getRevocationInsProductIds();
+ List<Integer> ids = new ArrayList<>();
+ if(StringUtils.isNotBlank(revocationInsProductIds)){
+ ids = Arrays.asList(revocationInsProductIds.split(",")).stream().map(Integer::parseInt).collect(Collectors.toList());
+ }
+ return baseMapper.getRevocationInsProductList(ids);
+ }
+
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
new file mode 100644
index 0000000..c980068
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
@@ -0,0 +1,1254 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.aspose.words.FontSettings;
+import com.aspose.words.License;
+import com.aspose.words.SaveFormat;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.config.Configure;
+import com.deepoove.poi.data.Pictures;
+import com.itextpdf.text.BadElementException;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.pdf.PdfContentByte;
+import com.itextpdf.text.pdf.PdfReader;
+import com.itextpdf.text.pdf.PdfStamper;
+import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
+import com.ruoyi.common.config.WechatProperty;
+import com.ruoyi.common.constant.InsOrderTypeConstants;
+import com.ruoyi.common.constant.MenuJumpPathConstants;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.core.domain.entity.InformationNotification;
+import com.ruoyi.common.utils.DateImageUtil;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.WxCpUtils;
+import com.ruoyi.common.utils.api.IfsApiUtils;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.InsReportExport;
+import com.ruoyi.inspect.dto.ReportPageDto;
+import com.ruoyi.inspect.mapper.*;
+import com.ruoyi.inspect.pojo.*;
+import com.ruoyi.inspect.service.InsOrderService;
+import com.ruoyi.inspect.service.InsReportService;
+import com.ruoyi.inspect.service.RawMaterialOrderService;
+import com.ruoyi.inspect.util.PreserveReportPicturePlaceholderHandler;
+import com.ruoyi.inspect.util.ReportSignaturePictureUtils;
+import com.ruoyi.system.mapper.UserMapper;
+import com.ruoyi.system.service.InformationNotificationService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xwpf.usermodel.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import jakarta.annotation.Resource;
+import javax.imageio.ImageIO;
+import jakarta.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.net.URLEncoder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * @author Administrator
+ * @description 閽堝琛ㄣ�恑ns_report(妫�楠屾姤鍛�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+ * @createDate 2024-03-17 22:10:02
+ */
+@Service
+@Slf4j
+public class InsReportServiceImpl extends ServiceImpl<InsReportMapper, InsReport>
+ implements InsReportService {
+ static {
+ // Linux 鏈嶅姟鍣ㄧ己灏戜腑鏂囧瓧浣擄紝鎶ュ憡杞� PDF 鏃朵腑鏂囦細鍙樻垚鏂瑰潡锛涘皢妯℃澘瀛椾綋鏄犲皠鍒� Noto CJK 鍏滃簳銆�
+ FontSettings.addFontSubstitutes("瀹嬩綋", "Noto Serif CJK SC");
+ FontSettings.addFontSubstitutes("榛戜綋", "Noto Sans CJK SC");
+ }
+
+ private static final int DETECTION_REPORT = 0;
+ private static final int INSPECTION_REPORT = 1;
+
+ @Resource
+ private UserMapper userMapper;
+ @Resource
+ private InsReportMapper insReportMapper;
+ @Resource
+ private InsOrderStateMapper insOrderStateMapper;
+ @Resource
+ private InsProductMapper insProductMapper;
+ @Resource
+ private InformationNotificationService informationNotificationService;
+ @Value("${wordUrl}")
+ private String wordUrl;
+ @Value("${file.path}")
+ private String imgUrl;
+
+ @Resource
+ private InsOrderMapper insOrderMapper;
+ @Resource
+ private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
+ @Resource
+ private InsUnqualifiedHandlerMapper insUnqualifiedHandlerMapper;
+ @Resource
+ private InsSampleMapper insSampleMapper;
+ @Resource
+ private ThreadPoolTaskExecutor threadPoolTaskExecutor;
+ @Resource
+ private InsOrderService insOrderService;
+ @Resource
+ private WechatProperty wechatProperty;
+ @Resource
+ private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper;
+ @Resource
+ private IfsApiUtils ifsApiUtils;
+ @Resource
+ private InsSampleUserMapper insSampleUserMapper;
+ @Autowired
+ private RawMaterialOrderService rawMaterialOrderService;
+
+
+ @Override
+ public Map<String, Object> pageInsReport(Page page, ReportPageDto reportPageDto) {
+ Map<String, Object> map = new HashMap<>();
+ // todo: 浠呯湅鑷繁
+ //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
+ String laboratory = null;
+
+ Integer createOrderUser = reportPageDto.getCreateOrderUser();
+ String queryStatus = reportPageDto.getQueryStatus();
+ reportPageDto.setQueryStatus(null);
+ reportPageDto.setCreateOrderUser(null);
+
+ map.put("body", insReportMapper.pageInsReport(page,
+ QueryWrappers.queryWrappers(reportPageDto),
+ laboratory,
+ SecurityUtils.getUserId().intValue(),
+ queryStatus,
+ createOrderUser));
+ return map;
+ }
+
+ @Override
+ public int inReport(String url, Integer id) {
+ InsReport insReport = new InsReport();
+ insReport.setId(id);
+ insReport.setUrlS(url);
+ // 杩樺師pdf
+ String tempUrlPdf = wordToPdfTemp(insReport.getUrlS().replace("/word", wordUrl));
+ insReport.setTempUrlPdf("/word/" + tempUrlPdf);
+ return insReportMapper.updateById(insReport);
+ }
+
+ @Override
+ public int upReportUrl(Integer id) {
+ InsReport report = insReportMapper.selectById(id);
+ // 杩樺師pdf
+ String tempUrlPdf = wordToPdfTemp(report.getUrl().replace("/word", wordUrl));
+
+ return insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate()
+ .eq(InsReport::getId, id)
+ .set(InsReport::getUrlS, null)
+ .set(InsReport::getTempUrlPdf, "/word/" + tempUrlPdf));
+ }
+
+ //鎻愪氦
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int writeReport(Integer id, Integer userId, Integer submitUserId) {
+ submitUserId = submitUserId == null ? SecurityUtils.getUserId().intValue() : submitUserId;
+ InsReport insReport = insReportMapper.selectById(id);
+ insReport.setId(id);
+ insReport.setState(1);
+ insReport.setWriteUserId(submitUserId);//鎻愪氦浜�
+ if (userId == null) {
+ throw new ErrorException("缂哄皯瀹℃牳浜�");
+ }
+ insReport.setExamineUserId(userId);//瀹℃牳浜�
+ insReport.setWriteTime(LocalDateTime.now());//鎻愪氦鏃堕棿
+ //鑾峰彇鎻愪氦浜虹殑绛惧悕鍦板潃
+ String signatureUrl;
+ try {
+ signatureUrl = userMapper.selectById(insReport.getWriteUserId()).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
+ }
+ if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) {
+ throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�");
+ }
+
+ Integer insOrderId = insReportMapper.selectById(id).getInsOrderId();
+ InsOrder order = insOrderMapper.selectById(insOrderId);
+ boolean isRawMater = order.getTypeSource() != null && order.getTypeSource().equals(1);
+
+ //鍙戦�佹秷鎭�
+ InformationNotification info = new InformationNotification();
+ info.setCreateUser(insProductMapper.selectUserById(userId).get("name"));
+ info.setMessageType("3");
+ info.setTheme("瀹℃牳閫氱煡");
+ info.setContent("鎮ㄦ湁涓�鏉℃姤鍛婄紪鍒跺緟瀹℃牳娑堟伅, 缂栧彿:" + insReport.getCode());
+ info.setSenderId(submitUserId); //鍙戦�佷汉
+ info.setConsigneeId(userId); //鏀朵欢浜�
+ info.setViewStatus(false);
+ info.setJumpPath(MenuJumpPathConstants.REPORT_PREPARATION);
+ informationNotificationService.addInformationNotification(info);
+ String primaryReportUrl = getPrimaryReportUrl(insReport);
+
+ // 鍒ゆ柇鏄惁鏄師鏉愭枡 闇�瑕佹浛鎹�****鎴愪緵搴斿晢
+ IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>()
+ .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()));
+ if (one != null) {
+ if (isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) {
+ for (String reportUrl : getApprovalReportUrls(insReport)) {
+ changeText(new HashMap<String, String>() {{
+ put("**********", one.getSupplierName());
+ }}, reportUrl.replace("/word", wordUrl));
+ }
+ }
+ }
+
+ Map<String, Object> writeMarks = new HashMap<String, Object>() {{
+ put("writeUrl", ReportSignaturePictureUtils.create(imgUrl, signatureUrl));
+ put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
+ put("insUrl", ReportSignaturePictureUtils.create(imgUrl, signatureUrl));
+ }};
+ writeMarksToReportFiles(insReport, writeMarks);
+
+ // 淇敼涓存椂pdf
+ String tempUrlPdf = wordToPdfTemp(primaryReportUrl.replace("/word", wordUrl));
+ insReport.setTempUrlPdf("/word/" + tempUrlPdf);
+
+ insReportMapper.updateById(insReport);
+
+ // 娓呯┖瀹℃牳鏃堕棿, 瀹℃牳鐘舵��
+ insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate()
+ .eq(InsReport::getId, insReport.getId())
+ .set(InsReport::getRatifyTime, null)
+ .set(InsReport::getIsRatify, null)
+ .set(InsReport::getExamineTime, null)
+ .set(InsReport::getIsExamine, null));
+
+ return 1;
+ }
+
+ //瀹℃牳
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int examineReport(Integer id, Integer isExamine, String examineTell, Integer userId) {
+ InsReport insReport = insReportMapper.selectById(id);
+ insReport.setIsExamine(isExamine);
+ if (ObjectUtils.isNotEmpty(examineTell)) {
+ insReport.setExamineTell(examineTell);
+ }
+
+ // 妫�楠屼汉
+ String userName = insProductMapper.selectUserById(insReport.getWriteUserId()).get("name");
+ String userAccount = insProductMapper.selectUserById(insReport.getWriteUserId()).get("account");
+
+ // 瀹℃牳浜�
+ Integer checkUserId = SecurityUtils.getUserId().intValue();
+ String checkUserName = insProductMapper.selectUserById(checkUserId).get("name");
+
+ insReport.setExamineTime(LocalDateTime.now());//瀹℃牳鏃堕棿
+ if (isExamine == 0) {
+ // 鍙戦�佷紒涓氬井淇¢�氱煡(瀹℃牳閫�鍥�)
+ threadPoolTaskExecutor.execute(() -> {
+ // 鏌ヨ璁㈠崟
+ InsOrder order = insOrderMapper.selectById(insReport.getInsOrderId());
+ InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, insReport.getInsOrderId())
+ .last("limit 1"));
+ // 鏌ヨ鍘熸潗鏂�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+
+ String message = "";
+ message += "鎶ュ憡缂栧埗瀹℃牳閫�鍥為�氱煡";
+ message += "\n瀹℃牳浜�: " + checkUserName;
+ message += "\n濮旀墭缂栧彿: " + order.getEntrustCode();
+ message += "\n鏍峰搧鍚嶇О: " + insSample.getModel();
+ message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail();
+ if (ifsInventoryQuantity != null) {
+ message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo();
+ }
+ message += "\n閫�鍥炲師鍥�: " + examineTell;
+ //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡 鎻愪氦澶嶆牳
+ try {
+ WxCpUtils.inform(userAccount, message, null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+
+ //濡傛灉瀹℃牳涓嶉�氳繃
+ insReport.setState(0);//鎻愪氦鐘舵�佹敼涓哄緟鎻愪氦
+ return insReportMapper.updateById(insReport);
+ } else {
+ if (userId == null) {
+ throw new ErrorException("缂哄皯鎵瑰噯浜�");
+ }
+ if (Objects.equals(insReport.getExamineUserId(), userId)) {
+ throw new ErrorException("瀹℃牳浜哄拰鎵瑰噯浜轰笉鑳戒负鍚屼竴浜猴紝璇烽噸鏂伴�夋嫨鎵瑰噯浜�");
+ }
+ }
+ insReport.setRatifyUserId(userId);//鎵瑰噯浜�
+ //鑾峰彇瀹℃牳浜虹殑绛惧悕鍦板潃
+ String signatureUrl;
+ try {
+ signatureUrl = userMapper.selectById(insReport.getExamineUserId()).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒板鏍镐汉鐨勭鍚�");
+ }
+ if (StringUtils.isBlank(signatureUrl)) {
+ throw new ErrorException("鎵句笉鍒板鏍镐汉鐨勭鍚�");
+ }
+
+ // 鎵瑰噯浜�
+ String sendUserAccount = insProductMapper.selectUserById(userId).get("account");
+
+ //鍙戦�佹秷鎭�
+ InformationNotification info = new InformationNotification();
+ info.setCreateUser(insProductMapper.selectUserById(userId).get("name"));
+ info.setMessageType("3");
+ info.setTheme("鎵瑰噯閫氱煡");
+ info.setContent("鎮ㄦ湁涓�鏉℃姤鍛婄紪鍒跺緟鎵瑰噯娑堟伅, 缂栧彿:" + insReport.getCode());
+ info.setSenderId(checkUserId); //鍙戦�佷汉
+ info.setConsigneeId(userId); //鏀朵欢浜�
+ info.setViewStatus(false);
+ info.setJumpPath(MenuJumpPathConstants.REPORT_PREPARATION);
+ informationNotificationService.addInformationNotification(info);
+ String primaryReportUrl = getPrimaryReportUrl(insReport);
+ Map<String, Object> examineMarks = new HashMap<String, Object>() {{
+ put("examineUrl", ReportSignaturePictureUtils.create(imgUrl, signatureUrl));
+ put("examineDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
+ }};
+ writeMarksToReportFiles(insReport, examineMarks);
+
+ // 淇敼涓存椂pdf
+ String tempUrlPdf = wordToPdfTemp(primaryReportUrl.replace("/word", wordUrl));
+ insReport.setTempUrlPdf("/word/" + tempUrlPdf);
+
+ // 鍙戦�佷紒涓氬井淇¢�氱煡(閫氱煡鎵瑰噯浜哄鎵�)
+ threadPoolTaskExecutor.execute(() -> {
+ // 鏌ヨ璁㈠崟
+ InsOrder order = insOrderMapper.selectById(insReport.getInsOrderId());
+ InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, insReport.getInsOrderId())
+ .last("limit 1"));
+ // 鏌ヨ鍘熸潗鏂�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+
+ String message = "";
+ message += "鎶ュ憡缂栧埗鎵瑰噯閫氱煡";
+ message += "\n妫�楠屼汉: " + userName;
+ message += "\n澶嶆牳浜�: " + checkUserName;
+ message += "\n濮旀墭缂栧彿: " + order.getEntrustCode();
+ message += "\n鏍峰搧鍚嶇О: " + insSample.getModel();
+ message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail();
+ if (ifsInventoryQuantity != null) {
+ message += "\n鐢熶骇鍘傚: " + ifsInventoryQuantity.getSupplierName();
+ message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo();
+ }
+ //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡 鎻愪氦澶嶆牳
+ try {
+ WxCpUtils.inform(sendUserAccount, message, null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ insReportMapper.updateById(insReport);
+
+ // 娓呯┖鎵瑰噯澶囨敞, 鎵瑰噯鏃堕棿, 鎵瑰噯鐘舵��
+ insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate()
+ .eq(InsReport::getId, insReport.getId())
+ .set(InsReport::getExamineTell, null)
+ .set(InsReport::getRatifyTime, null)
+ .set(InsReport::getIsRatify, null));
+ return 1;
+ }
+
+ //鎵瑰噯
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int ratifyReport(Integer id, Integer isRatify, String ratifyTell) {
+ InsReport insReport = insReportMapper.selectById(id);
+ if (Objects.equals(insReport.getExamineUserId(), SecurityUtils.getUserId().intValue())) {
+ throw new ErrorException("瀹℃牳浜哄拰鎵瑰噯浜轰笉鑳戒负鍚屼竴浜猴紝璇烽噸鏂伴�夋嫨鎵瑰噯浜�");
+ }
+ insReport.setIsRatify(isRatify);
+ if (ObjectUtils.isNotEmpty(ratifyTell)) {
+ insReport.setRatifyTell(ratifyTell);
+ }
+ insReport.setRatifyTime(LocalDateTime.now());//鎵瑰噯鏃堕棿
+ if (isRatify == 0) {
+
+ // 鎵瑰噯浜�
+ Integer ratifyUserId = SecurityUtils.getUserId().intValue();
+ String ratifyUserName = insProductMapper.selectUserById(ratifyUserId).get("name");
+
+ // 鍙戦�佷汉(瀹℃牳浜�)(妫�楠屼汉)
+ // 妫�楠屼汉
+ String userAccount = insProductMapper.selectUserById(insReport.getWriteUserId()).get("account");
+ // 瀹℃牳浜�
+ String checkUserAccount = insProductMapper.selectUserById(insReport.getExamineUserId()).get("account");
+
+
+ // 鍙戦�佷紒涓氬井淇¢�氱煡(鎵瑰噯閫�鍥�)
+ threadPoolTaskExecutor.execute(() -> {
+ // 鏌ヨ璁㈠崟
+ InsOrder order = insOrderMapper.selectById(insReport.getInsOrderId());
+ InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, insReport.getInsOrderId())
+ .last("limit 1"));
+ // 鏌ヨ鍘熸潗鏂�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+
+ String message = "";
+ message += "鎶ュ憡缂栧埗鎵瑰噯閫�鍥為�氱煡";
+ message += "\n鎵瑰噯浜�: " + ratifyUserName;
+ message += "\n濮旀墭缂栧彿: " + order.getEntrustCode();
+ message += "\n鏍峰搧鍚嶇О: " + insSample.getModel();
+ message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail();
+ if (ifsInventoryQuantity != null) {
+ message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo();
+ }
+ message += "\n閫�鍥炲師鍥�: " + ratifyTell;
+ //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡 鎻愪氦澶嶆牳
+ try {
+ // 瀹℃壒浜�
+ WxCpUtils.inform(checkUserAccount, message, null);
+
+ // 妫�楠屼汉
+ WxCpUtils.inform(userAccount, message, null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+
+ //濡傛灉鎵瑰噯涓嶉�氳繃 鐩存帴閫�鍥炲埌鎻愪氦浜洪偅杈瑰幓
+ insReport.setState(0);
+ insReport.setIsExamine(0);
+ return insReportMapper.updateById(insReport);
+ }
+ //鑾峰彇鎵瑰噯浜虹殑绛惧悕鍦板潃
+ String signatureUrl;
+ try {
+ signatureUrl = userMapper.selectById(insReport.getRatifyUserId()).getSignatureUrl();
+ } catch (Exception e) {
+ throw new ErrorException("鎵句笉鍒版壒鍑嗕汉鐨勭鍚�");
+ }
+ if (StringUtils.isBlank(signatureUrl)) {
+ throw new ErrorException("鎵句笉鍒版壒鍑嗕汉鐨勭鍚�");
+ }
+ Integer insOrderId = insReportMapper.selectById(id).getInsOrderId();
+ InsOrder order = insOrderMapper.selectById(insOrderId);
+ boolean isRawMater = order.getTypeSource() != null && order.getTypeSource().equals(1);
+
+ //鑾峰彇鍦烘墍鐨勬姤鍛婁笓鐢ㄧ珷
+ String sealUrl;
+ String laboratory = insOrderMapper.selectById(insReport.getInsOrderId()).getLaboratory();
+ try {
+ String type = "";
+ if (isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) {
+ type = "杩涘巶鎶ュ憡";
+ } else {
+ type = "濮旀墭鎶ュ憡";
+ }
+ sealUrl = insReportMapper.getLaboratoryByName(laboratory, type);
+ } catch (Exception e) {
+ throw new ErrorException(laboratory + "鎵句笉鍒版姤鍛婁笓鐢ㄧ珷");
+ }
+ if (StringUtils.isBlank(sealUrl)) {
+ throw new ErrorException(laboratory + "鎵句笉鍒版姤鍛婁笓鐢ㄧ珷");
+ }
+ String primaryReportUrl = getPrimaryReportUrl(insReport);
+ String finalUrl = primaryReportUrl.replace("/word", wordUrl);
+
+ Map<String, Object> ratifyMarks = new HashMap<String, Object>() {{
+ put("ratifyUrl", ReportSignaturePictureUtils.create(imgUrl, signatureUrl));
+ put("ratifyDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
+ put("seal1", Pictures.ofLocal(imgUrl + "/" + sealUrl).create());
+ put("seal2", Pictures.ofLocal(imgUrl + "/" + sealUrl).create());
+ }};
+ writeMarksToReportFiles(insReport, ratifyMarks);
+
+ // 淇敼涓存椂pdf
+ insReport.setTempUrlPdf(primaryReportUrl.replace(".docx", ".pdf"));
+
+ InsOrder insOrder = new InsOrder();
+ insOrder.setId(insOrderId);
+ insOrder.setState(4);
+ insOrderMapper.updateById(insOrder);
+
+ for (String reportUrl : getApprovalReportUrls(insReport)) {
+ wordToPdf(reportUrl.replace("/word", wordUrl), sealUrl,
+ isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY));
+ }
+
+ // 鍒ゆ柇鏄惁涓哄師鏉愭枡
+ if (isRawMater) {
+ // 淇敼ifs搴撳瓨鐘舵��
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getState, 2)
+ .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()));
+ }
+ insReport.setRatifyTell("");
+
+ // 鍙戦�佹枃浠跺埌濮旀墭浜�
+ if (StringUtils.isNotBlank(order.getPrepareCode())) {
+ threadPoolTaskExecutor.execute(() -> {
+ String message = "";
+ message += "濮旀墭缂栧彿: " + order.getEntrustCode();
+ message += "濮旀墭鏍峰搧: " + order.getSampleView();
+ message += "宸叉娴嬬粨鏉�, 璇锋帴鏀�";
+ try {
+ WxCpUtils.inform(order.getPrepareCode(), message, new File(finalUrl.replace(".docx", ".pdf")));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+
+ return insReportMapper.updateById(insReport);
+ }
+
+ @Override
+ public int wordInsertUrl(Map<String, Object> map, String url) {
+ Configure configure = Configure.builder()
+ .setValidErrorHandler(new PreserveReportPicturePlaceholderHandler())
+ .build();
+ XWPFTemplate template = XWPFTemplate.compile(url, configure).render(map);
+ try {
+ template.writeAndClose(Files.newOutputStream(Paths.get(url)));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return 1;
+ }
+
+ private String getPrimaryReportUrl(InsReport report) {
+ String reportUrl = StringUtils.isNotBlank(report.getUrlS()) ? report.getUrlS() : report.getUrl();
+ if (StringUtils.isBlank(reportUrl)) {
+ throw new ErrorException("妫�娴嬫姤鍛婃枃浠朵笉瀛樺湪");
+ }
+ return reportUrl;
+ }
+
+ private List<String> getApprovalReportUrls(InsReport report) {
+ return Arrays.asList(getPrimaryReportUrl(report), report.getInspectionUrl()).stream()
+ .filter(StringUtils::isNotBlank)
+ .distinct()
+ .collect(Collectors.toList());
+ }
+
+ private void writeMarksToReportFiles(InsReport report, Map<String, Object> marks) {
+ for (String reportUrl : getApprovalReportUrls(report)) {
+ wordInsertUrl(marks, reportUrl.replace("/word", wordUrl));
+ }
+ }
+
+
+ //鎶ュ憡鎵归噺涓嬭浇
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public String downAll(String ids) {
+ List<Long> list = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList());
+ List<InsReport> insReports = insReportMapper.selectBatchIds(list);
+ String zipFilePath = null;
+ // 涓存椂鏂囦欢澶硅矾寰�
+ try {
+ String tempFolderPath = wordUrl + "/tempFolder";
+ File tempFolder = new File(tempFolderPath);
+ if (tempFolder.exists()) {
+ deleteDirectory(tempFolder); // 鍒犻櫎鏃х殑涓存椂鏂囦欢澶�
+ }
+ tempFolder.mkdirs(); // 鍒涘缓鏂扮殑涓存椂鏂囦欢澶�
+ for (InsReport insReport : insReports) {
+ File sourceFile = new File((ObjectUtils.isNotEmpty(insReport.getUrlS()) ? insReport.getUrlS() : insReport.getUrl()).replace("/word", wordUrl));
+ File destinationFile = new File(tempFolder, sourceFile.getName());
+ Files.copy(sourceFile.toPath(), destinationFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
+ }
+ // 鍘嬬缉涓存椂鏂囦欢澶�
+ zipFilePath = wordUrl + "/zip/output.zip";
+ // 鍒ゆ柇zip璺緞鏄惁瀛樺湪
+ File zipDir = new File(wordUrl + "/zip");
+ if(!zipDir.isDirectory()){
+ zipDir.mkdirs();
+ }
+ zipDirectory(tempFolderPath, zipFilePath);
+
+ // 娓呯悊涓存椂鏂囦欢澶�
+ deleteDirectory(tempFolder);
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return "/word/zip/output.zip";
+ }
+
+ @Override
+ public void download(Integer id, Integer reportType, Integer createOrderUser, HttpServletResponse response) {
+ if (id == null) {
+ throw new ErrorException("鎶ュ憡涓嶈兘涓虹┖");
+ }
+ reportType = reportType == null ? DETECTION_REPORT : reportType;
+ if (!Objects.equals(reportType, DETECTION_REPORT) && !Objects.equals(reportType, INSPECTION_REPORT)) {
+ throw new ErrorException("鎶ュ憡绫诲瀷涓嶆纭�");
+ }
+ InsReport report = insReportMapper.selectDownloadableReport(id, createOrderUser);
+ if (report == null) {
+ throw new ErrorException("鎶ュ憡涓嶅瓨鍦ㄣ�佸皻鏈敓鎴愭垨鏃犳潈涓嬭浇");
+ }
+ String reportUrl = Objects.equals(reportType, INSPECTION_REPORT)
+ ? report.getInspectionUrl() : getPrimaryReportUrl(report);
+ if (StringUtils.isBlank(reportUrl) || !reportUrl.replace('\\', '/').startsWith("/word/")) {
+ throw new ErrorException((Objects.equals(reportType, INSPECTION_REPORT) ? "妫�楠屾姤鍛�" : "妫�娴嬫姤鍛�")
+ + "鏂囦欢涓嶅瓨鍦紝璇疯仈绯荤鐞嗗憳");
+ }
+ Path root = Paths.get(wordUrl).toAbsolutePath().normalize();
+ Path file = root.resolve(reportUrl.replace('\\', '/').substring("/word/".length())).normalize();
+ if (!file.startsWith(root) || !Files.isRegularFile(file)) {
+ throw new ErrorException("鎶ュ憡鏂囦欢涓嶅瓨鍦紝璇疯仈绯荤鐞嗗憳");
+ }
+ try {
+ String filename = file.getFileName().toString();
+ String encodedName = URLEncoder.encode(filename, "UTF-8").replace("+", "%20");
+ response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+ response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodedName);
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename");
+ response.setHeader("download-filename", encodedName);
+ response.setContentLengthLong(Files.size(file));
+ try (InputStream inputStream = Files.newInputStream(file);
+ OutputStream outputStream = response.getOutputStream()) {
+ byte[] buffer = new byte[8192];
+ int length;
+ while ((length = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, length);
+ }
+ outputStream.flush();
+ }
+ } catch (IOException e) {
+ log.error("涓嬭浇鎶ュ憡澶辫触锛宺eportId={}", id, e);
+ throw new ErrorException("鎶ュ憡涓嬭浇澶辫触");
+ }
+ }
+
+ //鎵归噺涓婁紶
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int upAll(MultipartFile file) throws IOException {
+ File tempFile = null;
+ File unzipDir = null;
+ try {
+ tempFile = File.createTempFile(wordUrl, ".zip");
+ file.transferTo(tempFile);
+
+ unzipDir = new File("uploaded_files");
+ if (!unzipDir.exists()) {
+ unzipDir.mkdir();
+ }
+ unzip(tempFile, unzipDir);
+ // 澶勭悊瑙e帇鍚庣殑鏂囦欢
+ File[] files = unzipDir.listFiles();
+ if (files != null) {
+ for (File f : files) {
+ // 鏍规嵁鏂囦欢鍚嶆煡璇d
+ String name = f.getName();
+ InsReport insReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery().like(InsReport::getCode, f.getName().replace(".docx", "").replace("JCZX", "JCZX/")));
+ if (ObjectUtils.isEmpty(insReport)) {
+ throw new ErrorException("娌℃湁鎵惧埌 " + f.getName() + " 杩欎釜鏂囦欢瀵瑰簲鐨勬姤鍛婃暟鎹�");
+ }
+ String urlString;
+ String pathName;
+ try {
+ String path = wordUrl;
+ File realpath = new File(path);
+ if (!realpath.exists()) {
+ realpath.mkdirs();
+ }
+ pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "_" + f.getName();
+ urlString = realpath + "/" + pathName;
+ // 澶嶅埗鏂囦欢鍒版寚瀹氳矾寰�
+ Files.copy(f.toPath(), new File(urlString).toPath(), StandardCopyOption.REPLACE_EXISTING);
+ inReport("/word/" + pathName, insReport.getId());
+ } catch (IOException e) {
+ throw new ErrorException("鏂囦欢涓婁紶澶辫触");
+ }
+ }
+ }
+ } catch (IOException e) {
+ throw new ErrorException("鏂囦欢澶勭悊澶辫触");
+ } finally {
+ if (tempFile != null && tempFile.exists()) {
+ tempFile.delete();
+ }
+ // 閫掑綊鍒犻櫎瑙e帇鐩綍鍙婂叾涓殑鏂囦欢
+ if (unzipDir.exists()) {
+ deleteDirectory(unzipDir); // 鍒犻櫎鏃х殑涓存椂鏂囦欢澶�
+ }
+ }
+ return 0;
+ }
+
+
+ //瑙e帇鏂囦欢澶�
+ private void unzip(File zipFile, File destDir) throws IOException {
+ try (ZipFile zip = new ZipFile(zipFile)) {
+ Enumeration<? extends ZipEntry> entries = zip.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ File file = new File(destDir, entry.getName());
+ if (entry.isDirectory()) {
+ file.mkdirs();
+ } else {
+ file.getParentFile().mkdirs();
+ try (InputStream in = zip.getInputStream(entry);
+ OutputStream out = new FileOutputStream(file)) {
+ byte[] buffer = new byte[1024];
+ int len;
+ while ((len = in.read(buffer)) > 0) {
+ out.write(buffer, 0, len);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // 鍘嬬缉鏂囦欢澶�
+ public static void zipDirectory(String sourceDirPath, String zipFilePath) throws IOException {
+ try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipFilePath))) {
+ Path sourceDir = Paths.get(sourceDirPath);
+ Files.walk(sourceDir)
+ .filter(path -> !Files.isDirectory(path))
+ .forEach(path -> {
+ ZipEntry zipEntry = new ZipEntry(sourceDir.relativize(path).toString());
+ try {
+ zipOut.putNextEntry(zipEntry);
+ Files.copy(path, zipOut);
+ zipOut.closeEntry();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ });
+ }
+ }
+
+ // 鍒犻櫎鏂囦欢澶瑰強鍏跺唴瀹�
+ public static void deleteDirectory(File directory) throws IOException {
+ if (directory.isDirectory()) {
+ File[] files = directory.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ deleteDirectory(file);
+ }
+ }
+ }
+ Files.delete(directory.toPath());
+ }
+
+ @Override
+ public void wordToPdf(String path, String sealUrl, boolean isRawMater) {
+ try {
+ wordToPdf(path, path.replace(".docx", ".pdf"), sealUrl, isRawMater);
+ } catch (Exception e) {
+ throw new ErrorException("杞崲澶辫触");
+ }
+ }
+
+
+ public String wordToPdf(String wordPath, String pdfPath, String sealUrl, boolean isRawMater) {
+ FileOutputStream os = null;
+ try {
+ //鍑瘉 涓嶇劧鍒囨崲鍚庢湁姘村嵃
+ InputStream is = new ClassPathResource("/lib/license.xml").getInputStream();
+ License license = new License();
+ license.setLicense(is);
+ if (!license.getIsLicensed()) {
+ log.info("License楠岃瘉涓嶉�氳繃...");
+ return null;
+ }
+ //鐢熸垚涓�涓┖鐨凱DF鏂囦欢
+ File file;
+ //鍒ゆ柇鏄惁鏄繘鍘傛姤鍛�
+ if (!isRawMater) {
+ file = new File(pdfPath.replace(".pdf", "-1.pdf"));
+ } else {
+ file = new File(pdfPath.replace(".pdf", ".pdf"));
+ }
+ os = new FileOutputStream(file);
+ //瑕佽浆鎹㈢殑word鏂囦欢
+ com.aspose.words.Document doc = new com.aspose.words.Document(wordPath);
+ doc.save(os, SaveFormat.PDF);
+
+ //娣诲姞楠戠紳绔�
+ if (!isRawMater) {
+ stamperCheckMarkPDF(pdfPath.replace(".pdf", "-1.pdf"), pdfPath, imgUrl + "/" + sealUrl);
+ }
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (os != null) {
+ try {
+ os.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 鍒囧壊鍥剧墖
+ *
+ * @param Path 鍥剧墖璺緞
+ * @param n 鍒囧壊浠芥暟
+ */
+ public static com.itextpdf.text.Image[] slicingImages(String Path, int n) throws IOException, BadElementException {
+ com.itextpdf.text.Image[] nImage = new com.itextpdf.text.Image[n];
+ BufferedImage img = ImageIO.read(new File(Path));
+
+ int h = img.getHeight();
+ int w = img.getWidth();
+
+ int sw = w / n;
+ for (int i = 0; i < n; i++) {
+ BufferedImage subImg;
+ if (i == n - 1) {//鏈�鍚庡墿浣欓儴鍒�
+ subImg = img.getSubimage(i * sw, 0, w - i * sw, h);
+ } else {//鍓峮-1鍧楀潎鍖�鍒�
+ subImg = img.getSubimage(i * sw, 0, sw, h);
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ImageIO.write(subImg, Path.substring(Path.lastIndexOf('.') + 1), out);
+ nImage[i] = com.itextpdf.text.Image.getInstance(out.toByteArray());
+
+ }
+ return nImage;
+ }
+
+ /**
+ * 鐩栭獞缂濈珷
+ *
+ * @param infilePath 鍘烶DF璺緞
+ * @param outFilePath 杈撳嚭PDF璺緞
+ */
+ public static void stamperCheckMarkPDF(String infilePath, String outFilePath, String picPath) throws IOException, DocumentException {
+ PdfReader reader = new PdfReader(infilePath);//閫夋嫨闇�瑕佸嵃绔犵殑pdf
+ PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(outFilePath));//鍔犲畬鍗扮珷鍚庣殑pdf
+
+
+ com.itextpdf.text.Rectangle pageSize = reader.getPageSize(1);//鑾峰緱绗竴椤�
+ float height = pageSize.getHeight();
+ float width = pageSize.getWidth();
+
+ int nums = reader.getNumberOfPages();
+ com.itextpdf.text.Image[] nImage = slicingImages(picPath, nums);//鐢熸垚楠戠紳绔犲垏鍓插浘鐗�
+
+ for (int n = 1; n <= nums; n++) {
+ PdfContentByte over = stamp.getOverContent(n);//璁剧疆鍦ㄧ鍑犻〉鎵撳嵃鍗扮珷
+ com.itextpdf.text.Image img = nImage[n - 1];//閫夋嫨鍥剧墖
+ float newHeight = 100f;
+ float newWidth = img.getWidth() / (img.getHeight() / 100);
+ img.scaleAbsolute(newWidth, newHeight);//鎺у埗鍥剧墖澶у皬
+ img.setAbsolutePosition(width - newWidth, height / 2 - newHeight / 2);//鎺у埗鍥剧墖浣嶇疆
+ over.addImage(img);
+ }
+ stamp.close();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
+ public void isRawMaterial(InsOrder insOrder,Boolean registerInsResults,Boolean hasExemption) {
+ IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>()
+ .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()));
+ if (Objects.isNull(one)) {
+ throw new ErrorException("鎵句笉鍒板師鏉愭枡淇℃伅");
+ }
+ // 鍒ゆ柇鏄惁鏈変笉鍚堟牸淇℃伅
+ Long count = insUnqualifiedHandlerMapper.selectCount(Wrappers.<InsUnqualifiedHandler>lambdaQuery()
+ .eq(InsUnqualifiedHandler::getInventoryQuantityId, one.getId()));
+ String toLocation = null;
+
+ // 鍒ゆ柇鏄惁鏈変笉鍚堟牸
+ Long unqualifiedCount = getUnqualifiedCount(insOrder);
+
+ if (count.equals(0L) && unqualifiedCount.equals(0L) && one.getIsFinish().equals(0)
+ && one.getIsSource().equals(1) && Boolean.TRUE.equals(registerInsResults)) {
+ // 鍘熸潗鏂欑Щ搴�
+ //濡傛灉鏄媶鍒嗙殑璁㈠崟锛屽垯鎶婃媶鍒嗙殑鎵�鏈夋壒娆¢兘绉诲簱
+ if(one.getIsSplitOrder()==1 && !hasExemption){
+ //鏌ヨ鎷嗗垎璁㈠崟璇︽儏
+ List<IfsInventoryQuantityVO> ifsInventoryQuantityVOS = ifsInventoryQuantityMapper.selectSplitOrderList(one.getPartNo(), one.getLineNo(), one.getReleaseNo(), one.getReceiptNo(), one.getOrderNo());
+ for (IfsInventoryQuantityVO vo : ifsInventoryQuantityVOS) {
+ //濡傛灉鏈夊鎵樺崟淇℃伅涓斿悎鏍硷紝璧扮櫥璁板悗绉诲簱锛涘鏋滄病鏈夛紝鍒欒蛋鍏嶆锛涗笉鍚堟牸涓嶅仛澶勭悊
+ if(Objects.isNull(vo.getInsOrderId())){
+ rawMaterialOrderService.rawOrderRelease(vo.getId(), vo.getPartDesc());
+ }else if(Objects.equals(vo.getInsOrderId(),insOrder.getId())){
+ toLocation = insOrderService.moveRawMaterial(vo);
+ }else if(Objects.nonNull(vo.getInsResult()) && 1 == vo.getInsResult()){
+ toLocation = insOrderService.moveRawMaterial(vo);
+ }
+ }
+ }else{
+ toLocation = insOrderService.moveRawMaterial(one);
+ }
+ }
+
+ // 鍒ゆ柇缁撴潫鐘舵�佷慨鏀瑰悎鏍肩姸鎬�
+ int inspectStatus = (count == 0 && unqualifiedCount == 0) ? 1 : 2;
+ insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, insOrder.getId())
+ .set(InsOrder::getInsResult, inspectStatus));
+
+ if (one.getIsFinish().equals(0)) {
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())
+ .set(IfsInventoryQuantity::getInspectStatus, inspectStatus));
+
+ // 淇敼ifs搴撳瓨鐘舵��
+ if (StringUtils.isBlank(toLocation)) {
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getIsFinish, 1)
+ .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()));
+ } else {
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getIsFinish, 1)
+ .set(IfsInventoryQuantity::getToLocation, toLocation)
+ .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()));
+ }
+
+ threadPoolTaskExecutor.execute(() -> {
+ // 浼佷笟寰俊閫氱煡
+ String message = "";
+ message += "妫�娴嬬粨鏋滄彁浜ら�氱煡";
+ message += "\n鎵规鍙�: " + one.getUpdateBatchNo();
+ message += "\n闆朵欢鍙�: " + one.getPartNo();
+ message += "\n闆朵欢鎻忚堪: " + one.getPartDesc();
+ message += "\n渚涘簲鍟嗗悕绉�: " + one.getSupplierName();
+ message += "\n鎶佃揪鏁伴噺: " + one.getQtyArrived().stripTrailingZeros().toPlainString() + one.getBuyUnitMeas();
+ // 鍙戦�佷紒涓歩nspectStatus淇¢�氱煡
+ if (inspectStatus == 1) {
+ message += "\n妫�娴嬬粨鏋�: 鍚堟牸";
+ } else {
+ message += "\n妫�娴嬬粨鏋�: 涓嶅悎鏍�";
+ }
+ WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
+ });
+
+ }
+
+
+ }
+
+ /**
+ * 鍒ゆ柇鏄惁鏈変笉鍚堟牸
+ * @param insOrder
+ * @return
+ */
+ @Override
+ public Long getUnqualifiedCount(InsOrder insOrder) {
+ Long unqualifiedCount = 0L;
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, insOrder.getId()));
+ if (CollectionUtils.isNotEmpty(insSamples)) {
+ unqualifiedCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
+ .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList()))
+ .eq(InsProduct::getInsResult, 0));
+
+ // 鍒ゆ柇濡傛灉鏈変笉鍚堟牸鐨勬楠岄」, 鍒ゆ柇鏈夋病鏈夋楠岄」澶嶆祴, 澶嶆牳鍚堟牸涔熺畻鍚堟牸閫氳繃
+ if (!unqualifiedCount.equals(0L)) {
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList()))
+ .eq(InsProduct::getInsResult, 0));
+
+ boolean flag = true;
+ for (InsProduct insProduct : insProducts) {
+ Long unqualifiedProductCount = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery()
+ .eq(InsUnqualifiedRetestProduct::getInsProductId, insProduct.getId())
+ .ne(InsUnqualifiedRetestProduct::getInsResult, 0));
+ if (unqualifiedProductCount != 2) {
+ flag = false;
+ }
+ }
+ if (flag) {
+ unqualifiedCount = 0L;
+ }
+ }
+ }
+ return unqualifiedCount;
+ }
+
+ /**
+ * 閫�鍥炲埌妫�楠屼换鍔�
+ * @param id
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean sendBackTask(Integer id) {
+ InsReport report = insReportMapper.selectById(id);
+ // 鏍规嵁璁㈠崟鏌ヨ璇曢獙瀹�
+ String laboratory = insOrderMapper.selectLaboratoryByOrderId(report.getInsOrderId());
+
+ // 淇敼璁㈠崟鐘舵��
+ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, report.getInsOrderId())
+ .eq(InsOrderState::getLaboratory, laboratory)
+ .set(InsOrderState::getInsState, 4));
+
+ Integer insSampleId = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery()
+ .eq(InsSampleUser::getInsSampleId, report.getInsOrderId())
+ .orderByDesc(InsSampleUser::getId)
+ .last("limit 1")).getId();
+ insSampleUserMapper.deleteById(insSampleId);
+
+ // 淇敼鎶ュ憡琛屼负鏈樉绀�
+ insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate()
+ .eq(InsReport::getId, id)
+ .set(InsReport::getIsPass, 0));
+
+ return false;
+ }
+
+ /**
+ * 鎶ュ憡鎶ヨ〃瀵煎嚭
+ * @param dto
+ * @param response
+ */
+ @Override
+ public void reportAllExport(ReportPageDto dto, HttpServletResponse response) throws UnsupportedEncodingException {
+
+ Integer createOrderUser = dto.getCreateOrderUser();
+ String queryStatus = dto.getQueryStatus();
+ dto.setQueryStatus(null);
+ dto.setCreateOrderUser(null);
+
+ List<InsReportExport> insReportExports = insReportMapper.reportAllExport(QueryWrappers.queryWrappers(dto),
+ SecurityUtils.getUserId().intValue(),
+ queryStatus,
+ createOrderUser);
+
+ response.setContentType("application/vnd.ms-excel");
+ response.setCharacterEncoding("UTF-8");
+ // 杩欓噷URLEncoder.encode鍙互闃叉涓枃涔辩爜 褰撶劧鍜宔asyexcel娌℃湁鍏崇郴
+ String fileName = URLEncoder.encode("鎶ュ憡鎶ヨ〃瀵煎嚭", "UTF-8");
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+ try {
+ //鏂板缓ExcelWriter
+ ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build();
+ //鑾峰彇sheet0瀵硅薄
+ WriteSheet mainSheet = EasyExcel.writerSheet(0, "鎶ュ憡鎶ヨ〃瀵煎嚭").head(InsReportExport.class).build();
+
+ //鍚憇heet0鍐欏叆鏁版嵁 浼犲叆绌簂ist杩欐牱鍙鍑鸿〃澶�
+ excelWriter.write(insReportExports, mainSheet);
+ //鍏抽棴娴�
+ excelWriter.finish();
+ } catch (IOException e) {
+ throw new RuntimeException("瀵煎嚭澶辫触");
+ }
+
+
+ }
+
+
+ /**
+ * 鍏堜慨鏀归噰璐鍗曟壒娆″彿, 鍚庤繘琛岀Щ搴撴搷浣�
+ * @param one
+ * @param toLocation
+ */
+ private void updaeBatch(IfsInventoryQuantity one, String toLocation) {
+ if (one.getIsUpdateBatch().equals(0)) {
+ // 鍏堜慨鏀规壒娆″彿鍚庤繘琛岀Щ搴�
+ Map<String, Object> resultMap = new HashMap<>();
+ List<Map<String, Object>> resultList = new ArrayList<>();
+ Map<String, Object> map = new HashMap<>();
+ map.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ map.put("LINE_NO", one.getLineNo()); // 琛屽彿
+ map.put("RELEASE_NO", one.getReleaseNo()); // 涓嬭揪鍙�
+ map.put("RECEIPT_NO", one.getReceiptNo()); // 鎺ユ敹鍙�
+ map.put("PART_NO", one.getPartNo()); //闆朵欢鍙�
+ map.put("CONFIGURATION_ID", one.getConfigurationId()); // 閰嶇疆鏍囪瘑
+ map.put("LOCATION_NO", one.getLocationNo()); // 搴撲綅鍙�
+ map.put("LOT_BATCH_NO", one.getLotBatchNo());// 鎵规鍙�
+ map.put("NEW_LOT_BATCH_NO", one.getUpdateBatchNo()); // 鐩爣鎵规鍙�
+ map.put("SERIAL_NO", one.getSerialNo()); // 搴忓垪鍙�
+ map.put("ENG_CHG_LEVEL", one.getEngChgLevel()); // 鐗堟湰鍙�
+ map.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); // wdr鍙�
+ map.put("ACTIVITY_SEQ", one.getActivitySeq()); // 娲诲姩搴忓彿
+ map.put("QTY_TO_CHANGE", one.getQtyArrived()); // 鍙樻洿鏁伴噺
+ resultList.add(map);
+ resultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ resultMap.put("SYSCODE", "LIMS");
+ resultMap.put("SYSMODEL", "淇敼閲囪喘璁㈠崟鎵规鍙�");
+ resultMap.put("BATCH_INFO", resultList);
+
+ Result result = ifsApiUtils.updateMoveReceiptLot(JSONUtil.toJsonStr(resultMap));
+
+ if (result.getCode() != 200) {
+ throw new ErrorException("IFS淇敼鎵规鍙峰け璐�: " + result.getMsg());
+ }
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .set(IfsInventoryQuantity::getIsUpdateBatch, 1)
+ .eq(IfsInventoryQuantity::getId, one.getId()));
+ }
+
+ Map<String, Object> moveResultMap = new HashMap<>();
+ List<Map<String, Object>> moveResultList = new ArrayList<>();
+ Map<String, Object> moveMap = new HashMap<>();
+ moveMap.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ moveMap.put("LINE_NO", one.getLineNo());
+ moveMap.put("RELEASE_NO", one.getReleaseNo());
+ moveMap.put("RECEIPT_NO", one.getReceiptNo());
+ moveMap.put("PART_NO", one.getPartNo());
+ moveMap.put("QTY", one.getQtyArrived());
+ moveMap.put("LOCATION_NO", one.getLocationNo());
+ moveMap.put("TO_LOCATION_NO", toLocation);
+ moveMap.put("LOT_BATCH_NO", one.getUpdateBatchNo());
+ moveMap.put("SERIAL_NO", one.getSerialNo());
+ moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo());
+ moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel());
+ moveMap.put("ACTIVITY_SEQ", one.getActivitySeq());
+ moveResultList.add(moveMap);
+ moveResultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ moveResultMap.put("SYSCODE", "LIMS");
+ moveResultMap.put("SYSMODEL", "妫�楠屽悗绉诲簱");
+ moveResultMap.put("BATCH_INFO", moveResultList);
+
+ Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap));
+ if (result1.getCode() != 200) {
+ throw new ErrorException("IFS妫�楠屽悗绉诲簱澶辫触: " + result1.getMsg());
+ }
+
+ }
+
+ /**
+ * 鏇挎崲娈佃惤鏂囨湰
+ * @param filePath docx瑙f瀽瀵硅薄
+ * @param textMap 闇�瑕佹浛鎹㈢殑淇℃伅闆嗗悎
+ */
+ public static void changeText(Map<String, String> textMap, String filePath) {
+ try {
+ FileInputStream stream = new FileInputStream(filePath);
+ XWPFDocument document = new XWPFDocument(stream);
+ List<XWPFTable> tables = document.getTables();
+ for (XWPFTable table : tables) {
+ for (XWPFTableRow row : table.getRows()) {
+ for (XWPFTableCell cell : row.getTableCells()) {
+
+ textMap.forEach((s, s2) -> {
+ if (cell.getText().equals(s)) {
+ XWPFParagraph paragraph = cell.getParagraphs().get(0);
+ XWPFRun oldRun = paragraph.getRuns().get(0);
+ // 淇濆瓨鍘熸牱寮�
+ String fontFamily = oldRun.getFontFamily();
+ int fontSize = oldRun.getFontSize();
+ String color = oldRun.getColor();
+ ParagraphAlignment alignment = paragraph.getAlignment();
+ // 鏇挎崲鍐呭
+ paragraph.removeRun(0); // 绉婚櫎鍘熸湁鐨� run
+ XWPFRun newRun = paragraph.createRun();
+ newRun.setText(s2);
+ // 搴旂敤鍘熸牱寮�
+ newRun.setFontFamily(fontFamily);
+ newRun.setFontSize(fontSize);
+ newRun.setColor(color);
+ paragraph.setAlignment(alignment);
+ }
+ });
+ }
+ }
+ }
+ FileOutputStream fileOutputStream = new FileOutputStream(filePath);
+ document.write(fileOutputStream);
+ fileOutputStream.close();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ErrorException(e.getMessage());
+ }
+ }
+
+ /**
+ * word杞崲pdf
+ * @param path
+ * @return
+ */
+ private String wordToPdfTemp(String path) {
+ try {
+ return wordToPdf(path, path.replace(".docx", "-涓存椂.pdf"));
+ } catch (Exception e) {
+ throw new ErrorException("杞崲澶辫触");
+ }
+ }
+
+ private String wordToPdf(String wordPath, String pdfPath) {
+ FileOutputStream os = null;
+ try {
+ //鍑瘉 涓嶇劧鍒囨崲鍚庢湁姘村嵃
+ InputStream is = new ClassPathResource("/lib/license.xml").getInputStream();
+ License license = new License();
+ license.setLicense(is);
+ if (!license.getIsLicensed()) {
+ log.info("License楠岃瘉涓嶉�氳繃...");
+ return null;
+ }
+ //鐢熸垚涓�涓┖鐨凱DF鏂囦欢
+ File file;
+ //鍒ゆ柇鏄惁鏄繘鍘傛姤鍛�
+ file = new File(pdfPath);
+ os = new FileOutputStream(file);
+ //瑕佽浆鎹㈢殑word鏂囦欢
+ com.aspose.words.Document doc = new com.aspose.words.Document(wordPath);
+ doc.save(os, SaveFormat.PDF);
+ return file.getName();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (os != null) {
+ try {
+ os.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
+}
+
+
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleReceiptServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleReceiptServiceImpl.java
new file mode 100644
index 0000000..c10a4be
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleReceiptServiceImpl.java
@@ -0,0 +1,165 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.SampleReceiptActionDto;
+import com.ruoyi.inspect.dto.SampleReceiptPageDto;
+import com.ruoyi.inspect.dto.SampleReceiptQueryDto;
+import com.ruoyi.inspect.mapper.InsOrderMapper;
+import com.ruoyi.inspect.mapper.InsOrderStandardTemplateMapper;
+import com.ruoyi.inspect.mapper.InsProductMapper;
+import com.ruoyi.inspect.mapper.InsSampleMapper;
+import com.ruoyi.inspect.mapper.InsSampleReceiptMapper;
+import com.ruoyi.inspect.mapper.InsSampleUserMapper;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsOrderStandardTemplate;
+import com.ruoyi.inspect.pojo.InsProduct;
+import com.ruoyi.inspect.pojo.InsSample;
+import com.ruoyi.inspect.pojo.InsSampleReceipt;
+import com.ruoyi.inspect.pojo.InsSampleUser;
+import com.ruoyi.inspect.service.InsOrderService;
+import com.ruoyi.inspect.service.InsOrderStateService;
+import com.ruoyi.inspect.service.InsSampleReceiptService;
+import com.ruoyi.system.mapper.UserMapper;
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+@Service
+@AllArgsConstructor
+public class InsSampleReceiptServiceImpl extends ServiceImpl<InsSampleReceiptMapper, InsSampleReceipt>
+ implements InsSampleReceiptService {
+ private final InsSampleReceiptMapper receiptMapper;
+ private final InsOrderMapper insOrderMapper;
+ private final InsOrderStandardTemplateMapper insOrderStandardTemplateMapper;
+ private final InsSampleMapper insSampleMapper;
+ private final InsProductMapper insProductMapper;
+ private final InsSampleUserMapper insSampleUserMapper;
+ private final InsOrderStateService insOrderStateService;
+ private final InsOrderService insOrderService;
+ private final UserMapper userMapper;
+
+ @Override
+ public com.baomidou.mybatisplus.core.metadata.IPage<SampleReceiptPageDto> page(Page<?> page, SampleReceiptQueryDto query) {
+ return receiptMapper.selectPage(page, query);
+ }
+
+ @Override
+ public SampleReceiptPageDto detail(Integer id) {
+ return receiptMapper.selectDetail(id);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void submit(SampleReceiptActionDto dto) {
+ if (dto == null || dto.getReceiptId() == null || dto.getMainInspectorId() == null) {
+ throw new ErrorException("璇烽�夋嫨涓绘楠屼汉");
+ }
+ InsSampleReceipt receipt = receiptMapper.selectForUpdate(dto.getReceiptId());
+ ensurePending(receipt);
+ InsOrder order = insOrderMapper.selectById(receipt.getInsOrderId());
+ if (order == null || !Integer.valueOf(1).equals(order.getState())) {
+ throw new ErrorException("璇ュ鎵樺綋鍓嶇姸鎬佷笉鍏佽鏍峰搧鎺ユ敹");
+ }
+ List<InsSample> samples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
+ .eq(InsSample::getInsOrderId, order.getId()).orderByAsc(InsSample::getId));
+ if (samples.size() != 1 || !samples.get(0).getId().equals(receipt.getInsSampleId())) {
+ throw new ErrorException("璇ュ鎵樼殑鏍峰搧鏁伴噺寮傚父锛岃妫�鏌ヤ笅鍗曟暟鎹�");
+ }
+ InsSample sample = samples.get(0);
+ // 鍙蛋鏂拌仛鐩寸粦妯℃澘娴佺▼锛氬鎵樺崟蹇呴』宸茬粦瀹氬師濮嬭褰曟ā鏉匡紙涓嬪崟鏃剁敓鎴愯鍗曟ā鏉垮揩鐓э級
+ Long snapshotCount = insOrderStandardTemplateMapper.selectCount(Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+ .eq(InsOrderStandardTemplate::getInsOrderId, order.getId()));
+ if (snapshotCount == 0) {
+ throw new ErrorException("璇ュ鎵樻湭缁戝畾鍘熷璁板綍妯℃澘锛屼笉鑳芥彁浜ゆ楠�");
+ }
+ Long productCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, sample.getId()).eq(InsProduct::getState, 1));
+ if (productCount == 0) {
+ throw new ErrorException("璇ュ鎵樻湭缁戝畾妫�楠岄」鐩紝涓嶈兘鎻愪氦妫�楠�");
+ }
+ if (userMapper.selectById(dto.getMainInspectorId()) == null) {
+ throw new ErrorException("涓绘楠屼汉涓嶅瓨鍦ㄦ垨宸插仠鐢�");
+ }
+ if (insOrderStateService.count(Wrappers.lambdaQuery(com.ruoyi.inspect.pojo.InsOrderState.class)
+ .eq(com.ruoyi.inspect.pojo.InsOrderState::getInsOrderId, order.getId())) > 0
+ || insSampleUserMapper.selectCount(Wrappers.<InsSampleUser>lambdaQuery()
+ .eq(InsSampleUser::getInsSampleId, order.getId())) > 0) {
+ throw new ErrorException("璇ュ鎵樺凡杩涘叆妫�楠屼换鍔★紝涓嶈兘閲嶅鎻愪氦");
+ }
+ String appointed = LocalDateTime.now().plusHours(insProductMapper.selectOrderManDay(order.getId()))
+ .format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+ insOrderService.upInsOrder(order.getId(), sample.getId(), appointed, dto.getMainInspectorId(), null);
+ receipt.setStatus(1);
+ receipt.setMainInspectorId(dto.getMainInspectorId());
+ receipt.setReceiveUserId(SecurityUtils.getUserId().intValue());
+ receipt.setReceiveTime(LocalDateTime.now());
+ receipt.setSubmitTime(LocalDateTime.now());
+ receiptMapper.updateById(receipt);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void reject(SampleReceiptActionDto dto) {
+ if (dto == null || dto.getReceiptId() == null || StringUtils.isBlank(dto.getRemark())) {
+ throw new ErrorException("璇峰~鍐欐嫆鏀跺娉�");
+ }
+ if (dto.getRemark().trim().length() > 500) {
+ throw new ErrorException("鎷掓敹澶囨敞涓嶈兘瓒呰繃500涓瓧绗�");
+ }
+ InsSampleReceipt receipt = receiptMapper.selectForUpdate(dto.getReceiptId());
+ ensurePending(receipt);
+ if (insOrderStateService.count(Wrappers.lambdaQuery(com.ruoyi.inspect.pojo.InsOrderState.class)
+ .eq(com.ruoyi.inspect.pojo.InsOrderState::getInsOrderId, receipt.getInsOrderId())) > 0) {
+ throw new ErrorException("璇ュ鎵樺凡杩涘叆妫�楠屼换鍔★紝涓嶈兘鎷掓敹");
+ }
+ receipt.setStatus(2);
+ receipt.setRejectRemark(dto.getRemark().trim());
+ receipt.setReceiveUserId(SecurityUtils.getUserId().intValue());
+ receipt.setReceiveTime(LocalDateTime.now());
+ receiptMapper.updateById(receipt);
+ InsOrder order = new InsOrder();
+ order.setId(receipt.getInsOrderId());
+ order.setState(5);
+ insOrderMapper.updateById(order);
+ }
+
+ private void ensurePending(InsSampleReceipt receipt) {
+ if (receipt == null || !Integer.valueOf(0).equals(receipt.getStatus())) {
+ throw new ErrorException("璇ユ牱鍝佹帴鏀惰褰曞凡琚鐞嗭紝璇峰埛鏂板悗閲嶈瘯");
+ }
+ }
+
+ @Override
+ public void export(SampleReceiptQueryDto query, HttpServletResponse response) {
+ List<SampleReceiptPageDto> list = receiptMapper.selectExportList(query);
+ response.setContentType("application/vnd.ms-excel");
+ response.setCharacterEncoding("UTF-8");
+ try {
+ String fileName = URLEncoder.encode("鏍峰搧鎺ユ敹瀵煎嚭", "UTF-8");
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+ ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream())
+ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build();
+ WriteSheet sheet = EasyExcel.writerSheet(0, "鏍峰搧鎺ユ敹瀵煎嚭").head(SampleReceiptPageDto.class).build();
+ excelWriter.write(list, sheet);
+ excelWriter.finish();
+ } catch (IOException e) {
+ throw new RuntimeException("瀵煎嚭澶辫触");
+ }
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleServiceImpl.java
new file mode 100644
index 0000000..f21c463
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleServiceImpl.java
@@ -0,0 +1,33 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.InsSampleMapper;
+import com.ruoyi.inspect.pojo.InsSample;
+import com.ruoyi.inspect.service.InsSampleService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_sample(妫�楠屾牱鍝�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2024-03-14 17:14:57
+*/
+@Service
+public class InsSampleServiceImpl extends ServiceImpl<InsSampleMapper, InsSample>
+ implements InsSampleService {
+
+ /**
+ * 鏍规嵁璁㈠崟id鏌ヨ鏍峰搧
+ * @param insOrderId
+ * @return
+ */
+ @Override
+ public List<InsSample> getSampleByOrderId(Integer insOrderId) {
+ return baseMapper.getSampleByOrderId(insOrderId);
+ }
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedHandlerFileServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedHandlerFileServiceImpl.java
new file mode 100644
index 0000000..2ee87f4
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedHandlerFileServiceImpl.java
@@ -0,0 +1,76 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.core.lang.UUID;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.mapper.InsUnqualifiedHandlerFileMapper;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandlerFile;
+import com.ruoyi.inspect.service.InsUnqualifiedHandlerFileService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑ns_unqualified_handler_file(涓嶅悎鏍煎鐞嗛檮浠惰褰曡〃)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2024-07-31 13:38:38
+*/
+@Service
+@Slf4j
+public class InsUnqualifiedHandlerFileServiceImpl extends ServiceImpl<InsUnqualifiedHandlerFileMapper, InsUnqualifiedHandlerFile>
+ implements InsUnqualifiedHandlerFileService {
+
+ @Value("${wordUrl}")
+ private String wordUrl;
+
+ @Value("${file.path}")
+ private String imgUrl;
+
+ @Override
+ public InsUnqualifiedHandlerFile uploadFile(Long handlerId, MultipartFile file) {
+ String urlString;
+ String pathName;
+ String path;
+ String prefix;
+ String filename = file.getOriginalFilename();
+ String contentType = file.getContentType();
+ InsUnqualifiedHandlerFile unqualifiedHandlerFile = new InsUnqualifiedHandlerFile();
+// unqualifiedHandlerFile.setUnqualifiedId(handlerId);
+ unqualifiedHandlerFile.setFileName(filename);
+ if (contentType != null && contentType.startsWith("image/")) {
+ // 鏄浘鐗�
+ path = imgUrl;
+ prefix = "/image/";
+ unqualifiedHandlerFile.setType(1);
+ } else {
+ // 鏄枃浠�
+ path = wordUrl;
+ prefix = "/word/";
+ unqualifiedHandlerFile.setType(2);
+ }
+ try {
+ File realpath = new File(path);
+ if (!realpath.exists()) {
+ realpath.mkdirs();
+ }
+ pathName = UUID.randomUUID() + "_" + file.getOriginalFilename();
+ urlString = realpath + "/" + pathName;
+ file.transferTo(new File(urlString));
+ unqualifiedHandlerFile.setFileUrl(pathName);
+ baseMapper.insert(unqualifiedHandlerFile);
+ return unqualifiedHandlerFile;
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("闄勪欢涓婁紶閿欒");
+ throw new ErrorException(e.getMessage());
+ }
+ }
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedHandlerServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedHandlerServiceImpl.java
new file mode 100644
index 0000000..fc31ee6
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedHandlerServiceImpl.java
@@ -0,0 +1,128 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.UnqualifiedHandlerDto;
+import com.ruoyi.inspect.mapper.InsOrderMapper;
+import com.ruoyi.inspect.mapper.InsUnqualifiedHandlerMapper;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandler;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandlerFile;
+import com.ruoyi.inspect.service.InsUnqualifiedHandlerFileService;
+import com.ruoyi.inspect.service.InsUnqualifiedHandlerService;
+import com.ruoyi.inspect.vo.UnqualifiedHandlerVO;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import jakarta.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author 27233
+ * @description 閽堝琛ㄣ�恑ns_unqualified_handler(涓嶅悎鏍煎鐞嗚〃)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+ * @createDate 2024-07-31 13:38:14
+ */
+@Service
+public class InsUnqualifiedHandlerServiceImpl extends ServiceImpl<InsUnqualifiedHandlerMapper, InsUnqualifiedHandler>
+ implements InsUnqualifiedHandlerService {
+ @Resource
+ private InsUnqualifiedHandlerFileService insUnqualifiedHandlerFileService;
+ @Resource
+ private InsOrderMapper insOrderMapper;
+
+
+ @Override
+ public IPage<UnqualifiedHandlerVO> pageList(Page page, UnqualifiedHandlerDto unqualifiedHandlerDto) {
+ return baseMapper.selectPageList(page, QueryWrappers.queryWrappers(unqualifiedHandlerDto));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean addUnqualifiedHandler(UnqualifiedHandlerDto unqualifiedHandlerDto) {
+ if (unqualifiedHandlerDto.getInventoryQuantityId() == null) {
+ throw new ErrorException("缂哄皯鍘熸潗鏂檌d");
+ }
+ long count = this.count(Wrappers.<InsUnqualifiedHandler>lambdaQuery()
+ .eq(InsUnqualifiedHandler::getInsOrderId, unqualifiedHandlerDto.getInsOrderId()));
+ if (count > 0) {
+ throw new ErrorException("褰撳墠妫�楠屽崟宸叉彁浜よ繃涓嶅悎鏍�");
+ }
+ // 鍘熸潗鏂欑紪鍙峰垏鍓�
+ InsOrder order = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getId, unqualifiedHandlerDto.getInsOrderId())
+ .select(InsOrder::getEntrustCode));
+ unqualifiedHandlerDto.setNo(order.getEntrustCode());
+
+ this.save(unqualifiedHandlerDto);
+ if (CollectionUtils.isNotEmpty(unqualifiedHandlerDto.getUnqualifiedHandlerFiles())) {
+ for (InsUnqualifiedHandlerFile unqualifiedHandlerFile : unqualifiedHandlerDto.getUnqualifiedHandlerFiles()) {
+ unqualifiedHandlerFile.setUnqualifiedId(unqualifiedHandlerDto.getId());
+ }
+ insUnqualifiedHandlerFileService.updateBatchById(unqualifiedHandlerDto.getUnqualifiedHandlerFiles());
+ }
+
+ return true;
+ }
+
+ /**
+ * 缂栬緫涓嶅悎鏍煎鐞�
+ * @param unqualifiedHandlerDto
+ * @return
+ */
+ @Override
+ public boolean updateUnqualifiedHandler(UnqualifiedHandlerDto unqualifiedHandlerDto) {
+ // 鍒犻櫎闄勪欢, 閲嶆柊娣诲姞
+ insUnqualifiedHandlerFileService.remove(Wrappers.<InsUnqualifiedHandlerFile>lambdaQuery()
+ .eq(InsUnqualifiedHandlerFile::getUnqualifiedId, unqualifiedHandlerDto.getId()));
+ if (CollectionUtils.isNotEmpty(unqualifiedHandlerDto.getUnqualifiedHandlerFiles())) {
+ for (InsUnqualifiedHandlerFile unqualifiedHandlerFile : unqualifiedHandlerDto.getUnqualifiedHandlerFiles()) {
+ unqualifiedHandlerFile.setUnqualifiedId(unqualifiedHandlerDto.getId());
+ }
+ insUnqualifiedHandlerFileService.updateBatchById(unqualifiedHandlerDto.getUnqualifiedHandlerFiles());
+ }
+
+ return this.updateById(unqualifiedHandlerDto);
+ }
+
+ /**
+ * 鏌ョ湅涓嶅悎鏍煎鐞嗙晫闈�
+ * @param id
+ * @return
+ */
+ @Override
+ public UnqualifiedHandlerDto getUnqualifiedHandler(Integer id) {
+ InsUnqualifiedHandler insUnqualifiedHandler = this.getById(id);
+ UnqualifiedHandlerDto unqualifiedHandlerDto = new UnqualifiedHandlerDto();
+ BeanUtil.copyProperties(insUnqualifiedHandler, unqualifiedHandlerDto);
+ // 鏌ョ湅闄勪欢
+ List<InsUnqualifiedHandlerFile> list = insUnqualifiedHandlerFileService.list(Wrappers.<InsUnqualifiedHandlerFile>lambdaQuery()
+ .eq(InsUnqualifiedHandlerFile::getUnqualifiedId, unqualifiedHandlerDto.getId()));
+ unqualifiedHandlerDto.setUnqualifiedHandlerFiles(list);
+ return unqualifiedHandlerDto;
+ }
+
+ /**
+ * 鍒犻櫎涓嶅悎鏍�
+ * @param id
+ * @return
+ */
+ @Override
+ public boolean deleteUnqualifiedHandler(Integer id) {
+ insUnqualifiedHandlerFileService.remove(Wrappers.<InsUnqualifiedHandlerFile>lambdaQuery()
+ .eq(InsUnqualifiedHandlerFile::getUnqualifiedId, id));
+ this.removeById(id);
+ return true;
+ }
+}
+
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedRetestProductServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedRetestProductServiceImpl.java
new file mode 100644
index 0000000..52edb38
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnqualifiedRetestProductServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.InsUnqualifiedRetestProductMapper;
+import com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct;
+import com.ruoyi.inspect.service.InsUnqualifiedRetestProductService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 涓嶅悎鏍兼楠岄」鐩娴�
+ *
+ * @author zhuo
+ * @since 2024-09-03
+ */
+@Service
+public class InsUnqualifiedRetestProductServiceImpl extends ServiceImpl<InsUnqualifiedRetestProductMapper, InsUnqualifiedRetestProduct> implements InsUnqualifiedRetestProductService {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/OutsourcingFinishProductInspectionServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/OutsourcingFinishProductInspectionServiceImpl.java
new file mode 100644
index 0000000..b5c8cea
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/OutsourcingFinishProductInspectionServiceImpl.java
@@ -0,0 +1,50 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.IfsInventoryQuantityDto;
+import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
+import com.ruoyi.basic.mapper.StandardTreeMapper;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
+import com.ruoyi.common.enums.OrderType;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.inspect.service.OutsourcingFinishProductInspectionService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 澶栬喘鎴愬搧妫�楠宻erviceImpl
+ */
+@Slf4j
+@Service
+public class OutsourcingFinishProductInspectionServiceImpl implements OutsourcingFinishProductInspectionService {
+
+ @Autowired
+ private StandardTreeMapper standardTreeMapper;
+
+ @Override
+ public IPage<IfsInventoryQuantityVO> getWarehouseSubmit(Page page, IfsInventoryQuantity ifsInventoryQuantity) {
+ ifsInventoryQuantity.setOrderType(OrderType.WG.getValue());
+ return standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
+ }
+
+ @Override
+ public IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
+ String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
+ String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
+ ifsInventoryQuantityDto.setBeginDeclareDate(null);
+ ifsInventoryQuantityDto.setEndDeclareDate(null);
+ ifsInventoryQuantityDto.setOrderType(OrderType.WG.getValue());
+ IPage<IfsInventoryQuantitySupplierDto> ifsByOver = standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+ ifsByOver.getRecords().forEach(r->r.setOrderTypeName(OrderType.getLabelByValue(r.getOrderType())));
+ return ifsByOver;
+ }
+
+ @Override
+ public IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) {
+ ifsInventoryQuantityDto.setOrderType(OrderType.WG.getValue());
+ return standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto));
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
new file mode 100644
index 0000000..58c5657
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -0,0 +1,1061 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.support.ExcelTypeEnum;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.*;
+import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
+import com.ruoyi.basic.mapper.StandardTreeMapper;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
+import com.ruoyi.common.config.WechatProperty;
+import com.ruoyi.common.constant.InsOrderTypeConstants;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.common.enums.OrderType;
+import com.ruoyi.common.numgen.NumberGenerator;
+import com.ruoyi.common.utils.LimsDateUtil;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.WxCpUtils;
+import com.ruoyi.common.utils.api.IfsApiUtils;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.CopperInsOrderDto;
+import com.ruoyi.inspect.dto.OrderSplitDTO;
+import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto;
+import com.ruoyi.inspect.dto.SampleProductDto;
+import com.ruoyi.inspect.excel.OrderSplitExcelData;
+import com.ruoyi.inspect.excel.OrderSplitExcelListener;
+import com.ruoyi.inspect.mapper.InsOrderMapper;
+import com.ruoyi.inspect.mapper.InsProductMapper;
+import com.ruoyi.inspect.mapper.InsSampleMapper;
+import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsReport;
+import com.ruoyi.inspect.service.IfsSplitOrderRecordService;
+import com.ruoyi.inspect.service.InsOrderService;
+import com.ruoyi.inspect.service.InsReportService;
+import com.ruoyi.inspect.service.RawMaterialOrderService;
+import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
+import com.ruoyi.system.mapper.UserMapper;
+import lombok.AllArgsConstructor;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
+/**
+ * @Author zhuo
+ * @Date 2024/7/31
+ */
+@Service
+@AllArgsConstructor
+public class RawMaterialOrderServiceImpl implements RawMaterialOrderService {
+
+ private StandardTreeMapper standardTreeMapper;
+ private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
+ private UserMapper userMapper;
+ private InsOrderService insOrderService;
+ private InsOrderMapper insOrderMapper;
+ private InsSampleMapper insSampleMapper;
+ private final NumberGenerator<InsOrder> numberGenerator;
+ private InsReportService insReportService;
+ private WechatProperty wechatProperty;
+ private ThreadPoolTaskExecutor threadPoolTaskExecutor;
+ private InsProductMapper insProductMapper;
+ private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper;
+ private IfsApiUtils ifsApiUtils;
+
+ private IfsSplitOrderRecordService ifsSplitOrderRecordService;
+
+ private final NumberGenerator<IfsSplitOrderRecord> splitOrderRecordNumberGenerator;
+
+ @Override
+ public Result selectStandardTreeListByPartNo(String partNo) {
+ List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeListByPartNo(partNo);
+ if (CollectionUtil.isEmpty(factoryDtos)) {
+ return Result.success(null, "闆朵欢鍙蜂负" + partNo + "鐨勫師鏉愭枡娌℃湁瀵瑰簲鐨勬爣鍑嗗簱閰嶇疆");
+ }
+ RawMaterialStandardTreeDto rawMaterialStandardTreeDto = new RawMaterialStandardTreeDto();
+ for (FactoryDto factoryDto : factoryDtos) {
+ for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
+ for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
+ if (sampleTypeDto.getChildren().isEmpty()) {
+ sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
+ }
+ // 鍒ゆ柇缁戝畾鐨勬槸鍚︽槸褰撳墠闆朵欢鍙�
+ if (sampleTypeDto.getPartNo() != null && sampleTypeDto.getPartNo().equals(partNo)) {
+ // 娣诲姞瀵硅薄
+ rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + " - "
+ + laboratoryDto.getValue() + " - "
+ + sampleTypeDto.getValue());
+ rawMaterialStandardTreeDto.setCode(sampleTypeDto.getCode());
+ rawMaterialStandardTreeDto.setLabel(sampleTypeDto.getLabel());
+ rawMaterialStandardTreeDto.setValue(sampleTypeDto.getValue());
+ rawMaterialStandardTreeDto.setChildren1(sampleTypeDto.getChildren());
+ } else {
+ for (SampleDto sampleDto : sampleTypeDto.getChildren()) {
+ if (sampleDto.getPartNo() != null && sampleDto.getPartNo().equals(partNo)) {
+ // 娣诲姞瀵硅薄
+ rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + " - "
+ + laboratoryDto.getValue() + " - "
+ + sampleTypeDto.getValue() + " - "
+ + sampleDto.getValue());
+ rawMaterialStandardTreeDto.setCode(sampleDto.getCode());
+ rawMaterialStandardTreeDto.setLabel(sampleDto.getLabel());
+ rawMaterialStandardTreeDto.setValue(sampleDto.getValue());
+ rawMaterialStandardTreeDto.setChildren2(sampleDto.getChildren());
+ }
+ }
+ }
+ }
+ }
+ }
+ return Result.success(rawMaterialStandardTreeDto);
+ }
+
+ @Override
+ public IPage<IfsInventoryQuantityVO> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) {
+ if(ifsInventoryQuantity.getIsInspect().equals(1)){
+ ifsInventoryQuantity.setOrderType(OrderType.RAW.getValue());
+ }
+ IPage<IfsInventoryQuantityVO> ifsInventoryQuantityIPage = standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
+ ifsInventoryQuantityIPage.getRecords().forEach(f->{
+ Long count = ifsInventoryQuantityMapper.selectCount(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+ .ne(IfsInventoryQuantity::getId,f.getId())
+ .eq(IfsInventoryQuantity::getUpdateBatchNo, f.getUpdateBatchNo()));
+ f.setLotBatchNoHasRepeat(count>0);
+ });
+ return ifsInventoryQuantityIPage;
+ }
+
+ @Override
+ public IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) {
+ ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
+ return standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto));
+ }
+
+
+ /**
+ * 鎶ユ
+ * @param ids
+ * @return
+ */
+ @Override
+ public int inspectionReport(List<Long> ids,String orderType,String materialProp) {
+ Integer userId = SecurityUtils.getUserId().intValue();
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .in(IfsInventoryQuantity::getId, ids)
+ .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName())
+ .set(IfsInventoryQuantity::getDeclareUserId, userId)
+ .set(IfsInventoryQuantity::getIsInspect, 1)
+ .set(IfsInventoryQuantity::getOrderType,orderType)
+ .set(IfsInventoryQuantity::getMaterialProp,materialProp)
+ .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now())
+ );
+ threadPoolTaskExecutor.execute(() -> {
+ List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+ .in(IfsInventoryQuantity::getId, ids));
+ // 浼佷笟寰俊閫氱煡
+ String message = "";
+ message += "鏂板鎶ユ閫氱煡";
+ for (IfsInventoryQuantity inventoryQuantity : quantityList) {
+ message += "\n鎵规鍙�: " + inventoryQuantity.getUpdateBatchNo();
+ message += "\n闆朵欢鎻忚堪: " + inventoryQuantity.getPartDesc();
+ message += "\n鎶佃揪鏁伴噺: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
+
+ // 鍒ゆ柇鏈夋病鏈夊埌20鍚�. 鎴栬�呰兘鍚﹀厤妫�
+ int result = notificationRawOrder(inventoryQuantity.getId());
+ switch (result) {
+ case 1:
+ message += "\n褰撳墠鏍峰搧宸叉楠岃繃, 鍙互鍏嶆";
+ break;
+ case 2:
+ message += "\n褰撳墠鏍峰搧宸茶秴杩�20鍚�";
+ break;
+ }
+ message += "\n";
+ }
+ WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
+ });
+ return 1;
+ }
+
+ /**
+ * 鎾ら攢鎶ユ
+ * @param id
+ * @return
+ */
+ @Override
+ public int revokeInspectionReport(Long id) {
+ return ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .eq(IfsInventoryQuantity::getId, id)
+ .set(IfsInventoryQuantity::getIsInspect, 0)
+ );
+ }
+
+ /**
+ * 鎵撳嵃鏍囩鏌ヨ
+ * @param ids
+ * @return
+ */
+ @Override
+ public List<IfsInventoryQuantityDto> printLabel(List<Integer> ids) {
+ return ifsInventoryQuantityMapper.printLabel(ids);
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
+ public Long getOrderCountByIfsId(Long ifsId) {
+ return insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getIfsInventoryId,ifsId).ne(InsOrder::getState,-1));
+ }
+
+ /**
+ * 鎶ユ
+ * @param ifsInventoryQuantity
+ * @return
+ */
+ @Override
+ public int inspectionReportOne(IfsInventoryQuantity ifsInventoryQuantity) {
+ Integer userId = SecurityUtils.getUserId().intValue();
+ boolean validateValue = OrderType.validateValue(ifsInventoryQuantity.getOrderType());
+ if(!validateValue){
+ throw new ErrorException("鎶ユ澶辫触锛岄潪娉曠殑閿�鍞鍗曞垎绫绘灇涓�");
+ }
+ //鎵规鍙峰瓧姣嶈浆澶у啓
+ ifsInventoryQuantity.setUpdateBatchNo(ifsInventoryQuantity.getUpdateBatchNo().trim().toUpperCase(Locale.ROOT));
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .eq(IfsInventoryQuantity::getId, ifsInventoryQuantity.getId())
+ .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName())
+ .set(IfsInventoryQuantity::getDeclareUserId, userId)
+ .set(IfsInventoryQuantity::getIsInspect, 1)
+ .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now())
+ .set(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo())
+ .set(IfsInventoryQuantity::getOrderType,ifsInventoryQuantity.getOrderType())
+ .set(IfsInventoryQuantity::getMaterialProp,ifsInventoryQuantity.getMaterialProp())
+ );
+
+ threadPoolTaskExecutor.execute(() -> {
+ IfsInventoryQuantity inventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryQuantity.getId());
+ //鏌ヨ鐩稿悓鎵瑰彿鐨勫巻鍙瞚fs璁㈠崟
+ List<IfsInventoryQuantity> historyRecords = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+ .ne(IfsInventoryQuantity::getId, ifsInventoryQuantity.getId())
+ .eq(IfsInventoryQuantity::getIsInspect, 1)
+ .eq(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo())
+ );
+ if(CollUtil.isEmpty(historyRecords)){
+ // 浼佷笟寰俊閫氱煡
+ String message = "";
+ message += "鏂板鎶ユ閫氱煡";
+ message += "\n鎵规鍙�: " + inventoryQuantity.getUpdateBatchNo();
+ message += "\n闆朵欢鎻忚堪: " + inventoryQuantity.getPartDesc();
+ message += "\n鎶佃揪鏁伴噺: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
+ WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
+ }else{
+ //鑾峰彇鍘嗗彶鎶佃揪鏁伴噺
+ double sum = historyRecords.stream().map(IfsInventoryQuantity::getQtyArrived).mapToDouble(BigDecimal::doubleValue).sum();
+ String historyQuantity = sum + inventoryQuantity.getBuyUnitMeas();
+ String messageMarkdown = "";
+ messageMarkdown += "鏂板鎶ユ閫氱煡";
+ messageMarkdown += "\n鎵规鍙�: <font color='warning'>" + inventoryQuantity.getUpdateBatchNo() + "</font>";
+ messageMarkdown += "\n闆朵欢鎻忚堪: "+ inventoryQuantity.getPartDesc();
+ messageMarkdown += "\n鎶佃揪鏁伴噺: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
+ messageMarkdown += "\n鍘嗗彶鎶佃揪鏁伴噺: " + historyQuantity;
+ WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), messageMarkdown,"markdown");
+ }
+ });
+ return 1;
+ }
+
+ /**
+ * 鑾峰彇閾滀骇涓氶摼妫�娴嬫暟鎹�
+ * @param id
+ * @return
+ */
+ @Override
+ public String getIndustryChain(Integer id) {
+ return ifsInventoryQuantityMapper.selectById(id).getIndustryChain();
+ }
+
+ /**
+ * 鍘熸潗鏂欐挙閿�鎺ュ彛
+ * @param ifsInventoryId
+ * @return
+ */
+ @Override
+ public boolean repealRawOrder(Long ifsInventoryId) {
+ // 鏌ヨ鍒ゆ柇鏄惁鏄摐鍗曚笣
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
+ if (ifsInventoryQuantity.getIsCopper() != null && ifsInventoryQuantity.getIsCopper().equals(1)) {
+ // 閾滃崟涓濈洿鎺ュ垹闄ゅ氨琛�
+ ifsInventoryQuantityMapper.deleteById(ifsInventoryId);
+ } else {
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getState, 0)
+ .set(IfsInventoryQuantity::getIsQuarter, 1)
+ .eq(IfsInventoryQuantity::getId, ifsInventoryId));
+ }
+
+ insOrderService.update(Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getIfsInventoryId, ifsInventoryId)
+ .set(InsOrder::getState, -1)
+ .set(InsOrder::getEntrustCode, ""));// 鎾ら攢
+ return true;
+ }
+
+ /**
+ * 鍘熸潗鏂欏厤妫�涓嬪崟
+ * @param list
+ * @param insOrder
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int addExemptionOrder(List<SampleProductDto> list, InsOrder insOrder) {
+ if (!insOrder.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) {
+ throw new ErrorException("鍙湁杩涘巶妫�楠屾墠鑳藉厤妫�");
+ }
+ insOrder.setSendTime(LocalDateTime.now());
+ // 淇敼璁㈠崟琛ㄧ洿鎺ヤ负宸叉楠�
+ insOrder.setState(4);
+ insOrder.setTypeSource(1);
+
+ String code = "Y";
+ // 鐢熸垚缂栧彿
+ String no = numberGenerator.generateNumberWithPrefix(3,
+ "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
+ InsOrder::getEntrustCode);
+
+ insOrderMapper.insert(insOrder); // 涓昏〃
+
+ AtomicInteger count = new AtomicInteger();
+ list.forEach(a -> {
+ count.getAndIncrement();
+ a.setId(null);
+ a.setInsOrderId(insOrder.getId());
+ if (StrUtil.isEmpty(a.getSampleCode())) {
+ // 濡傛灉鍙湁涓�涓牱鍝佸氨涓嶉渶瑕佹嫾鎺ユ暟瀛�
+ if (list.size() != 1) {
+ a.setSampleCode(no + "-" + count.get());
+ } else {
+ a.setSampleCode(no);
+ }
+ }
+ insSampleMapper.insert(a);
+
+ if (!CollectionUtil.isEmpty(a.getInsProduct())) {
+ throw new ErrorException("鍏嶆涓嶉渶瑕佸~鍐欐楠岄」");
+ }
+ });
+
+ // 鍘熸潗鏂欎笅鍗�: 濮旀墭浜哄氨鏄姤妫�浜�, 鐢熶骇鍗曚綅灏辨槸渚涘簲鍟嗗崟浣�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId());
+ Integer declareUserId = ifsInventoryQuantity.getDeclareUserId();
+ User user = userMapper.selectById(declareUserId);
+ // 渚涘簲鍟嗗悕绉�
+ insOrder.setProduction(ifsInventoryQuantity.getSupplierName());
+ // 濮旀墭浜哄悕绉�
+ insOrder.setPrepareUser(user.getName());
+ insOrder.setPhone(user.getPhone());
+
+ // 淇敼鍘熸潗鏂欐暟鎹洿鎺ヤ负宸叉楠�
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>().set(IfsInventoryQuantity::getState, 2)
+ .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()));
+
+ insOrder.setExamineTime(LocalDateTime.now());
+
+ insOrder.setEntrustCode(no);
+ insOrder.setIsExemption(1);
+
+ insOrderMapper.updateById(insOrder);
+
+ // 娣诲姞宸ユ椂
+ addAuxiliary(insOrder, ifsInventoryQuantity);
+
+ // todo: ifs鐩存帴绉诲簱
+ insReportService.isRawMaterial(insOrder,true,true);
+
+ return insOrder.getId();
+ }
+
+
+ /**
+ * 鏌ヨ寰呬笅鍗�
+ * @param page
+ * @param ifsInventoryQuantity
+ * @return
+ */
+ @Override
+ public IPage<IfsInventoryQuantityCheckDto> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, IfsInventoryQuantityCheckDto ifsInventoryQuantity) {
+ return standardTreeMapper.selectIfsInventoryQuantity(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
+ }
+
+ /**
+ * 鏌ヨ宸叉楠�
+ * @param page
+ * @param ifsInventoryQuantityDto
+ * @return
+ */
+ @Override
+ public IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
+ // todo: 鍙湅鎴�
+ String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
+ String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
+ ifsInventoryQuantityDto.setBeginDeclareDate(null);
+ ifsInventoryQuantityDto.setEndDeclareDate(null);
+ ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
+ IPage<IfsInventoryQuantitySupplierDto> ifsByOver = standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+ ifsByOver.getRecords().forEach(r->r.setOrderTypeName(OrderType.getLabelByValue(r.getOrderType())));
+ return ifsByOver;
+ }
+
+ /**
+ * 鍒犻櫎鍘熸潗鏂欐姤妫�淇℃伅
+ * @param id
+ * @return
+ */
+ @Override
+ public int delIfsInventory(Integer id) {
+ return ifsInventoryQuantityMapper.deleteById(id);
+ }
+
+ /**
+ * 鍘熸潗鏂欐斁琛屽厤妫�
+ * @param ifsInventoryId
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean rawOrderRelease(Long ifsInventoryId, String partDetail) {
+ // 淇敼鍘熸潗鏂欐暟鎹洿鎺ヤ负宸叉楠�
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getState, 2)
+ .set(IfsInventoryQuantity::getIsQuarter, 0)
+ .eq(IfsInventoryQuantity::getId, ifsInventoryId));
+
+ // 鏌ヨ鍘熸潗鏂欎俊鎭�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
+ // 濮旀墭浜哄氨鏄姤妫�浜�, 鐢熶骇鍗曚綅灏辨槸渚涘簲鍟嗗崟浣�
+ Integer declareUserId = ifsInventoryQuantity.getDeclareUserId();
+ User user = userMapper.selectById(declareUserId);
+
+ InsOrder insOrder = new InsOrder();
+ insOrder.setState(4);
+ insOrder.setTypeSource(1);
+ String code = "Y";
+ // 鐢熸垚缂栧彿
+ String no = numberGenerator.generateNumberWithPrefix(3,
+ "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
+ InsOrder::getEntrustCode);
+ insOrder.setExamineTime(LocalDateTime.now());
+ insOrder.setEntrustCode(no);
+ insOrder.setIsExemption(1);
+ // 渚涘簲鍟嗗悕绉�
+ insOrder.setProduction(ifsInventoryQuantity.getSupplierName());
+ // 濮旀墭浜哄悕绉�
+ insOrder.setPrepareUser(user.getName());
+ insOrder.setPhone(user.getPhone());
+ insOrder.setIfsInventoryId(ifsInventoryId);
+ insOrder.setPartDetail(partDetail);
+ insOrder.setSendTime(LocalDateTime.now());
+ insOrder.setSample(ifsInventoryQuantity.getPartDesc());
+ // 杩涘巶妫�楠�
+ insOrder.setOrderType(InsOrderTypeConstants.ENTER_THE_FACTORY);
+
+ insOrderMapper.insert(insOrder);
+
+ // 娣诲姞宸ユ椂
+ addAuxiliary(insOrder, ifsInventoryQuantity);
+
+ // todo: ifs鐩存帴绉诲簱
+ insReportService.isRawMaterial(insOrder,true,true);
+ return true;
+ }
+
+ /**
+ * 0, 鏃犳彁绀�, 1鎻愮ず 褰撳墠鎵规鐨勬牱鍝佸凡妫�楠岃繃, 鍙互鍏嶆, 2 鎻愮ず 褰撳墠鎵规鐨勬牱鍝佸凡瓒�20鍚�, 闇�瑕佸绾у娆℃楠�
+ *
+ * 鍘熸潗鏂欎笅鍗曢�氱煡鍏嶆鎴栬�呭娆℃楠�
+ * @param ifsInventoryId
+ * @return
+ */
+ @Override
+ public int notificationRawOrder(Long ifsInventoryId) {
+ IfsInventoryQuantity ifsInventory = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
+ // 鏌ヨ褰撳墠鎵规, 渚涘簲鍟�, 闆朵欢鍙风殑鍘熸潗鏂欐槸鍚﹁秴杩囦簡20鍚�, 瓒呰繃浜�20鍚ㄩ渶瑕佽繘琛屽娆℃楠屾彁閱�
+ List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+ .eq(IfsInventoryQuantity::getPartNo, ifsInventory.getPartNo())
+ .eq(IfsInventoryQuantity::getUpdateBatchNo, ifsInventory.getUpdateBatchNo())
+ .eq(IfsInventoryQuantity::getSupplierId, ifsInventory.getSupplierId())
+ .eq(IfsInventoryQuantity::getSupplierName, ifsInventory.getSupplierName()));
+
+ // 鍒ゆ柇鏄惁澶т簬20鍚�
+ BigDecimal bigDecimal = new BigDecimal("20000");
+ BigDecimal count = BigDecimal.ZERO;
+ for (IfsInventoryQuantity inventoryQuantity : quantityList) {
+ // 鍒ゆ柇鍗曚綅鏄痥g鎴栬�卼
+ if (inventoryQuantity.getBuyUnitMeas().equalsIgnoreCase("t")) {
+ count = count.add(inventoryQuantity.getQtyArrived().multiply(new BigDecimal("1000")));
+ } else if (inventoryQuantity.getBuyUnitMeas().equalsIgnoreCase("kg")) {
+ count = count.add(inventoryQuantity.getQtyArrived());
+ }
+ }
+
+ if (count.compareTo(bigDecimal) >= 0) {
+ return 2;
+ } else {
+ // 鍒ゆ柇涔嬪墠鏄惁鍑鸿繃鎶ュ憡, 鍑鸿繃鎶ュ憡鍙互鍏嶆
+ int reportCount = ifsInventoryQuantityMapper.selectReportCountById(ifsInventoryId);
+ if (reportCount > 0) {
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * 鎶ユ鍙互鏂板鎶ユ淇℃伅
+ * @param ifsInventoryQuantity
+ */
+ @Override
+ public void addIfsInventoryQuantity(IfsInventoryQuantity ifsInventoryQuantity) {
+ ifsInventoryQuantity.setIsSource(0);
+ ifsInventoryQuantity.setState(0);
+ ifsInventoryQuantity.setIsFinish(0);
+ if(!OrderType.validateValue(ifsInventoryQuantity.getOrderType())){
+ throw new ErrorException("鏂板鎶ユ淇℃伅澶辫触锛岄潪娉曠殑閿�鍞鍗曞垎绫绘灇涓�");
+ }
+ ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
+ }
+
+
+
+
+ /**
+ * 閾滃崟涓濅笅鍗曞厤妫�
+ * @param list
+ * @param insOrder
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int addRawCopperOrderExemptionOrder(List<SampleProductDto> list, CopperInsOrderDto insOrder) {
+ if (!insOrder.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) {
+ throw new ErrorException("鍙湁杩涘巶妫�楠屾墠鑳藉厤妫�");
+ }
+ insOrder.setSendTime(LocalDateTime.now());
+ // 淇敼璁㈠崟琛ㄧ洿鎺ヤ负宸叉楠�
+ insOrder.setState(4);
+ insOrder.setTypeSource(1);
+
+ String code = "Y";
+ // 鐢熸垚缂栧彿
+ String no = numberGenerator.generateNumberWithPrefix(3,
+ "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
+ InsOrder::getEntrustCode);
+
+ insOrderMapper.insert(insOrder); // 涓昏〃
+
+ AtomicInteger count = new AtomicInteger();
+ list.forEach(a -> {
+ count.getAndIncrement();
+ a.setId(null);
+ a.setInsOrderId(insOrder.getId());
+ if (StrUtil.isEmpty(a.getSampleCode())) {
+ // 濡傛灉鍙湁涓�涓牱鍝佸氨涓嶉渶瑕佹嫾鎺ユ暟瀛�
+ if (list.size() != 1) {
+ a.setSampleCode(no + "-" + count.get());
+ } else {
+ a.setSampleCode(no);
+ }
+ }
+ insSampleMapper.insert(a);
+
+ if (!CollectionUtil.isEmpty(a.getInsProduct())) {
+ throw new ErrorException("鍏嶆涓嶉渶瑕佸~鍐欐楠岄」");
+ }
+ });
+ // 娣诲姞鍘熸潗鏂欎俊鎭�
+ IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity();
+ // 鍩烘湰淇℃伅
+ ifsInventoryQuantity.setIsSource(0);
+ ifsInventoryQuantity.setState(2);
+ ifsInventoryQuantity.setIsInspect(1);
+ ifsInventoryQuantity.setIsFinish(1);
+ ifsInventoryQuantity.setIsCopper(1);
+ ifsInventoryQuantity.setInspectStatus(1);
+ ifsInventoryQuantity.setIsQuarter(0);
+
+ ifsInventoryQuantity.setQtyArrived(insOrder.getQtyArrived());
+ ifsInventoryQuantity.setBuyUnitMeas(insOrder.getBuyUnitMeas());
+ ifsInventoryQuantity.setSupplierName(insOrder.getSupplierName());
+ ifsInventoryQuantity.setUpdateBatchNo(insOrder.getUpdateBatchNo());
+ ifsInventoryQuantity.setDeclareDate(insOrder.getDeclareDate());
+ //閾滄潗鏂欎笅鍗曢粯璁ゅ��
+ ifsInventoryQuantity.setOrderType(OrderType.RAW.getValue());
+ ifsInventoryQuantity.setMaterialProp("01Cu");
+
+ ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
+
+ insOrder.setIfsInventoryId(ifsInventoryQuantity.getId());
+ insOrder.setExamineTime(LocalDateTime.now());
+
+ insOrder.setEntrustCode(no);
+ insOrder.setIsExemption(1);
+
+ insOrderMapper.updateById(insOrder);
+
+ // 娣诲姞宸ユ椂
+ addAuxiliary(insOrder, ifsInventoryQuantity);
+
+ return insOrder.getId();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean concessionRelease(Long ifsInventoryId) {
+ // 鏌ヨ鍘熸潗鏂欎俊鎭�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
+ if (!ifsInventoryQuantity.getInspectStatus().equals(2)) {
+ throw new ErrorException("涓嶅悎鏍肩殑鍘熸潗鏂欐墠鑳借姝ユ斁琛�");
+ }
+
+ String toLocation = insOrderService.moveRawMaterial(ifsInventoryQuantity);
+
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getInspectStatus, 4)
+ .set(IfsInventoryQuantity::getToLocation, toLocation)
+ .eq(IfsInventoryQuantity::getId, ifsInventoryId));
+
+ return true;
+ }
+
+ /**
+ * 鍘熸潗鏂欒繘鍘傛挙閿�涓嬪崟
+ * @param enterOrderId
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean repealEnterRawOrder(Integer enterOrderId) {
+ // 鏌ヨ璁㈠崟
+ InsOrder order = insOrderMapper.selectById(enterOrderId);
+
+ // 鏌ヨ鍒ゆ柇鏄惁鏄摐鍗曚笣
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+ if (ifsInventoryQuantity.getIsCopper() != null && ifsInventoryQuantity.getIsCopper().equals(1)) {
+ // 閾滃崟涓濈洿鎺ュ垹闄ゅ氨琛�
+ ifsInventoryQuantityMapper.deleteById(order.getIfsInventoryId());
+ } else {
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getState, 0)
+ .set(IfsInventoryQuantity::getIsQuarter, 1)
+ .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()));
+ }
+ insOrderService.update(Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, enterOrderId)
+ .set(InsOrder::getState, -1)
+ .set(InsOrder::getEntrustCode, ""));// 鎾ら攢
+
+ // 娓呴櫎涔嬪墠鐨勫伐鏃�
+ auxiliaryOutputWorkingHoursMapper.delete(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
+ .eq(AuxiliaryOutputWorkingHours::getOrderId, enterOrderId));
+
+ // 娓呴櫎涔嬪墠鎶ュ憡
+ insReportService.remove(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getInsOrderId, enterOrderId));
+
+ return true;
+ }
+
+ /**
+ * 鍘熸潗鏂欏搴︽挙閿�涓嬪崟
+ * @param quarterOrderId
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean repealQuarterRawOrder(Integer quarterOrderId) {
+ // 鏌ヨ璁㈠崟
+ InsOrder order = insOrderMapper.selectById(quarterOrderId);
+
+ Long count = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getIfsInventoryId, order.getIfsInventoryId())
+ .ne(InsOrder::getState, -1)
+ .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY)
+ .ne(InsOrder::getId, order.getId()));
+ // 鍒ゆ柇涔嬪墠鏄惁鏈夎繘鍘傛楠�, 娌℃湁闇�瑕佷慨鏀瑰師鏉愭枡淇℃伅
+ if (count == 0) {
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getState, 0)
+ .set(IfsInventoryQuantity::getIsQuarter, 1)
+ .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()));
+ } else {
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getIsQuarter, 1)
+ .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()));
+ }
+
+ insOrderService.update(Wrappers.<InsOrder>lambdaUpdate()
+ .eq(InsOrder::getId, quarterOrderId)
+ .set(InsOrder::getState, -1)
+ .set(InsOrder::getEntrustCode, ""));// 鎾ら攢
+ auxiliaryOutputWorkingHoursMapper.delete(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
+ .eq(AuxiliaryOutputWorkingHours::getOrderId, quarterOrderId));
+ // 娓呴櫎涔嬪墠鎶ュ憡
+ insReportService.remove(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getInsOrderId, quarterOrderId));
+ return true;
+ }
+
+ /**
+ * 鍘熸潗鏂欐姤妫�鍏ㄩ儴淇℃伅瀵煎嚭
+ * @param ifsInventoryQuantityDto
+ * @param response
+ */
+ @Override
+ public void rawAllExport(IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto, HttpServletResponse response) throws UnsupportedEncodingException {
+ // 鍒ゆ柇鏄惁鏄牴鎹�夋嫨鐨勫鍑�
+ List<IfsInventoryQuantitySupplierDto> ifsByOverList = new ArrayList<>();
+ if (StringUtils.isNotBlank(ifsInventoryQuantityDto.getIds())) {
+ List<String> ifsIds = StrUtil.split(ifsInventoryQuantityDto.getIds(), ",");
+ ifsByOverList = standardTreeMapper.getIfsByIds(ifsIds);
+ } else {
+ String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
+ String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
+ ifsInventoryQuantityDto.setBeginDeclareDate(null);
+ ifsInventoryQuantityDto.setEndDeclareDate(null);
+ ifsInventoryQuantityDto.setIds(null);
+ ifsByOverList = standardTreeMapper.getIfsByOverList(QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+ }
+
+ for (IfsInventoryQuantitySupplierDto dto : ifsByOverList) {
+ dto.setSendTimeString(dto.getSendTime() == null ? "" : dto.getSendTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+ dto.setReceiverDateString(dto.getReceiverDate() == null ? "" : dto.getReceiverDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+ dto.setDeclareDateString(dto.getDeclareDate() == null ? "" : dto.getDeclareDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+ switch (dto.getInspectStatus()) {
+ case 1:
+ dto.setInspectStatusString("鍚堟牸");
+ break;
+ case 2:
+ dto.setInspectStatusString("涓嶅悎鏍�");
+ // 鏌ヨ涓嶅悎鏍奸」
+ List<String> unqualifiedList = insProductMapper.selectUnqualifiedList(dto.getEnterOrderId() == null ? dto.getQuarterOrderId() : dto.getEnterOrderId());
+ dto.setUnqualifiedItem(CollUtil.join(unqualifiedList, ","));
+ break;
+ case 3:
+ dto.setInspectStatusString("鏈笅鍗�");
+ break;
+ case 4:
+ dto.setInspectStatusString("璁╂鏀捐");
+ break;
+ case 0:
+ dto.setInspectStatusString("妫�楠屼腑");
+ break;
+
+ }
+ }
+
+
+ response.setContentType("application/vnd.ms-excel");
+ response.setCharacterEncoding("UTF-8");
+ // 杩欓噷URLEncoder.encode鍙互闃叉涓枃涔辩爜 褰撶劧鍜宔asyexcel娌℃湁鍏崇郴
+ String fileName = URLEncoder.encode("鍘熸潗鏂欐娴嬩俊鎭鍑�", "UTF-8");
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+ try {
+ //鏂板缓ExcelWriter
+ ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build();
+ //鑾峰彇sheet0瀵硅薄
+ WriteSheet mainSheet = EasyExcel.writerSheet(0, "鍘熸潗鏂欐娴嬩俊鎭鍑�").head(IfsInventoryQuantitySupplierDto.class).build();
+
+ //鍚憇heet0鍐欏叆鏁版嵁 浼犲叆绌簂ist杩欐牱鍙鍑鸿〃澶�
+ excelWriter.write(ifsByOverList, mainSheet);
+ //鍏抽棴娴�
+ excelWriter.finish();
+ } catch (IOException e) {
+ throw new RuntimeException("瀵煎嚭澶辫触");
+ }
+ }
+
+ /**
+ * 鍘熸潗鏂欐煡璇㈠彲浠ュ搴︽楠岀殑鍐呭
+ * @param page
+ * @param ifsInventoryQuantityDto
+ * @return
+ */
+ @Override
+ public IPage<IfsInventoryQuantitySupplierDto> getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
+
+ // todo: 鍙湅鎴�
+ String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
+ String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
+ ifsInventoryQuantityDto.setBeginDeclareDate(null);
+ ifsInventoryQuantityDto.setEndDeclareDate(null);
+ ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
+ return standardTreeMapper.getIfsByQuarter(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+ }
+
+ /**
+ * 鎻愬墠鍏ュ簱
+ * @param ifsInventoryId
+ * @return
+ */
+ @Override
+ public boolean advancedGodown(Long ifsInventoryId) {
+ // 鏌ヨ鍘熸潗鏂欎俊鎭�
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
+ if (!ifsInventoryQuantity.getInspectStatus().equals(0)
+ && !ifsInventoryQuantity.getInspectStatus().equals(3)) {
+ throw new ErrorException("鏈娴嬪畬鎴愭暟鎹墠鑳芥彁鍓嶅叆搴�");
+ }
+
+ String toLocation = insOrderService.moveRawMaterial(ifsInventoryQuantity);
+
+ ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+ .set(IfsInventoryQuantity::getInspectStatus, 1)
+ .set(IfsInventoryQuantity::getIsFinish, 1)
+ .set(IfsInventoryQuantity::getToLocation, toLocation)
+ .eq(IfsInventoryQuantity::getId, ifsInventoryId));
+
+ return true;
+ }
+
+ @Override
+ public void downloadTemplate(HttpServletResponse response) {
+ response.reset();
+ try{
+ String fileName = "璁㈠崟鎷嗗垎瀵煎叆妯℃澘" + ExcelTypeEnum.XLSX.getValue();
+ fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Cache-Control", "no-cache");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+ //璁㈠崟鎷嗗垎瀵煎叆妯℃澘鏂囦欢
+ InputStream inputStream = this.getClass().getResourceAsStream("/static/split_order_import_template.xlsx");
+ IoUtil.copy(inputStream,response.getOutputStream());
+ inputStream.close();
+ }catch (Exception e){
+ e.printStackTrace();
+ throw new RuntimeException("妯℃澘涓嬭浇澶辫触");
+ }
+ }
+
+ @Override
+ public Result importSplitOrderData(MultipartFile file, Long ifsId, HttpServletRequest request) {
+ try {
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsId);
+ OrderSplitExcelListener listener = new OrderSplitExcelListener(ifsInventoryQuantity);
+ EasyExcel.read(file.getInputStream(), listener).sheet().headRowNumber(2).doRead();
+ if(StringUtils.isNotBlank(listener.errorMsg)){
+ return Result.fail(201,listener.errorMsg);
+ }
+ return Result.success(listener.getDataList());
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new RuntimeException("瀵煎叆澶辫触:"+e.getMessage());
+ }
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
+ public boolean confirmSplitOrder(OrderSplitDTO orderSplitDTO) {
+ //1.鏌ヨifs璁㈠崟淇℃伅
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(orderSplitDTO.getIfsId());
+ if(Objects.isNull(ifsInventoryQuantity)){
+ throw new RuntimeException("鏈煡璇㈠埌璇FS璁㈠崟淇℃伅");
+ }
+ //2.瀵规帴ifs閲囪喘鎺ユ敹鏇存敼鎵瑰彿鎺ュ彛
+ //缁勮璇锋眰鍙傛暟inAttr
+ List<String> newLotBathNo = new ArrayList<>();//鏂版壒鍙峰垪琛�
+ Map<String,Object> inAttrMap = new HashMap<>();
+ inAttrMap.put("RECORD_ID",UUID.randomUUID().toString());
+ inAttrMap.put("SYSCODE","LIMS_ZB");
+ inAttrMap.put("SYSMODEL","瑁呭LIMS璁㈠崟鎷嗗垎");
+ List<Map<String,Object>> batchInfoData = new ArrayList<>();
+ if(Objects.nonNull(orderSplitDTO.getSplitDetailList()) && !orderSplitDTO.getSplitDetailList().isEmpty()){
+ for (OrderSplitExcelData data : orderSplitDTO.getSplitDetailList()) {
+ Map<String, Object> infoMap = new HashMap<>();
+ infoMap.put("ORDER_NO",ifsInventoryQuantity.getOrderNo());
+ infoMap.put("LINE_NO",ifsInventoryQuantity.getLineNo());
+ infoMap.put("RELEASE_NO",ifsInventoryQuantity.getReleaseNo());
+ infoMap.put("RECEIPT_NO",ifsInventoryQuantity.getReceiptNo());
+ infoMap.put("PART_NO",ifsInventoryQuantity.getPartNo());
+ infoMap.put("CONFIGURATION_ID",ifsInventoryQuantity.getConfigurationId());
+ infoMap.put("LOCATION_NO",ifsInventoryQuantity.getLocationNo());
+ infoMap.put("LOT_BATCH_NO",ifsInventoryQuantity.getLotBatchNo());
+ infoMap.put("NEW_LOT_BATCH_NO",data.getLotBatchNo());
+ newLotBathNo.add(data.getLotBatchNo());
+ infoMap.put("SERIAL_NO",ifsInventoryQuantity.getSerialNo());
+ infoMap.put("ENG_CHG_LEVEL",ifsInventoryQuantity.getEngChgLevel());
+ infoMap.put("WAIV_DEV_REJ_NO",ifsInventoryQuantity.getWaivDevRejNo());
+ infoMap.put("ACTIVITY_SEQ",ifsInventoryQuantity.getActivitySeq());
+ infoMap.put("QTY_TO_CHANGE",data.getQtyStock());
+ batchInfoData.add(infoMap);
+ }
+ }
+ inAttrMap.put("BATCH_INFO", batchInfoData);
+ String inAttr = JSONObject.toJSONString(inAttrMap);
+ //璋冪敤ifs鎺ュ彛
+ Result result = ifsApiUtils.updateMoveReceiptLot(inAttr);
+ if(result.getCode()!=200){
+ throw new RuntimeException("IFS閲囪喘鎺ユ敹鏇存敼鎵瑰彿璇锋眰寮傚父锛�"+result.getMsg());
+ }
+ //鏇存柊涓昏鍗曠殑鎶佃揪閲囪喘鏁伴噺
+ BigDecimal purQtyInStore = orderSplitDTO.getSplitDetailList()
+ .stream()
+ .map(OrderSplitExcelData::getQtyStock)
+ .reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
+ BigDecimal newPurQtyInStore = ifsInventoryQuantity.getPurQtyInStore().subtract(purQtyInStore);
+ //濡傛灉鎷嗗垎鍚庯紝鍓╀綑鐨勫簱瀛樻暟閲忎负0锛屽垯鍒犻櫎鎵瑰彿涓�*鐨勮鍗曚俊鎭�
+ if(newPurQtyInStore.compareTo(BigDecimal.ZERO)==0){
+ ifsInventoryQuantityMapper.deleteById(ifsInventoryQuantity.getId());
+ }else{
+ ifsInventoryQuantityMapper.update(null,Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .set(IfsInventoryQuantity::getPurQtyInStore,newPurQtyInStore)
+ .set(IfsInventoryQuantity::getInvQtyInStore,newPurQtyInStore)
+ .eq(IfsInventoryQuantity::getId,ifsInventoryQuantity.getId())
+ );
+ }
+ //ifs鏇存敼鎵瑰彿鎺ュ彛璋冪敤鎴愬姛锛屾媺鍙栨柊鎷嗗垎鐨刬fs璁㈠崟骞舵姤妫�
+ Map<String, Object> map = new HashMap<>();
+ map.put("LOCATION_NO","1302");
+ map.put("STATE_DB","To be Inspected");
+ map.put("PART_NO",ifsInventoryQuantity.getPartNo());
+ map.put("ORDER_NO",ifsInventoryQuantity.getOrderNo());
+ map.put("LINE_NO",ifsInventoryQuantity.getLineNo());
+ map.put("RELEASE_NO",ifsInventoryQuantity.getReleaseNo());
+ map.put("RECEIPT_NO",ifsInventoryQuantity.getReceiptNo());
+ map.put("LOT_BATCH_NO",String.join(";",newLotBathNo));
+ insOrderService.getIfsOrder(map,true);
+ //鏌ヨ鏂版媶鍒嗙殑璁㈠崟淇℃伅
+ List<IfsInventoryQuantity> splitOrderList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+ .eq(IfsInventoryQuantity::getLocationNo, "1302")
+ .eq(IfsInventoryQuantity::getStatusDb, "To be Inspected")
+ .eq(IfsInventoryQuantity::getPartNo, ifsInventoryQuantity.getPartNo())
+ .eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo())
+ .eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo())
+ .eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo())
+ .eq(IfsInventoryQuantity::getReceiptNo, ifsInventoryQuantity.getReceiptNo())
+ .in(IfsInventoryQuantity::getLotBatchNo, newLotBathNo)
+ );
+ //鎵ц鎶ユ鎿嶄綔
+ if(Objects.nonNull(splitOrderList) && !splitOrderList.isEmpty()){
+ List<Long> ids = splitOrderList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList());
+ ids.add(ifsInventoryQuantity.getId());
+ this.inspectionReport(ids,OrderType.RAW.getValue(),orderSplitDTO.getMaterialProp());
+ }
+ //鍕鹃�夊悓姝ュ埌MES锛屼繚瀛樿鍗曟媶鍒嗚褰�
+ if(orderSplitDTO.getPushToMes()){
+ orderSplitDTO.getSplitDetailList().forEach(m -> {
+ IfsSplitOrderRecord record = new IfsSplitOrderRecord();
+ BeanUtil.copyProperties(m, record);
+ record.setSystemNo(splitOrderRecordNumberGenerator.generateNumberWithPrefix(IfsSplitOrderRecord.DIGIT, IfsSplitOrderRecord.PREFIX, IfsSplitOrderRecord::getSystemNo));
+ record.setOrderNo(ifsInventoryQuantity.getOrderNo());
+ record.setLineNo(ifsInventoryQuantity.getLineNo());
+ record.setReleaseNo(ifsInventoryQuantity.getReleaseNo());
+ record.setReceiptNo(ifsInventoryQuantity.getReceiptNo());
+ ifsSplitOrderRecordService.save(record);
+ });
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * 娣诲姞宸ユ椂
+ * @param insOrder
+ * @param ifsInventoryQuantity
+ */
+ private void addAuxiliary(InsOrder insOrder, IfsInventoryQuantity ifsInventoryQuantity) {
+ AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
+ auxiliaryOutputWorkingHours.setInspectionItemClass(ifsInventoryQuantity.getUpdateBatchNo() + "鍏嶆");//妫�娴嬮」鍒嗙被
+ auxiliaryOutputWorkingHours.setSample(insOrder.getEntrustCode());//鏍峰搧缂栧彿
+ auxiliaryOutputWorkingHours.setOrderId(insOrder.getId());//璁㈠崟id
+ auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙�
+
+ // 鍏嶆榛樿2
+ auxiliaryOutputWorkingHours.setWorkTime(new BigDecimal("2"));//闈炲姞鐝伐鏃�
+ auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲�
+ auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//浜ч噺宸ユ椂
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//鏃ユ湡
+ LocalDateTime localDateTime = LocalDateTime.now();
+ DateTime parse = DateUtil.parse(localDateTime.format(formatter));
+ auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡
+ auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ
+ auxiliaryOutputWorkingHours.setCheck(SecurityUtils.getUserId().intValue());//妫�娴嬩汉
+ auxiliaryOutputWorkingHours.setPrice(new BigDecimal("1"));//鍗曚环
+
+ auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
+ }
+
+ public static String getWeek(String dayStr) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ try {
+ Date date = sdf.parse(dayStr);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
+ int day = calendar.get(Calendar.DAY_OF_MONTH);
+ return getWeekDay(dayOfWeek);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static String getWeekDay(int dayOfWeek) {
+ switch (dayOfWeek) {
+ case Calendar.MONDAY:
+ return "鍛ㄤ竴";
+ case Calendar.TUESDAY:
+ return "鍛ㄤ簩";
+ case Calendar.WEDNESDAY:
+ return "鍛ㄤ笁";
+ case Calendar.THURSDAY:
+ return "鍛ㄥ洓";
+ case Calendar.FRIDAY:
+ return "鍛ㄤ簲";
+ case Calendar.SATURDAY:
+ return "鍛ㄥ叚";
+ case Calendar.SUNDAY:
+ return "鍛ㄦ棩";
+ default:
+ return "鏈煡";
+ }
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderTemplateServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderTemplateServiceImpl.java
new file mode 100644
index 0000000..afd3ac3
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderTemplateServiceImpl.java
@@ -0,0 +1,70 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.RawMaterialOrderTemplateMapper;
+import com.ruoyi.inspect.pojo.RawMaterialOrderTemplate;
+import com.ruoyi.inspect.service.RawMaterialOrderTemplateService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 鍘熸潗鏂欎笅鍗曟ā鏉�
+ *
+ * @author zhuo
+ * @since 2024-08-05
+ */
+@Service
+@AllArgsConstructor
+public class RawMaterialOrderTemplateServiceImpl extends ServiceImpl<RawMaterialOrderTemplateMapper, RawMaterialOrderTemplate> implements RawMaterialOrderTemplateService {
+
+
+ /**
+ * 娣诲姞鍘熸潗鏂欐楠屽崟妯℃澘
+ * @param rawMaterialOrderTemplate
+ * @return
+ */
+ @Override
+ public int addRawMaterOrderTemplate(RawMaterialOrderTemplate rawMaterialOrderTemplate) {
+ if (StringUtils.isBlank(rawMaterialOrderTemplate.getPartNo())) {
+ throw new RuntimeException("缂哄皯闆朵欢鍙�");
+ }
+ return baseMapper.insert(rawMaterialOrderTemplate);
+ }
+
+ /**
+ * 鏌ヨ鍘熸潗鏂欐楠屽崟妯℃澘鍒楄〃
+ * @param partNo
+ * @return
+ */
+ @Override
+ public List<RawMaterialOrderTemplate> selectRawMaterOrderTemplate(String partNo) {
+ return baseMapper.selectList(Wrappers.<RawMaterialOrderTemplate>lambdaQuery()
+ .eq(RawMaterialOrderTemplate::getPartNo, partNo));
+ }
+
+ /**
+ * 閫氳繃鍘熸潗鏂欐楠屽崟妯℃澘id鑾峰彇妫�楠屽崟妯℃澘鍐呭
+ * @param id
+ * @return
+ */
+ @Override
+ public String selectRawMaterOrderTemplateById(Integer id) {
+ return baseMapper.selectById(id).getThing();
+ }
+
+ /**
+ * 鍒犻櫎鍘熸潗鏂欐楠屽崟妯℃澘
+ * @param id
+ * @return
+ */
+ @Override
+ public int delRawMaterOrderTemplate(Integer id) {
+ return baseMapper.deleteById(id);
+ }
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/ReportServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/ReportServiceImpl.java
new file mode 100644
index 0000000..fd69315
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/ReportServiceImpl.java
@@ -0,0 +1,129 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.inspect.mapper.*;
+import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsSample;
+import com.ruoyi.inspect.pojo.InsSampleUser;
+import com.ruoyi.inspect.service.ReportService;
+import com.ruoyi.performance.dto.AuxiliaryAllDto;
+import com.ruoyi.performance.dto.AuxiliaryOriginalHoursLookDto;
+import com.ruoyi.performance.service.AuxiliaryOriginalHoursService;
+import com.ruoyi.system.mapper.UserMapper;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Service
+@AllArgsConstructor
+public class ReportServiceImpl implements ReportService {
+
+ @Autowired
+ private InsOrderMapper insOrderMapper;
+
+ @Autowired
+ private InsSampleMapper insSampleMapper;
+
+ @Autowired
+ private UserMapper userMapper;
+
+ @Autowired
+ private InsSampleUserMapper insSampleUserMapper;
+
+ @Autowired
+ private AuxiliaryOriginalHoursService auxiliaryOriginalHoursService;
+
+ //棣栭〉-->鏃ュ巻浠诲姟鍥�
+ @Override
+ public Map<String, Object> calendarWorkByWeek() {
+ Integer userId = SecurityUtils.getUserId().intValue();
+ //
+ List<SysRole> roleList = SecurityUtils.getLoginUser().getUser().getRoles();
+
+// String name = roleMapper.selectById(userMapper.selectById(userId).getRoleId()).getName();
+ String name = roleList.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
+ Map<String, Object> map = new HashMap<>();
+ List<Integer> insState = new ArrayList<>();
+ insState.add(0);
+ insState.add(1);
+ /*鑾峰彇鍚庝竴鍛ㄦ棩鏈�*/
+ LocalDate currentDate = LocalDate.now();
+ List<LocalDate> weekDays = new ArrayList<>();
+ for (int i = 6, j = 0; i >= 0; i--, j++) {
+ weekDays.add(currentDate.minusDays(i));
+ //鏌ヨ褰撳ぉ闇�瑕佹娴嬬殑濮旀墭璁㈠崟
+ List<InsOrder> insOrders = insOrderMapper.selectList(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getState, 1)
+ .in(InsOrder::getInsState, insState)
+ .apply("DATE(create_time) = CURDATE() - INTERVAL " + j + " DAY"));
+ //濡傛灉褰撳墠鐧诲綍浜烘槸娴嬭瘯宸ョ▼甯堟垨鑰呮槸妫�娴嬬粍闀�,闇�瑕佽繃婊ゅ嚭妫�楠屼汉鏄粬浠殑璁㈠崟鎴栬�呮槸杩樻病妫�楠岀殑璁㈠崟
+ if (name.contains("娴嬭瘯宸ョ▼甯�") || name.contains("妫�娴嬬粍闀�")) {
+ insOrders = insOrders.stream().filter(insOrder -> {
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insOrder.getId()));
+ List<Integer> sampleId = insSamples.stream().map(InsSample::getId).collect(Collectors.toList());
+ List<InsSampleUser> insSampleUsers = insSampleUserMapper.selectList(Wrappers.<InsSampleUser>lambdaQuery()
+ .in(InsSampleUser::getInsSampleId, sampleId)
+ .eq(InsSampleUser::getState, 0) //妫�楠屼汉
+ );
+ return insSampleUsers.size() == 0 || insSampleUsers.stream().map(InsSampleUser::getUserId).collect(Collectors.toList()).contains(userId);
+ }).collect(Collectors.toList());
+ }
+ //濡傛灉褰撳墠鐧诲綍浜烘槸閫佹牱鍛�,闇�杩囨护鍑哄崟瀛愮殑閫佹牱鍛樻槸褰撳墠浜虹殑璁㈠崟
+ else if (name.contains("閫佹牱鍛�")) {
+ insOrders = insOrders.stream().filter(insOrder ->
+ ObjectUtils.isNotEmpty(insOrder.getIssueUser()) && insOrder.getIssueUser().equals(userId)
+ ).collect(Collectors.toList());
+ }
+ List<Map<String, Object>> works = insOrders.stream().map(insOrder -> {
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insOrder.getId()));
+ HashMap<String, Object> hashMap = new HashMap<>();
+ hashMap.put("text", insOrder.getEntrustCode());
+ hashMap.put("sample", insSamples.stream().map(InsSample::getSample).collect(Collectors.joining(",")));
+ hashMap.put("type", insOrder.getType());
+ hashMap.put("state", insOrder.getState());
+ User user = userMapper.selectById(insOrder.getCreateUser());
+ hashMap.put("name", user.getName());
+ return hashMap;
+ }).collect(Collectors.toList());
+ map.put("work" + i, works);
+ }
+ map.put("weekDays", weekDays);
+ return map;
+ }
+
+ @Override
+ public AuxiliaryAllDto currentUserWorkHourCount(AuxiliaryOriginalHoursLookDto dto) {
+ List<AuxiliaryAllDto> auxiliaryAllDtos = auxiliaryOriginalHoursService.selectAuxiliaryAllByMonth(dto);
+ int userId = SecurityUtils.getUserId().intValue();
+ // 杩囨护鎺夐潪褰撳墠鐢ㄦ埛鏁版嵁
+ AuxiliaryAllDto auxiliaryAllDto = null;
+ for (AuxiliaryAllDto allDto : auxiliaryAllDtos) {
+ if(userId == allDto.getUserId()){
+ auxiliaryAllDto = allDto;
+ break;
+ }
+ }
+ if(ObjectUtils.isEmpty(auxiliaryAllDto)){
+ auxiliaryAllDto = new AuxiliaryAllDto(
+ new BigDecimal(0),
+ new BigDecimal(0),
+ new BigDecimal(0),
+ userId,SecurityUtils.getUsername(),
+ dto.getMonth()
+ );
+ }
+ return auxiliaryAllDto;
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/SpotCheckQuarterItemServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/SpotCheckQuarterItemServiceImpl.java
new file mode 100644
index 0000000..5b7ad6c
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/SpotCheckQuarterItemServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.SpotCheckQuarterItemMapper;
+import com.ruoyi.inspect.pojo.SpotCheckQuarterItem;
+import com.ruoyi.inspect.service.SpotCheckQuarterItemService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 瀛e害鎶芥牱璁″垝璇︽儏琛�
+ *
+ * @author zhuo
+ * @since 2024-10-09
+ */
+@Service
+public class SpotCheckQuarterItemServiceImpl extends ServiceImpl<SpotCheckQuarterItemMapper, SpotCheckQuarterItem> implements SpotCheckQuarterItemService {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/SpotCheckYearItemServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/SpotCheckYearItemServiceImpl.java
new file mode 100644
index 0000000..205f980
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/SpotCheckYearItemServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.SpotCheckYearItemMapper;
+import com.ruoyi.inspect.pojo.SpotCheckYearItem;
+import com.ruoyi.inspect.service.SpotCheckYearItemService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 骞村害鎶芥牱璁″垝璇︽儏琛�
+ *
+ * @author zhuo
+ * @since 2024-10-10
+ */
+@Service
+public class SpotCheckYearItemServiceImpl extends ServiceImpl<SpotCheckYearItemMapper, SpotCheckYearItem> implements SpotCheckYearItemService {
+
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/WarehouseCellServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/WarehouseCellServiceImpl.java
new file mode 100644
index 0000000..333aa18
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/WarehouseCellServiceImpl.java
@@ -0,0 +1,26 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.inspect.mapper.WarehouseCellMapper;
+import com.ruoyi.inspect.pojo.WarehouseCell;
+import com.ruoyi.inspect.service.WarehouseCellService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_sample_user(鏍峰搧璐熻矗浜鸿褰�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2024-03-14 17:12:02
+*/
+@Service
+@AllArgsConstructor
+public class WarehouseCellServiceImpl extends ServiceImpl<WarehouseCellMapper, WarehouseCell>
+ implements WarehouseCellService {
+
+
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/WarehouseServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/WarehouseServiceImpl.java
new file mode 100644
index 0000000..6e9c2e9
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/WarehouseServiceImpl.java
@@ -0,0 +1,189 @@
+package com.ruoyi.inspect.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.HistoryDto;
+import com.ruoyi.inspect.dto.WarehouseCellAndSampleDto;
+import com.ruoyi.inspect.dto.WarehouseDto;
+import com.ruoyi.inspect.mapper.*;
+import com.ruoyi.inspect.pojo.*;
+import com.ruoyi.inspect.service.WarehouseCellService;
+import com.ruoyi.inspect.service.WarehouseService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恑ns_sample_user(鏍峰搧璐熻矗浜鸿褰�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2024-03-14 17:12:02
+*/
+@Service
+@AllArgsConstructor
+public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse>
+ implements WarehouseService {
+
+ private WarehouseMapper warehouseMapper;
+
+ private WarehouseShelfMapper warehouseShelfMapper;
+
+ private WarehouseCellMapper warehouseCellMapper;
+
+ private WarehouseHistoryMapper warehouseHistoryMapper;
+
+ private WarehouseCellService warehouseCellService;
+
+ private InsSampleMapper insSampleMapper;
+
+ private InsProductMapper insProductMapper;
+
+ @Override
+ public int addWarehouse(Warehouse warehouse) {
+ Warehouse newWarehouse = new Warehouse();
+ warehouse.setName(warehouse.getName());
+ return warehouseMapper.insert(warehouse);
+ }
+
+ @Override
+ public List<WarehouseDto> selectWarehouse() {
+ return warehouseMapper.selectWarehouseList();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int addShelf(WarehouseShelf warehouseShelf) {
+ warehouseShelfMapper.insert(warehouseShelf);
+ List<WarehouseCell> cells = new ArrayList<>();
+ for (int i = 1; i < warehouseShelf.getRow() + 1; i++) {
+ for (int a = 1; a < warehouseShelf.getCol() + 1; a++) {
+ WarehouseCell cell = new WarehouseCell();
+ cell.setRow(i);
+ cell.setCol(a);
+ cell.setState(1);
+ cell.setShelfId(warehouseShelf.getId());
+ cells.add(cell);
+ }
+ }
+ warehouseCellService.saveBatch(cells);
+ return 1;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int delWarehouse(Integer id) {
+ warehouseShelfMapper.delete(Wrappers.<WarehouseShelf>lambdaUpdate().eq(WarehouseShelf::getWarehouseId, id));
+ return warehouseMapper.deleteById(id);
+ }
+
+ @Override
+ public int upWarehouse(Warehouse warehouse) {
+ return warehouseMapper.updateById(warehouse);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int delShelf(Integer id) {
+ warehouseCellMapper.update(null ,Wrappers.<WarehouseCell>lambdaUpdate().eq(WarehouseCell::getShelfId, id).set(WarehouseCell::getState, 0));
+ return warehouseShelfMapper.deleteById(id);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int upShelf(WarehouseShelf warehouseShelf) {
+ warehouseCellMapper.update(null, Wrappers.<WarehouseCell>lambdaUpdate()
+ .eq(WarehouseCell::getShelfId, warehouseShelf.getWarehouseId())
+ .gt(WarehouseCell::getRow, warehouseShelf.getRow())
+ .gt(WarehouseCell::getCol, warehouseShelf.getCol())
+ .set(WarehouseCell::getState, 0));
+ warehouseShelfMapper.updateById(warehouseShelf);
+ return 0;
+ }
+
+ @Override
+ public List<WarehouseCellAndSampleDto> getWarehouse(Integer shelfId) {
+ return warehouseCellMapper.getWarehouse(shelfId);
+ }
+
+ @Override
+ public int inWarehouse(String trees, String sampleCode) {
+ String[] tree = trees.split("-");
+ if(tree.length < 4){
+ throw new ErrorException("搴撲綅閫夋嫨閿欒");
+ }
+ List<InsSample> samples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getSampleCode, sampleCode).select(InsSample::getId,InsSample::getCellId));
+ if(samples.size()!=1){
+ throw new ErrorException("鏍峰搧缂栧彿杈撳叆鏈夎");
+ }
+ if(samples.get(0).getCellId()!=null){
+ throw new ErrorException("鏍峰搧 " + sampleCode + " 鏈嚭搴�");
+ }
+ WarehouseCell cell = warehouseCellMapper.selectOne(Wrappers.<WarehouseCell>lambdaQuery().eq(WarehouseCell::getShelfId, tree[1]).eq(WarehouseCell::getRow, tree[2]).eq(WarehouseCell::getCol, tree[3]).eq(WarehouseCell::getState, 1).select(WarehouseCell::getId,WarehouseCell::getRow,WarehouseCell::getCol));
+ WarehouseShelf shelf = warehouseShelfMapper.selectById(tree[1]);
+ Warehouse warehouse = warehouseMapper.selectById(tree[0]);
+ WarehouseHistory history = new WarehouseHistory();
+ history.setCellId(cell.getId());
+ history.setState(1);
+ history.setInsSampleId(samples.get(0).getId());
+ history.setWarehouseCode(warehouse.getName()+"-"+shelf.getName()+"-"+cell.getRow()+"-"+cell.getCol());
+ samples.get(0).setCellId(cell.getId());
+ insSampleMapper.updateById(samples.get(0));
+ return warehouseHistoryMapper.insert(history);
+ }
+
+ @Override
+ public int outWarehouse(String sampleCode) {
+ List<InsSample> samples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getSampleCode, sampleCode).select(InsSample::getId,InsSample::getCellId));
+ if(samples.size()!=1){
+ throw new ErrorException("鏍峰搧缂栧彿杈撳叆鏈夎");
+ }
+ if(samples.get(0).getCellId()==null){
+ throw new ErrorException("鏍峰搧 " + sampleCode + " 鏈叆搴�");
+ }
+ WarehouseHistory history = new WarehouseHistory();
+ history.setState(2);
+ history.setInsSampleId(samples.get(0).getId());
+ history.setCellId(samples.get(0).getCellId());
+ history.setWarehouseCode(warehouseHistoryMapper.selectOne(Wrappers.<WarehouseHistory>lambdaQuery().eq(WarehouseHistory::getInsSampleId, samples.get(0).getId()).select(WarehouseHistory::getWarehouseCode).orderByDesc(WarehouseHistory::getId).last("limit 1")).getWarehouseCode());
+ insSampleMapper.update(null, Wrappers.<InsSample>lambdaUpdate().eq(InsSample::getId, samples.get(0).getId()).set(InsSample::getCellId, null));
+ return warehouseHistoryMapper.insert(history);
+ }
+
+ @Override
+ public Map<String, Object> getSampleRecord(Integer id) {
+ InsSample insSample = insSampleMapper.selectById(id);
+ List<HistoryDto> histories = warehouseHistoryMapper.getHistoryListBySampleId(id);
+ Map<String, Object> map = new HashMap<>();
+ Map<String, String> sampleHistory = new HashMap<>();
+ WarehouseHistory history = histories.get(histories.size() - 1);
+ if(history.getState() == 1){
+ sampleHistory.put("date", history.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+ sampleHistory.put("user", warehouseHistoryMapper.getUserNameById(history.getCreateUser()));
+ sampleHistory.put("code", history.getWarehouseCode());
+ }
+ map.put("sampleHistory", sampleHistory);
+ map.put("insSample", insSample);
+ map.put("histories", histories);
+ map.put("products", insProductMapper.getProductAndResult(id));
+ return map;
+ }
+
+ @Override
+ public int searchSampleId(String sampleCode) {
+ List<InsSample> samples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getSampleCode, sampleCode).select(InsSample::getId));
+ if(samples.size()!=1){
+ throw new ErrorException("鏍峰搧缂栧彿杈撳叆鏈夎");
+ }
+ return samples.get(0).getId();
+ }
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/task/RawMaterIalSchedule.java b/inspect-server/src/main/java/com/ruoyi/inspect/task/RawMaterIalSchedule.java
new file mode 100644
index 0000000..8fd44a5
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/task/RawMaterIalSchedule.java
@@ -0,0 +1,31 @@
+package com.ruoyi.inspect.task;
+
+import com.ruoyi.inspect.service.InsOrderService;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import jakarta.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Author zhuo
+ * @Date 2025/2/20
+ */
+@Component
+public class RawMaterIalSchedule {
+
+ @Resource
+ private InsOrderService insOrderService;
+
+ /**
+ * 瀹氭椂浠诲姟鑾峰彇閲囪喘璁㈠崟
+ */
+ @Scheduled(fixedDelay = 1200000)
+ public void getIfsOrderTiming() {
+ Map<String, Object> map = new HashMap<>();
+ map.put("LOCATION_NO","1302");
+ map.put("STATE_DB","To be Inspected");
+ insOrderService.getIfsOrder(map,false);
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/util/HackLoopTableRenderPolicy.java b/inspect-server/src/main/java/com/ruoyi/inspect/util/HackLoopTableRenderPolicy.java
new file mode 100644
index 0000000..9343a26
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/util/HackLoopTableRenderPolicy.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2014-2020 Sayi
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ruoyi.inspect.util;
+
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.exception.RenderException;
+import com.deepoove.poi.policy.RenderPolicy;
+import com.deepoove.poi.render.compute.RenderDataCompute;
+import com.deepoove.poi.render.processor.DocumentProcessor;
+import com.deepoove.poi.resolver.TemplateResolver;
+import com.deepoove.poi.template.ElementTemplate;
+import com.deepoove.poi.template.MetaTemplate;
+import com.deepoove.poi.template.run.RunTemplate;
+import com.deepoove.poi.util.ReflectionUtils;
+import com.deepoove.poi.util.TableTools;
+import org.apache.poi.xwpf.usermodel.*;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVMerge;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Hack for loop table row
+ *
+ * @author Sayi
+ *
+ */
+public class HackLoopTableRenderPolicy implements RenderPolicy {
+
+ private String prefix;
+ private String suffix;
+ private boolean onSameLine;
+
+ public HackLoopTableRenderPolicy() {
+ this(false);
+ }
+
+ public HackLoopTableRenderPolicy(boolean onSameLine) {
+ this("[", "]", onSameLine);
+ }
+
+ public HackLoopTableRenderPolicy(String prefix, String suffix) {
+ this(prefix, suffix, false);
+ }
+
+ public HackLoopTableRenderPolicy(String prefix, String suffix, boolean onSameLine) {
+ this.prefix = prefix;
+ this.suffix = suffix;
+ this.onSameLine = onSameLine;
+ }
+
+ @Override
+ public void render(ElementTemplate eleTemplate, Object data, XWPFTemplate template) {
+ RunTemplate runTemplate = (RunTemplate) eleTemplate;
+ XWPFRun run = runTemplate.getRun();
+ try {
+ if (!TableTools.isInsideTable(run)) {
+ throw new IllegalStateException(
+ "The template tag " + runTemplate.getSource() + " must be inside a table");
+ }
+ XWPFTableCell tagCell = (XWPFTableCell) ((XWPFParagraph) run.getParent()).getBody();
+ XWPFTable table = tagCell.getTableRow().getTable();
+ run.setText("", 0);
+
+ int templateRowIndex = getTemplateRowIndex(tagCell);
+ if (null != data && data instanceof Iterable) {
+ Iterator<?> iterator = ((Iterable<?>) data).iterator();
+ XWPFTableRow templateRow = table.getRow(templateRowIndex);
+ int insertPosition = templateRowIndex;
+
+ TemplateResolver resolver = new TemplateResolver(template.getConfig().copy(prefix, suffix));
+ boolean firstFlag = true;
+ while (iterator.hasNext()) {
+ insertPosition = templateRowIndex++;
+ XWPFTableRow nextRow = table.insertNewTableRow(insertPosition);
+ setTableRow(table, templateRow, insertPosition);
+
+ // double set row
+ XmlCursor newCursor = templateRow.getCtRow().newCursor();
+ newCursor.toPrevSibling();
+ XmlObject object = newCursor.getObject();
+ nextRow = new XWPFTableRow((CTRow) object, table);
+ if (!firstFlag) {
+ // update VMerge cells for non-first row
+ List<XWPFTableCell> tableCells = nextRow.getTableCells();
+ for (XWPFTableCell cell : tableCells) {
+ CTTcPr tcPr = TableTools.getTcPr(cell);
+ CTVMerge vMerge = tcPr.getVMerge();
+ if (null == vMerge) continue;
+ if (STMerge.RESTART == vMerge.getVal()) {
+ vMerge.setVal(STMerge.CONTINUE);
+ }
+ }
+ } else {
+ firstFlag = false;
+ }
+ setTableRow(table, nextRow, insertPosition);
+
+ RenderDataCompute dataCompute = template.getConfig().getRenderDataComputeFactory()
+ .newCompute(iterator.next());
+ List<XWPFTableCell> cells = nextRow.getTableCells();
+ cells.forEach(cell -> {
+ List<MetaTemplate> templates = resolver.resolveBodyElements(cell.getBodyElements());
+ new DocumentProcessor(template, resolver, dataCompute).process(templates);
+ });
+ }
+ }
+
+ table.removeRow(templateRowIndex);
+ afterloop(table, data);
+ } catch (Exception e) {
+ throw new RenderException("HackLoopTable for " + eleTemplate + "error: " + e.getMessage(), e);
+ }
+ }
+
+ private int getTemplateRowIndex(XWPFTableCell tagCell) {
+ XWPFTableRow tagRow = tagCell.getTableRow();
+ return onSameLine ? getRowIndex(tagRow) : (getRowIndex(tagRow) + 1);
+ }
+
+ protected void afterloop(XWPFTable table, Object data) {
+ }
+
+ @SuppressWarnings("unchecked")
+ private void setTableRow(XWPFTable table, XWPFTableRow templateRow, int pos) {
+ List<XWPFTableRow> rows = (List<XWPFTableRow>) ReflectionUtils.getValue("tableRows", table);
+ rows.set(pos, templateRow);
+ table.getCTTbl().setTrArray(pos, templateRow.getCtRow());
+ }
+
+ private int getRowIndex(XWPFTableRow row) {
+ List<XWPFTableRow> rows = row.getTable().getRows();
+ return rows.indexOf(row);
+ }
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/util/PreserveReportPicturePlaceholderHandler.java b/inspect-server/src/main/java/com/ruoyi/inspect/util/PreserveReportPicturePlaceholderHandler.java
new file mode 100644
index 0000000..9fb72f7
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/util/PreserveReportPicturePlaceholderHandler.java
@@ -0,0 +1,41 @@
+package com.ruoyi.inspect.util;
+
+import com.deepoove.poi.config.Configure;
+import com.deepoove.poi.render.RenderContext;
+import com.deepoove.poi.template.ElementTemplate;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * 鎶ュ憡涓殑绛惧悕鍜屽嵃绔犱細鍦ㄧ紪鍒躲�佸鏍搞�佹壒鍑嗙瓑涓嶅悓闃舵鍒嗗埆鍐欏叆銆�
+ * 淇濈暀鍚庣画闃舵闇�瑕佷娇鐢ㄧ殑鍥剧墖鍗犱綅绗︼紝閬垮厤鍦ㄥ墠闈㈢殑娓叉煋闃舵琚彁鍓嶆竻闄ゃ��
+ */
+public class PreserveReportPicturePlaceholderHandler implements Configure.ValidErrorHandler {
+
+ private static final Set<String> DEFERRED_PICTURE_TAGS = new HashSet<>(Arrays.asList(
+ "writeUrl",
+ "writeDateUrl",
+ "insUrl",
+ "examineUrl",
+ "examineDateUrl",
+ "ratifyUrl",
+ "ratifyDateUrl",
+ "seal1",
+ "seal2"
+ ));
+
+ private final Configure.ClearHandler clearHandler = new Configure.ClearHandler();
+
+ @Override
+ public void handler(RenderContext<?> context) {
+ ElementTemplate template = context.getEleTemplate();
+ if (template != null
+ && Character.valueOf('@').equals(template.getSign())
+ && DEFERRED_PICTURE_TAGS.contains(template.getTagName())) {
+ return;
+ }
+ clearHandler.handler(context);
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/util/ReportSignaturePictureUtils.java b/inspect-server/src/main/java/com/ruoyi/inspect/util/ReportSignaturePictureUtils.java
new file mode 100644
index 0000000..e33f010
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/util/ReportSignaturePictureUtils.java
@@ -0,0 +1,41 @@
+package com.ruoyi.inspect.util;
+
+import com.deepoove.poi.data.PictureRenderData;
+import com.deepoove.poi.data.Pictures;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * 鎶ュ憡绛惧悕鍥剧墖宸ュ叿銆�
+ */
+public final class ReportSignaturePictureUtils {
+
+ private static final int MAX_WIDTH = 90;
+ private static final int MAX_HEIGHT = 45;
+
+ private ReportSignaturePictureUtils() {
+ }
+
+ /**
+ * 鎸夊師濮嬫瘮渚嬪皢绛惧悕閫傞厤鍒版姤鍛婄鍚嶅崟鍏冩牸锛岄伩鍏嶅浘鐗囪秺杩囧崟鍏冩牸杈圭晫鑰岃瑁佸壀銆�
+ */
+ public static PictureRenderData create(String imageDirectory, String signatureUrl) {
+ String signaturePath = imageDirectory + "/" + signatureUrl;
+ try {
+ BufferedImage image = ImageIO.read(new File(signaturePath));
+ if (image != null && image.getWidth() > 0 && image.getHeight() > 0) {
+ double scale = Math.min((double) MAX_WIDTH / image.getWidth(),
+ (double) MAX_HEIGHT / image.getHeight());
+ int width = Math.max(1, (int) Math.round(image.getWidth() * scale));
+ int height = Math.max(1, (int) Math.round(image.getHeight() * scale));
+ return Pictures.ofLocal(signaturePath).size(width, height).create();
+ }
+ } catch (IOException ignored) {
+ // 鍥剧墖鍏冩暟鎹鍙栧け璐ユ椂浠嶅彲灏濊瘯浠ラ粯璁ゅ昂瀵稿啓鍏ユ姤鍛娿��
+ }
+ return Pictures.ofLocal(signaturePath).size(MAX_WIDTH, MAX_HEIGHT).create();
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/util/UserUtils.java b/inspect-server/src/main/java/com/ruoyi/inspect/util/UserUtils.java
new file mode 100644
index 0000000..4ea9c59
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/util/UserUtils.java
@@ -0,0 +1,90 @@
+package com.ruoyi.inspect.util;
+
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.deepoove.poi.data.PictureRenderData;
+import com.deepoove.poi.data.Pictures;
+import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.system.mapper.UserMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * Author: yuan
+ * Date: 2024-12-17 鏄熸湡浜� 10:35:50
+ * Description: User宸ュ叿绫�
+ */
+@Component
+public class UserUtils {
+ private static UserMapper userMapper;
+
+ private static String imgUrl;
+
+ @Autowired
+ public void setUserMapper(UserMapper userMapper) {
+ UserUtils.userMapper = userMapper;
+ }
+
+ @Autowired
+ public void setImgUrl(@Value("${file.path}") String imgUrl) {
+ UserUtils.imgUrl = imgUrl;
+ }
+
+ /**
+ * 閫氳繃浜哄憳id鑾峰彇鐢ㄦ埛绛惧悕鍦板潃
+ * @param userId 浜哄憳id
+ * @return 鐢ㄦ埛绛惧悕鍦板潃
+ */
+ public static String getUserSignatureUrl(Integer userId) {
+ String userSignatureUrl = null;
+ if (userId != null) {
+ userSignatureUrl = userMapper.selectOne(Wrappers.<User>lambdaQuery()
+ .eq(User::getId, userId))
+ .getSignatureUrl();
+ if (StringUtils.isBlank(userSignatureUrl)) {
+ throw new ErrorException("鎵句笉鍒拌浜哄憳绛惧悕");
+ }
+ return imgUrl + "\\" + userSignatureUrl;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * 閫氳繃浜哄憳id鑾峰彇娓叉煋Word鐢ㄦ埛绛惧悕瀵硅薄
+ * @param userId 浜哄憳id
+ * @return 鐢ㄦ埛绛惧悕瀵硅薄 or null
+ */
+ public static PictureRenderData getFinalUserSignatureUrl(Integer userId) {
+ String userSignatureUrl = null;
+ if (userId != null) {
+ userSignatureUrl = userMapper.selectById(userId)
+ .getSignatureUrl();
+ if (StringUtils.isBlank(userSignatureUrl)) {
+ throw new ErrorException("鎵句笉鍒拌浜哄憳绛惧悕");
+ }
+ }
+ return StringUtils.isNotBlank(userSignatureUrl) ? Pictures.ofLocal(imgUrl + "/" + userSignatureUrl).create() : null;
+ }
+
+
+ /**
+ * 閫氳繃鍚嶅瓧鑾峰彇娓叉煋Word鐢ㄦ埛绛惧悕瀵硅薄
+ * @param userName 浜哄憳鍚嶅瓧
+ * @return 鐢ㄦ埛绛惧悕瀵硅薄 or null
+ */
+ public static PictureRenderData getFinalUserSignatureUrl(String userName) {
+ String userSignatureUrl = null;
+ if (userName != null) {
+ userSignatureUrl = userMapper.selectOne(Wrappers.<User>lambdaQuery()
+ .eq(User::getName, userName))
+ .getSignatureUrl();
+ if (StringUtils.isBlank(userSignatureUrl)) {
+ throw new ErrorException("鎵句笉鍒拌浜哄憳绛惧悕");
+ }
+ }
+ return StringUtils.isNotBlank(userSignatureUrl) ? Pictures.ofLocal(imgUrl + "/" + userSignatureUrl).create() : null;
+ }
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/util/XWPFDocumentUtils.java b/inspect-server/src/main/java/com/ruoyi/inspect/util/XWPFDocumentUtils.java
new file mode 100644
index 0000000..386c987
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/util/XWPFDocumentUtils.java
@@ -0,0 +1,119 @@
+package com.ruoyi.inspect.util;
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import org.apache.poi.xwpf.usermodel.*;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge;
+
+import java.util.*;
+
+/**
+ * @Author zhuo
+ * @Date 2024/11/16
+ */
+public class XWPFDocumentUtils {
+
+ public static void updateMergeByDocument(XWPFDocument document) {
+ // 澶勭悊鍚堝苟鍗曞厓鏍肩殑闂
+ List<XWPFTable> xwpfTables = document.getTables();
+ for (int i = 0; i < xwpfTables.size(); i++) {
+ Set<String> set1 = new HashSet<>();
+ Map<String, Map<String, Integer>> maps = new HashMap<>();
+ for (int j = 0; j < xwpfTables.get(i).getRows().size(); j++) {
+ for (int k = 0; k < xwpfTables.get(i).getRows().get(j).getTableCells().size(); k++) {
+ if (xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().contains("鈭�")) {
+ String[] split = xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().split("鈭�");
+ if (set1.add(split[1])) {
+ Map<String, Integer> map = new HashMap<>();
+ map.put("sr", j);
+ map.put("sc", k);
+ map.put("er", j + 0);
+ map.put("ec", k + 0);
+ maps.put(split[1], map);
+ } else {
+ Map<String, Integer> map1 = maps.get(split[1]);
+ if (j == map1.get("sr")) {
+ map1.put("ec", map1.get("ec") + 1);
+ } else if (k == map1.get("sc")) {
+ map1.put("er", map1.get("er") + 1);
+ }
+ }
+ String str = xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().split("鈭�")[0];
+ xwpfTables.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0);
+ xwpfTables.get(i).getRows().get(j).getTableCells().get(k).setText(str);
+ xwpfTables.get(i).getRows().get(j).getTableCells().get(k).setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
+ xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getParagraphArray(0).setAlignment(ParagraphAlignment.CENTER);
+ }
+ }
+ }
+ // 鍗曞厓鏍兼帓搴�, 閬垮厤鏍煎紡閿欎贡
+ List<Map.Entry<String, Map<String, Integer>>> entries = new ArrayList<>(maps.entrySet());
+ entries.sort((o1, o2) -> o1.getValue().get("sc") - o2.getValue().get("sc"));
+ // 鎸夌収椤哄簭娣诲姞杩涢泦鍚�
+ List<String> list = new ArrayList<>();
+ for (Map.Entry<String, Map<String, Integer>> entry : entries) {
+ list.add(entry.getKey());
+ }
+ for (int a = list.size() - 1; a >= 0; a--) {
+ Map<String, Integer> v = maps.get(list.get(a));
+ for (int j = 0; j < v.get("er") - v.get("sr") + 1; j++) {
+ if (v.get("ec") > v.get("sc")) {
+ try {
+ mergeCellsHorizontally(xwpfTables.get(i), v.get("sr") + j, v.get("sc"), v.get("ec"));
+ } catch (Exception e) {
+ }
+ }
+ }
+ if (v.get("er") > v.get("sr")) {
+ try {
+ mergeCellsVertically(xwpfTables.get(i), v.get("sc"), v.get("sr"), v.get("er"));
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
+ //澶勭悊涓嫳鏂囨崲琛岀殑闂
+ List<XWPFTable> xwpfTables1 = document.getTables();
+ for (int i = 0; i < xwpfTables1.size(); i++) {
+ for (int j = 0; j < xwpfTables1.get(i).getRows().size(); j++) {
+ for (int k = 0; k < xwpfTables1.get(i).getRows().get(j).getTableCells().size(); k++) {
+ if (xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText().contains("@")) {
+ String text = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText();
+ String[] split = text.split("@");
+ xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0);
+ XWPFParagraph xwpfParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).addParagraph();
+ XWPFRun run = xwpfParagraph.createRun();
+ run.setText(split[0]);
+ if (ObjectUtils.isNotNull(split[1])) {
+ run.addBreak();
+ run.setText(split[1]);
+ }
+ xwpfParagraph.setAlignment(ParagraphAlignment.CENTER);
+ }
+ }
+ }
+ }
+ }
+
+ // 姘村钩鍚堝苟鍗曞厓鏍�
+ private static void mergeCellsHorizontally(XWPFTable table, int row, int fromCol, int toCol) {
+ for (int i = fromCol; i <= toCol; i++) {
+ if (i == fromCol) {
+ table.getRow(row).getCell(i).getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART);
+ } else {
+ table.getRow(row).getCell(i).getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE);
+ }
+ }
+ }
+
+ // 鍨傜洿鍚堝苟鍗曞厓鏍�
+ private static void mergeCellsVertically(XWPFTable table, int col, int fromRow, int toRow) {
+ for (int i = fromRow; i <= toRow; i++) {
+ if (i == fromRow) {
+ table.getRow(i).getCell(col).getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.RESTART);
+ } else {
+ table.getRow(i).getCell(col).getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.CONTINUE);
+ }
+ }
+ }
+}
+
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/DeviationAnalyzeVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/DeviationAnalyzeVo.java
new file mode 100644
index 0000000..904c3bb
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/DeviationAnalyzeVo.java
@@ -0,0 +1,58 @@
+package com.ruoyi.inspect.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 鍋忓樊鍒嗘瀽瀵硅薄
+ *
+ * @Author zhuo
+ * @Date 2024/10/25
+ */
+@Data
+public class DeviationAnalyzeVo {
+
+ @Schema(description = "鍘傚妫�娴嬫暟鎹�")
+ private List<Object> supplierData;
+
+ @Schema(description = "鏈湴妫�娴嬫暟鎹�")
+ private List<Object> localData;
+
+ @Schema(description = "缁濆鍋忓樊")
+ private List<Object> absoluteDeviation;
+
+ @Schema(description = "骞冲潎鍊�")
+ private List<Object> average;
+
+ /**
+ * 鍘傚
+ */
+ @Schema(description = "UCL")
+ private List<Object> supplierULC;
+
+ @Schema(description = "LCL")
+ private List<Object> supplierLCL;
+
+ @Schema(description = "骞冲潎鍊�")
+ private List<Object> supplierAverage;
+
+ @Schema(description = "鏋佸樊")
+ private List<Object> supplierRange;
+
+ /**
+ * 鏈湴
+ */
+ @Schema(description = "UCL")
+ private List<Object> localULC;
+
+ @Schema(description = "LCL")
+ private List<Object> localLCL;
+
+ @Schema(description = "骞冲潎鍊�")
+ private List<Object> localAverage;
+
+ @Schema(description = "鏋佸樊")
+ private List<Object> localRange;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/IfsOrderVO.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/IfsOrderVO.java
new file mode 100644
index 0000000..1b50799
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/IfsOrderVO.java
@@ -0,0 +1,80 @@
+package com.ruoyi.inspect.vo;
+
+import com.ruoyi.inspect.pojo.InsOrder;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * ifs璁㈠崟vo
+ */
+@Data
+public class IfsOrderVO extends InsOrder implements Serializable {
+
+
+ /**
+ * 闆朵欢鎵规灞炴�т富閿甶d
+ */
+ @Schema(description = "闆朵欢鎵规灞炴�т富閿甶d")
+ private Long lotPartId;
+
+ /**
+ * 缁濈紭棰滆壊
+ */
+ @Schema(description = "缁濈紭棰滆壊")
+ private String insulationColor;
+
+ /**
+ * 澶栨姢棰滆壊
+ */
+ @Schema(description = "澶栨姢棰滆壊")
+ private String outerColor;
+
+ /**
+ * 鐩樺彿
+ */
+ @Schema(description = "鐩樺彿")
+ private String drumNo;
+
+ /**
+ * 鍗板瓧淇℃伅
+ */
+ @Schema(description = "鍗板瓧淇℃伅")
+ private String letteringInfo;
+
+ /**
+ * 璧峰绫虫爣
+ */
+ @Schema(description = "璧峰绫虫爣")
+ private BigDecimal startMeterMark;
+
+ /**
+ * 鎴绫虫爣
+ */
+ @Schema(description = "鎴绫虫爣")
+ private BigDecimal endMeterMark;
+
+ /**
+ * 鏄惁鏄媶鍒嗚鍗�(0:鍚� 1:鏄�)
+ */
+ @Schema(description = "鏄惁鏄媶鍒嗚鍗�(0:鍚� 1:鏄�)")
+ private Integer isSplitOrder;
+
+
+ /**
+ * ifs璁㈠崟鍒嗙被(01raw:鍘熸潗鏂� 02wg:澶栬喘鎴愬搧)
+ */
+ @Schema(description = "ifs璁㈠崟鍒嗙被(01raw:鍘熸潗鏂� 02wg:澶栬喘鎴愬搧)")
+ private String ifsOrderType;
+
+ private String partNo;
+
+ private String lotBatchNo;
+
+ @Schema(description = "鍚勫師濮嬭褰曟ā鏉跨殑鐜鏉′欢")
+ private List<TemplateConditionVo> templateConditions;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanTaskSwitchVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanTaskSwitchVo.java
new file mode 100644
index 0000000..975f842
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanTaskSwitchVo.java
@@ -0,0 +1,35 @@
+package com.ruoyi.inspect.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class InsOrderPlanTaskSwitchVo{
+ private String id;
+
+ private String entrustCode;
+
+ private String sampleType;
+
+ @Schema(description = "绱ф�ョ▼搴�")
+ private String type;
+
+ @Schema(description = "鐘舵��")
+ private String insState;
+
+ @Schema(description = "绾﹀畾鏃堕棿")
+ private String appointed;
+
+ @Schema(description = "涓嬪彂鏃堕棿")
+ private String sendTime;
+
+ private Integer userId;
+
+ private String sonLaboratory;
+
+ private String laboratory;
+
+ private Integer orderUserId;
+
+ private Integer verifyUser;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java
new file mode 100644
index 0000000..81b8515
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java
@@ -0,0 +1,83 @@
+package com.ruoyi.inspect.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class InsOrderPlanVO{
+
+
+ private Integer id;
+
+ @Schema(description = "濮旀墭缂栧彿")
+ private String entrustCode;
+
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sample;
+
+ @Schema(description = "鐗╂枡灞炴��")
+ private String materialProp;
+
+ @Schema(description = "鏍峰搧鍨嬪彿")
+ private String sampleModel;
+
+ @Schema(description = "绱ф�ョ▼搴�")
+ private String type;
+
+ @Schema(description = "妫�楠岀被鍨�")
+ private String orderType;
+
+ @Schema(description = "鐘舵��")
+ private String insState;
+
+ @Schema(description = "妫�楠屼汉")
+ private String userName;
+
+ @Schema(description = "澶嶆牳浜�")
+ private String checkName;
+
+ private Integer userId;
+
+ @Schema(description = "妫�楠屽紑濮嬫椂闂�")
+ private String insTime;
+
+ @Schema(description = "绾﹀畾鏃堕棿")
+ private String appointed;
+
+ @Schema(description = "涓嬪彂鏃堕棿")
+ private String sendTime;
+
+ @Schema(description = "鐞嗙敱")
+ private String verifyTell;
+
+
+ private String sonLaboratory;
+
+ private Integer orderUserId;
+
+ private Integer verifyUser;
+
+ @Schema(description = "涓嬪崟绫诲埆")
+ private Integer typeSource;
+
+ @Schema(description = "鍘熸潗鏂檌d")
+ private Integer ifsInventoryId;
+
+ @Schema(description = "鎶ュ憡鍦板潃")
+ private String url;
+
+ @Schema(description = "鏂板湴鍧�")
+ private String urlS;
+
+ @Schema(description = "鏄惁鏄摐鍗曚笣")
+ private Integer isCopper;
+
+ @Schema(description = "鏌ョ湅涓存椂鎶ュ憡鍦板潃")
+ private String tempUrlPdf;
+
+ @Schema(description = "鎶ュ憡id")
+ private Integer insReportId;
+
+ @Schema(description = "鏄惁涓烘媶鍒嗚鍗�(0:鍚� 1:鏄�)")
+ private Integer isSplitOrder;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPrintingVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPrintingVo.java
new file mode 100644
index 0000000..8c25cbd
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPrintingVo.java
@@ -0,0 +1,50 @@
+package com.ruoyi.inspect.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * @Author zhuo
+ * @Date 2024/12/3
+ */
+@Data
+public class InsOrderPrintingVo {
+
+ @Schema(description = "璁㈠崟缂栧彿")
+ private Integer insOrderId;
+
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sampleView;
+
+ @Schema(description = "鐢熶骇鍗曚綅")
+ private String production;
+
+ @Schema(description = "瑙勬牸鍨嬪彿")
+ private String sampleModel;
+
+ @Schema(description = "濮旀墭鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime sendTime;
+
+ @Schema(description = "濮旀墭浜�")
+ private String prepareUser;
+
+ @Schema(description = "妫�娴嬬紪鍙�")
+ private String entrustCode;
+
+ @Schema(description = "鏍峰搧缂栫爜")
+ private String sampleCode;
+
+ @Schema(description = "鏍峰搧鏁伴噺")
+ private String testQuantity;
+
+ @Schema(description = "鏉″舰鐮�")
+ private String labelBarCode;
+
+ @Schema(description = "璁㈠崟鐘舵��")
+ private Integer insState;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderTemplateDetailVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderTemplateDetailVo.java
new file mode 100644
index 0000000..59f7148
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderTemplateDetailVo.java
@@ -0,0 +1,22 @@
+package com.ruoyi.inspect.vo;
+
+import com.ruoyi.basic.dto.StandardTreeTemplateBindingVo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** 濮旀墭鍗曟ā鏉胯鎯咃細琛ㄥ崟蹇収 + 缁戝畾鐨勬爣鍑� + 璇ユ爣鍑嗕笅鐨勫師濮嬭褰曟ā鏉裤�� */
+@Data
+public class InsOrderTemplateDetailVo {
+
+ @Schema(description = "琛ㄥ崟蹇収JSON")
+ private String thing;
+
+ @Schema(description = "缁戝畾鐨勬爣鍑嗗簱浜岀骇鏍囧噯ID")
+ private Integer standardTreeId;
+
+ @Schema(description = "鏍囧噯缁戝畾鐨勫師濮嬭褰曟ā鏉�")
+ private List<StandardTreeTemplateBindingVo> templateBindings = new ArrayList<>();
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsSampleUserVO.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsSampleUserVO.java
new file mode 100644
index 0000000..c61fde0
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsSampleUserVO.java
@@ -0,0 +1,33 @@
+package com.ruoyi.inspect.vo;
+
+import com.ruoyi.inspect.pojo.InsSampleUser;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class InsSampleUserVO extends InsSampleUser implements Serializable {
+
+ /**
+ * 妫�楠屽憳
+ */
+ @Schema(description = "妫�楠屽憳")
+ private String inspector;
+
+ /**
+ * 妫�楠屾棩鏈�
+ */
+ @Schema(description = "妫�楠屾棩鏈�")
+ private String inspectDate;
+
+ /**
+ * 鍨嬪彿
+ */
+ @Schema(description = "鍨嬪彿")
+ private String model;
+
+
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/OrderTemplateSummaryVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/OrderTemplateSummaryVo.java
new file mode 100644
index 0000000..83742fd
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/OrderTemplateSummaryVo.java
@@ -0,0 +1,13 @@
+package com.ruoyi.inspect.vo;
+
+import lombok.Data;
+
+/** 璁㈠崟鍘熷璁板綍妯℃澘鐨勮交閲忓睍绀轰俊鎭�� */
+@Data
+public class OrderTemplateSummaryVo {
+ private Integer templateId;
+ private String name;
+ private String number;
+ private String remark;
+ private Integer sort;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/ProductVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/ProductVo.java
new file mode 100644
index 0000000..bb99385
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/ProductVo.java
@@ -0,0 +1,22 @@
+package com.ruoyi.inspect.vo;
+
+import com.ruoyi.inspect.pojo.InsProduct;
+import lombok.Data;
+
+@Data
+public class ProductVo {
+
+ //绠¤壊鏍�
+ private String bushColor;
+
+ //鍏夌氦鑹叉爣
+ private String color;
+
+ //鍏夌氦甯︾紪鍙�
+ private String code;
+
+ //妫�楠岄」鐩�
+ private InsProduct insProduct;
+
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/RawMaterialSupplierVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/RawMaterialSupplierVo.java
new file mode 100644
index 0000000..08c2b42
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/RawMaterialSupplierVo.java
@@ -0,0 +1,31 @@
+package com.ruoyi.inspect.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @Author zhuo
+ * @Date 2024/10/24
+ */
+@Data
+public class RawMaterialSupplierVo {
+
+ @Schema(description = "璁㈠崟id")
+ private Integer OrderId;
+
+ @Schema(description = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+ @Schema(description = "妫�娴嬬紪鍙�")
+ private String entrustCode;
+
+ @Schema(description = "鏍峰搧鍚嶇О")
+ private String sample;
+
+ @Schema(description = "鍨嬪彿")
+ private String model;
+
+ @Schema(description = "妫�娴嬪��")
+ private String lastValue;
+
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/RawProductAnalysisVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/RawProductAnalysisVo.java
new file mode 100644
index 0000000..b6bb729
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/RawProductAnalysisVo.java
@@ -0,0 +1,23 @@
+package com.ruoyi.inspect.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 椤规鍒嗘瀽杩斿洖瀵硅薄
+ *
+ * @Author zhuo
+ * @Date 2024/10/17
+ */
+@Data
+public class RawProductAnalysisVo {
+
+ @Schema(description = "妫�楠岄」鍚嶇О")
+ private List<String> itemNames;
+
+ @Schema(description = "妫�楠岄」鍐呭")
+ private List<Map<String, Object>> productList;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsChildrenVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsChildrenVo.java
new file mode 100644
index 0000000..466ac2e
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsChildrenVo.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class SampleDefectsChildrenVo {
+ private String entrust_code;//濮旀墭缂栫爜
+ private String inspection_item;//妫�楠岄」
+ private String name;//妫�楠屼汉
+ private LocalDateTime create_time;//妫�楠屾棩鏈�
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsFatherVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsFatherVo.java
new file mode 100644
index 0000000..c9e8d24
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsFatherVo.java
@@ -0,0 +1,17 @@
+package com.ruoyi.inspect.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class SampleDefectsFatherVo {
+ private Integer id;//鏍峰搧id
+ private String sample;//鏍峰搧鍚嶇О
+
+ private List<SampleDefectsChildrenVo> children;//瀛愮被
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleVo.java
new file mode 100644
index 0000000..90e0429
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleVo.java
@@ -0,0 +1,10 @@
+package com.ruoyi.inspect.vo;
+
+import com.ruoyi.inspect.pojo.InsSample;
+import lombok.Data;
+
+@Data
+public class SampleVo extends InsSample {
+ //璇曢獙鏂规硶
+ private String methodName;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/TemplateConditionVo.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/TemplateConditionVo.java
new file mode 100644
index 0000000..951358c
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/TemplateConditionVo.java
@@ -0,0 +1,36 @@
+package com.ruoyi.inspect.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+
+/** 鍘熷璁板綍妯℃澘瀵瑰簲鐨勬楠岀幆澧冩潯浠躲�� */
+@Data
+public class TemplateConditionVo {
+
+ @Schema(description = "妯℃澘ID")
+ private Integer templateId;
+
+ @Schema(description = "娓╁害")
+ private String temperature;
+
+ @Schema(description = "婀垮害")
+ private String humidity;
+
+ @Schema(description = "妫�娴嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate detectionTime;
+
+ @Schema(description = "妫�娴嬪湴鐐�")
+ private String detectionPlace;
+
+ @Schema(description = "璁惧ID鍒楄〃")
+ private List<Integer> deviceIds = new ArrayList<>();
+
+ @Schema(description = "妯℃澘妫�楠岀粨璁猴細0涓嶅悎鏍硷紝1鍚堟牸")
+ private Integer insResult;
+}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/UnqualifiedHandlerVO.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/UnqualifiedHandlerVO.java
new file mode 100644
index 0000000..846a9c4
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/UnqualifiedHandlerVO.java
@@ -0,0 +1,155 @@
+package com.ruoyi.inspect.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandler;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+public class UnqualifiedHandlerVO extends InsUnqualifiedHandler {
+
+ @Schema(description = "涓嶅悎鏍煎鐞嗕富閿甶d")
+ private Long handlerId;
+
+ @Schema(description = "鍩�")
+ private String contract;
+
+ @Schema(description = "璁㈠崟鍙�")
+ private String orderNo;
+
+ @Schema(description = "琛屽彿")
+ private String lineNo;
+
+ @Schema(description = "涓嬭揪鍙�")
+ private String releaseNo;
+
+ @Schema(description = "鎺ユ敹鍙�")
+ private Integer receiptNo;
+
+ @Schema(description = "闆朵欢鍙�")
+ private String partNo;
+
+ @Schema(description = "闆朵欢鎻忚堪")
+ private String partDesc;
+
+ @Schema(description = "鐘舵�佹弿杩�")
+ private String status;
+
+ @Schema(description = "鐘舵��")
+ private String statusDB;
+
+ @Schema(description = "鎶佃揪鐨勯噰璐暟閲�")
+ private BigDecimal qtyArrived;
+
+ @Schema(description = "宸叉楠岀殑璐拱鏁伴噺")
+ private BigDecimal qtyInspected;
+
+ @Schema(description = "瑕佹楠岀殑閲囪喘鏁伴噺")
+ private BigDecimal qtyToInspect;
+
+ @Schema(description = "渚涘簲鍟嗙紪鍙�")
+ private String supplierId;
+
+ @Schema(description = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+ @Schema(description = "鎶佃揪鐨勫簱瀛樻暟閲�")
+ private BigDecimal invQtyInStore;
+
+ @Schema(description = "鎶佃揪鐨勯噰璐暟閲�")
+ private BigDecimal purQtyInStore;
+
+ @Schema(description = "閰嶇疆鏍囪瘑")
+ private String configurationId;
+
+ @Schema(description = "鎵瑰彿")
+ private String lotBatchNo;
+
+ @Schema(description = "wdr鍙�")
+ private String waivDevRejNo;
+
+ @Schema(description = "娲诲姩搴忓垪")
+ private String activitySeq;
+
+
+ @Schema(description = "搴忓垪鍙�")
+ private String serialNo;
+
+ @Schema(description = "搴撲綅鍙�")
+ private String locationNo;
+
+ @Schema(description = "鐗堟湰鍙�")
+ private String engChgLevel;
+
+ @Schema(description = "鎺ユ敹浜�")
+ private String receiver;
+
+ @Schema(description = "鎺ユ敹浜哄鍚�")
+ private String receiverName;
+
+ @Schema(description = "閲囪喘鍛�")
+ private String buyerCode;
+
+ @Schema(description = "閲囪喘鍛樺鍚�")
+ private String buyerName;
+
+ @Schema(description = "瀹為檯鍒拌揣鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime arriveDate;
+
+ @Schema(description = "瀹為檯浜よ揣鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime deliveryDate;
+
+ @Schema(description = "鐢熶骇鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime productDate;
+
+ @Schema(description = "澶辨晥鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime invalidDate;
+
+
+ @Schema(description = "瀹℃壒鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime approvedDate;
+
+ @Schema(description = "閲囪喘鐢宠鍒涘缓浜�")
+ private String reqCeater;
+
+ @Schema(description = "閲囪喘鐢宠鍒涘缓浜哄鍚�")
+ private String reqCeaterName;
+
+ @Schema(description = "閲囪喘璁㈠崟琛屽娉�")
+ private String lineRemarks;
+
+ @Schema(description = "閲囪喘鍗曚綅")
+ private String buyUnitMeas;
+
+ /**
+ * 鏄惁涓篿fs鎷夊彇 1:鏄� 0:鍚�
+ */
+ @Schema(description = "鏄惁涓篿fs鎷夊彇 1:鏄� 0:鍚�")
+ private Integer isSource;
+
+ /**
+ * 鎷嗗垎鏁伴噺
+ */
+ @Schema(description = "鎷嗗垎鏁伴噺")
+ private Integer number;
+
+
+ /**
+ * 妫�楠岀姸鎬�
+ */
+ @Schema(description = "妫�楠岀姸鎬�")
+ private Integer state;
+
+ @Schema(description = "鎺ユ敹鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private LocalDateTime receiverDate;
+
+}
diff --git a/inspect-server/src/main/resources/lib/license.xml b/inspect-server/src/main/resources/lib/license.xml
new file mode 100644
index 0000000..ecd46c1
--- /dev/null
+++ b/inspect-server/src/main/resources/lib/license.xml
@@ -0,0 +1,13 @@
+<License>
+ <Data>
+ <Products>
+ <Product>Aspose.Total for Java</Product>
+ <Product>Aspose.Words for Java</Product>
+ </Products>
+ <EditionType>Enterprise</EditionType>
+ <SubscriptionExpiry>20991231</SubscriptionExpiry>
+ <LicenseExpiry>20991231</LicenseExpiry>
+ <SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
+ </Data>
+ <Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>
+</License>
diff --git a/inspect-server/src/main/resources/mapper/DataAnalysisMapper.xml b/inspect-server/src/main/resources/mapper/DataAnalysisMapper.xml
new file mode 100644
index 0000000..6e4e410
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/DataAnalysisMapper.xml
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.DataAnalysisMapper">
+ <!-- 鑾峰彇鏈懆鐨勫師鏉愭枡淇℃伅 -->
+ <select id="getRawPassRateByBarChartByWeek" resultType="java.util.Map">
+ WITH RECURSIVE AllWeeks AS (SELECT 1 AS week
+ UNION ALL
+ SELECT week + 1
+ FROM AllWeeks
+ WHERE week < 7)
+ SELECT COALESCE(sub.sum, 0) AS sum,
+ CASE am.week
+ WHEN 1 THEN '鏄熸湡鏃�'
+ WHEN 2 THEN '鏄熸湡涓�'
+ WHEN 3 THEN '鏄熸湡浜�'
+ WHEN 4 THEN '鏄熸湡涓�'
+ WHEN 5 THEN '鏄熸湡鍥�'
+ WHEN 6 THEN '鏄熸湡浜�'
+ WHEN 7 THEN '鏄熸湡鍏�'
+ END AS searchTime,
+ COALESCE(sub.passRate, 0) AS passRate
+ FROM AllWeeks am
+ LEFT JOIN (select COUNT(*) sum,
+ DAYOFWEEK(io1.send_time) searchTime,
+ ROUND((COUNT(*) - SUM(CASE WHEN inspect_status in (2, 4) THEN 1 ELSE 0 END)) / COUNT(*) *
+ 100,
+ 2) passRate
+ from ifs_inventory_quantity iiq
+ LEFT JOIN ins_order io1 on io1.ifs_inventory_id = iiq.id
+ and io1.order_type = #{dto.orderType}
+ and io1.state != -1
+ left join (select is2.ins_order_id,
+ is2.sample_type,
+ is2.model,
+ is2.sample
+ from ins_sample is2
+ group by is2.ins_order_id) ins on ins.ins_order_id = io1.id
+ where iiq.is_finish = 1
+ and iiq.inspect_status not in (0, 3)
+ and (io1.send_time between #{dto.beginDate} and #{dto.endDate})
+ <if test="dto.sampleName != null and dto.sampleName != ''">
+ and ins.sample like concat('%', #{dto.sampleName}, '%')
+ </if>
+ <if test="dto.modelName != null and dto.modelName != ''">
+ and ins.model like concat('%', #{dto.modelName}, '%')
+ </if>
+ <if test="dto.supplierName != null and dto.supplierName != ''">
+ and iiq.supplier_name like concat('%', #{dto.supplierName}, '%')
+ </if>
+ GROUP BY DAYOFWEEK(io1.send_time)
+ having searchTime is not null) sub ON am.week = sub.searchTime
+ WHERE am.week BETWEEN 1 AND 7
+ ORDER BY am.week
+ </select>
+
+ <!-- 鑾峰彇鏈湀鐨勫師鏉愭枡淇℃伅 -->
+ <select id="getRawPassRateByBarChartByDay" resultType="java.util.Map">
+ select COUNT(*) sum,
+ DATE_FORMAT(io1.send_time, '%Y-%m-%d') searchTime,
+ ROUND((COUNT(*) - SUM(CASE WHEN inspect_status in (2, 4) THEN 1 ELSE 0 END)) / COUNT(*) * 100,
+ 2) passRate
+ from ifs_inventory_quantity iiq
+ LEFT JOIN ins_order io1 on io1.ifs_inventory_id = iiq.id
+ and io1.order_type = #{dto.orderType}
+ and io1.state != -1
+ left join (select is2.ins_order_id,
+ is2.sample_type,
+ is2.model,
+ is2.sample
+ from ins_sample is2
+ group by is2.ins_order_id) ins on ins.ins_order_id = io1.id
+ where iiq.is_finish = 1
+ and iiq.inspect_status not in (0, 3)
+ and (io1.send_time between #{dto.beginDate} and #{dto.endDate})
+ <if test="dto.sampleName != null and dto.sampleName != ''">
+ and ins.sample like concat('%', #{dto.sampleName}, '%')
+ </if>
+ <if test="dto.modelName != null and dto.modelName != ''">
+ and ins.model like concat('%', #{dto.modelName}, '%')
+ </if>
+ <if test="dto.supplierName != null and dto.supplierName != ''">
+ and iiq.supplier_name like concat('%', #{dto.supplierName}, '%')
+ </if>
+ GROUP BY DATE_FORMAT(io1.send_time, '%Y-%m-%d')
+ having searchTime is not null
+ order by searchTime
+ </select>
+
+ <!-- 鑾峰彇鏈勾鐨勫師鏉愭枡淇℃伅 -->
+ <select id="getRawPassRateByBarChartByYear" resultType="java.util.Map">
+ WITH RECURSIVE AllMonths AS (SELECT 1 AS month
+ UNION ALL
+ SELECT month + 1
+ FROM AllMonths
+ WHERE month < 12)
+ SELECT COALESCE(sub.sum, 0) AS sum,
+ CASE am.month
+ WHEN 1 THEN '1鏈�'
+ WHEN 2 THEN '2鏈�'
+ WHEN 3 THEN '3鏈�'
+ WHEN 4 THEN '4鏈�'
+ WHEN 5 THEN '5鏈�'
+ WHEN 6 THEN '6鏈�'
+ WHEN 7 THEN '7鏈�'
+ WHEN 8 THEN '8鏈�'
+ WHEN 9 THEN '9鏈�'
+ WHEN 10 THEN '10鏈�'
+ WHEN 11 THEN '11鏈�'
+ WHEN 12 THEN '12鏈�'
+ END AS searchTime,
+ COALESCE(sub.passRate, 0) AS passRate
+ FROM AllMonths am
+ LEFT JOIN (select COUNT(*) sum,
+ DATE_FORMAT(io1.send_time, '%m') searchTime,
+ ROUND((COUNT(*) - SUM(CASE WHEN inspect_status in (2, 4) THEN 1 ELSE 0 END)) /
+ COUNT(*) * 100,
+ 2) passRate
+ from ifs_inventory_quantity iiq
+ LEFT JOIN ins_order io1 on io1.ifs_inventory_id = iiq.id
+ and io1.order_type = #{dto.orderType}
+ and io1.state != -1
+ left join (select is2.ins_order_id,
+ is2.sample_type,
+ is2.model,
+ is2.sample
+ from ins_sample is2
+ group by is2.ins_order_id) ins on ins.ins_order_id = io1.id
+ where iiq.is_finish = 1
+ and iiq.inspect_status not in (0, 3)
+ and (io1.send_time between #{dto.beginDate} and #{dto.endDate})
+ <if test="dto.sampleName != null and dto.sampleName != ''">
+ and ins.sample like concat('%', #{dto.sampleName}, '%')
+ </if>
+ <if test="dto.modelName != null and dto.modelName != ''">
+ and ins.model like concat('%', #{dto.modelName}, '%')
+ </if>
+ <if test="dto.supplierName != null and dto.supplierName != ''">
+ and iiq.supplier_name like concat('%', #{dto.supplierName}, '%')
+ </if>
+ GROUP BY DATE_FORMAT(io1.send_time, '%Y-%m')
+ having searchTime is not null) sub ON am.month = sub.searchTime
+ WHERE am.month BETWEEN 1 AND 12
+ ORDER BY am.month
+ </select>
+
+ <!-- 鏌ョ湅鍘熸潗鏂欓ゼ鐘跺浘 -->
+ <select id="getRawPassRateByCake" resultType="java.util.Map">
+ select COUNT(*) sum,
+ (COUNT(*) - SUM(CASE WHEN inspect_status in (2, 4) THEN 1 ELSE 0 END)) qualified,
+ (COUNT(*) - SUM(CASE WHEN inspect_status = 1 THEN 1 ELSE 0 END)) unQualified,
+ ROUND((COUNT(*) - SUM(CASE WHEN inspect_status in (2, 4) THEN 1 ELSE 0 END)) / COUNT(*) * 100,
+ 2) AS passRate
+ from ifs_inventory_quantity iiq
+ LEFT JOIN ins_order io1 on io1.ifs_inventory_id = iiq.id
+ and io1.order_type = #{dto.orderType}
+ and io1.state != -1
+ left join (select is2.ins_order_id,
+ is2.sample_type,
+ is2.model,
+ is2.sample
+ from ins_sample is2
+ group by is2.ins_order_id) ins on ins.ins_order_id = io1.id
+ where iiq.is_finish = 1
+ and iiq.inspect_status not in (0, 3)
+ and (io1.send_time between #{dto.beginDate} and #{dto.endDate})
+ <if test="dto.sampleName != null and dto.sampleName != ''">
+ and ins.sample like concat('%', #{dto.sampleName}, '%')
+ </if>
+ <if test="dto.modelName != null and dto.modelName != ''">
+ and ins.model like concat('%', #{dto.modelName}, '%')
+ </if>
+ <if test="dto.supplierName != null and dto.supplierName != ''">
+ and iiq.supplier_name like concat('%', #{dto.supplierName}, '%')
+ </if>
+ </select>
+
+ <select id="getRawProductAnalysisAllSample" resultType="com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto">
+ select iiq.*,
+ io1.entrust_code,
+ io1.id enter_order_id,
+ ins.id sample_id,
+ ins.sample_type,
+ ins.sample sample_name,
+ ins.model sample_model,
+ io1.send_time
+ from ifs_inventory_quantity iiq
+ LEFT JOIN ins_order io1 on io1.ifs_inventory_id = iiq.id
+ and io1.order_type = #{dto.orderType}
+ and io1.state != -1
+ left join ins_sample ins on ins.ins_order_id = io1.id
+ where iiq.is_finish = 1
+ and iiq.inspect_status not in (0, 3)
+ <if test="dto.beginDate != null and dto.beginDate != '' and dto.endDate != null and dto.endDate != ''">
+ and (io1.send_time between #{dto.beginDate} and #{dto.endDate})
+ </if>
+ <if test="dto.sampleName != null and dto.sampleName != ''">
+ and ins.sample like concat('%', #{dto.sampleName}, '%')
+ </if>
+ <if test="dto.modelName != null and dto.modelName != ''">
+ and ins.model like concat('%', #{dto.modelName}, '%')
+ </if>
+ <if test="dto.supplierName != null and dto.supplierName != ''">
+ and iiq.supplier_name like concat('%', #{dto.supplierName}, '%')
+ </if>
+ </select>
+
+ <!-- 鏌ヨ妫�娴嬮」闆嗗悎 -->
+ <select id="getRawProductAnalysisList" resultType="com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto">
+ select iiq.*,
+ io1.entrust_code,
+ io1.id enter_order_id,
+ ins.id sample_id,
+ ins.sample_type,
+ ins.sample sample_name,
+ ins.model sample_model,
+ u.name user_name,
+ io1.send_time
+ from ifs_inventory_quantity iiq
+ LEFT JOIN ins_order io1 on io1.ifs_inventory_id = iiq.id
+ and io1.order_type = #{dto.orderType}
+ and io1.state != -1
+ left join user u on io1.create_user = u.id
+ left join (select is2.ins_order_id,
+ is2.sample_type,
+ is2.sample_code,
+ is2.model,
+ is2.sample,
+ is2.id
+ from ins_sample is2
+ group by is2.ins_order_id) ins on ins.ins_order_id = io1.id
+ where iiq.is_finish = 1
+ and iiq.inspect_status not in (0, 3)
+ <if test="dto.beginDate != null and dto.beginDate != '' and dto.endDate != null and dto.endDate != ''">
+ and (io1.send_time between #{dto.beginDate} and #{dto.endDate})
+ </if>
+ <if test="dto.sampleName != null and dto.sampleName != ''">
+ and ins.sample like concat('%', #{dto.sampleName}, '%')
+ </if>
+ <if test="dto.modelName != null and dto.modelName != ''">
+ and ins.model like concat('%', #{dto.modelName}, '%')
+ </if>
+ <if test="dto.supplierName != null and dto.supplierName != ''">
+ and iiq.supplier_name like concat('%', #{dto.supplierName}, '%')
+ </if>
+ </select>
+ <select id="getItemValueByOrderIds" resultType="com.ruoyi.inspect.vo.RawMaterialSupplierVo">
+ select io2.id orderId,
+ io2.entrust_code,
+ ins.sample,
+ ins.model,
+ iiq.supplier_name,
+ (select ip.`last_value`
+ from ins_product ip
+ where concat(ip.inspection_item, ip.inspection_item_subclass) = #{itemName}
+ and ip.ins_sample_id = ins.id
+ limit 1) lastValue
+ from ins_order io2
+ left join ifs_inventory_quantity iiq on io2.ifs_inventory_id = iiq.id
+ left join (select is2.ins_order_id,
+ is2.sample_type,
+ is2.sample_code,
+ is2.model,
+ is2.sample,
+ is2.id
+ from ins_sample is2
+ group by is2.ins_order_id) ins on ins.ins_order_id = io2.id
+ where io2.id in
+ <foreach collection="insOrderIds" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ </select>
+
+ <!-- 鏌ヨ鏈湀涓庝笂鏈堝悎鏍肩巼瀵规瘮 -->
+ <select id="getRawUpMonth" resultType="java.util.Map">
+ select DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 1 MONTH), '%Y-%m') as month,
+ (select ROUND((COUNT(*) - SUM(CASE WHEN inspect_status in (2, 4) THEN 1 ELSE 0 END)) / COUNT(*) *
+ 100,
+ 2) passRate
+ from ifs_inventory_quantity iiq
+ LEFT JOIN ins_order io1 on io1.ifs_inventory_id = iiq.id
+ and io1.order_type = '杩涘巶妫�楠�'
+ and io1.state != -1
+ where iiq.is_finish = 1
+ and iiq.inspect_status not in (0, 3)
+ and (io1.send_time between DATE_FORMAT(DATE_SUB(DATE_FORMAT(NOW(), '%Y-%m-01'), INTERVAL 1 MONTH), '%Y-%m-%d %H:%i:%s')
+ and DATE_FORMAT(LAST_DAY(DATE_SUB(NOW(), INTERVAL 1 MONTH)), '%Y-%m-%d 23:59:59'))) passRate
+ UNION ALL
+ select DATE_FORMAT(CURRENT_DATE, '%Y-%m') as month,
+ (select ROUND((COUNT(*) - SUM(CASE WHEN inspect_status in (2, 4) THEN 1 ELSE 0 END)) / COUNT(*) *
+ 100,
+ 2) passRate
+ from ifs_inventory_quantity iiq
+ LEFT JOIN ins_order io1 on io1.ifs_inventory_id = iiq.id
+ and io1.order_type = '杩涘巶妫�楠�'
+ and io1.state != -1
+ where iiq.is_finish = 1
+ and iiq.inspect_status not in (0, 3)
+ and (io1.send_time between
+ DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -DAY(CURDATE()) + 1 DAY), '%Y-%m-%d 00:00:00')
+ and DATE_FORMAT(LAST_DAY(CURDATE()), '%Y-%m-%d 23:59:59'))) passRate
+ </select>
+
+ <!-- 鏌ヨ鏈湀妫�楠岀被鍨� -->
+ <select id="getOrderTypeCookie" resultType="java.util.Map">
+ select sum(order_type = '鎶芥') spotCheck,
+ sum(order_type = 'Customer-ordered test') customer,
+ sum(order_type = '杩涘巶妫�楠�') enter,
+ sum(order_type = 'Quarterly inspection') quarterly
+ from ins_order
+ where state != -1
+ and (send_time between DATE_FORMAT(LAST_DAY(NOW() - INTERVAL 1 MONTH) + INTERVAL 1 DAY,
+ '%Y-%m-%d 00:00:00') and DATE_FORMAT(LAST_DAY(NOW()), '%Y-%m-%d 23:59:59'))
+
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/IfsPartPropsRecordMapper.xml b/inspect-server/src/main/resources/mapper/IfsPartPropsRecordMapper.xml
new file mode 100644
index 0000000..4cccb84
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/IfsPartPropsRecordMapper.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.IfsPartPropsRecordMapper">
+
+ <resultMap id="BaseResultMap" type="com.ruoyi.inspect.pojo.IfsPartPropsRecord">
+ <id property="id" column="id" jdbcType="BIGINT"/>
+ <result property="ifsInventoryId" column="ifs_inventory_id" jdbcType="BIGINT"/>
+ <result property="drumNo" column="drum_no" jdbcType="VARCHAR"/>
+ <result property="startMeterMark" column="start_meter_mark" jdbcType="DECIMAL"/>
+ <result property="endMeterMark" column="end_meter_mark" jdbcType="DECIMAL"/>
+ <result property="insulationColor" column="insulation_color" jdbcType="VARCHAR"/>
+ <result property="outerColor" column="outer_color" jdbcType="VARCHAR"/>
+ <result property="letteringInfo" column="lettering_info" jdbcType="VARCHAR"/>
+ <result property="partPropsFlag" column="part_props_flag" jdbcType="BIT"/>
+ </resultMap>
+
+ <sql id="Base_Column_List">
+ id,ifs_inventory_id,drum_no,
+ start_meter_mark,end_meter_mark,insulation_color,
+ outer_color,lettering_info,part_props_flag
+ </sql>
+ <select id="selectCountByPartNoAndLotBatchNo" resultType="java.lang.Long">
+ select
+ COUNT(iiq.id)
+ from ifs_inventory_quantity iiq
+ left join ifs_part_props_record ippr
+ on iiq.id = ippr.ifs_inventory_id
+ where iiq.part_no = #{partNo}
+ and iiq.update_batch_no= #{lotBatchNo}
+ and ippr.id is not null
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/IfsSplitOrderRecordMapper.xml b/inspect-server/src/main/resources/mapper/IfsSplitOrderRecordMapper.xml
new file mode 100644
index 0000000..50a7493
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/IfsSplitOrderRecordMapper.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.IfsSplitOrderRecordMapper">
+
+ <resultMap id="BaseResultMap" type="com.ruoyi.inspect.pojo.IfsSplitOrderRecord">
+ <id property="id" column="id" jdbcType="BIGINT"/>
+ <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
+ <result property="lineNo" column="line_no" jdbcType="VARCHAR"/>
+ <result property="releaseNo" column="release_no" jdbcType="VARCHAR"/>
+ <result property="receiptNo" column="receipt_no" jdbcType="INTEGER"/>
+ <result property="partNo" column="part_no" jdbcType="VARCHAR"/>
+ <result property="systemNo" column="system_no" jdbcType="VARCHAR"/>
+ <result property="spec" column="spec" jdbcType="VARCHAR"/>
+ <result property="lotBatchNo" column="lot_batch_no" jdbcType="VARCHAR"/>
+ <result property="length" column="length" jdbcType="DECIMAL"/>
+ <result property="qtyStock" column="qty_stock" jdbcType="DECIMAL"/>
+ <result property="insulationColor" column="insulation_color" jdbcType="VARCHAR"/>
+ <result property="outerColor" column="outer_color" jdbcType="VARCHAR"/>
+ <result property="letteringInfo" column="lettering_info" jdbcType="VARCHAR"/>
+ <result property="drumNo" column="drum_no" jdbcType="VARCHAR"/>
+ <result property="locationNo" column="location_no" jdbcType="VARCHAR"/>
+ <result property="stockSource" column="stock_source" jdbcType="VARCHAR"/>
+ <result property="remark" column="remark" jdbcType="VARCHAR"/>
+ <result property="syncStatus" column="sync_status" jdbcType="TINYINT"/>
+ <result property="createUser" column="create_user" jdbcType="INTEGER"/>
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+ <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
+ <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+ </resultMap>
+
+ <sql id="Base_Column_List">
+ id,order_no,line_no,
+ release_no,receipt_no,part_no,
+ system_no,spec,lot_batch_no,
+ length,qty_stock,insulation_color,
+ outer_color,lettering_info,drum_no,
+ location_no,stock_source,remark,
+ sync_status,create_user,create_time,
+ update_user,update_time
+ </sql>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsOrderDeviceRecordMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderDeviceRecordMapper.xml
new file mode 100644
index 0000000..af17e04
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsOrderDeviceRecordMapper.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.InsOrderDeviceRecordMapper">
+
+ <!-- 璁㈠崟id鏌ヨ璁惧浣跨敤璁板綍 -->
+ <select id="selectDeviceNumber" resultType="com.ruoyi.inspect.dto.InsOrderDeviceRecordDto">
+ select dr.*,
+ d.management_number
+ from device_record dr
+ left join device d on d.id = dr.device_id
+ where dr.ins_order_id = #{insOrderId}
+ </select>
+
+ <!-- 鏍规嵁缂栧彿鏌ヨ璁惧id -->
+ <select id="selectDeviceIdsByNumbers" resultType="java.lang.Integer">
+ select id
+ from device
+ where management_number in
+ <foreach collection="deviceNumbers" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsOrderFileMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderFileMapper.xml
new file mode 100644
index 0000000..ce5e6c2
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsOrderFileMapper.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsOrderFileMapper">
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <select id="getFileList" resultType="com.ruoyi.inspect.pojo.InsOrderFile">
+ select A.*
+ from (select iof.*, name
+ from ins_order_file iof
+ left join user u on iof.create_user = u.id
+ where iof.ins_order_id = #{insOrderId}) A
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
new file mode 100644
index 0000000..798924f
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -0,0 +1,576 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsOrderMapper">
+
+ <resultMap id="selectSampleDefectsMap" type="com.ruoyi.inspect.vo.SampleDefectsFatherVo">
+ <id column="id" property="id"/>
+ <result column="sample" property="sample"/>
+ <association property="children" resultMap="SampleDefectsChildrenMap" javaType="java.util.List"/>
+ </resultMap>
+
+ <resultMap id="SampleDefectsChildrenMap" type="com.ruoyi.inspect.vo.SampleDefectsChildrenVo">
+ <result column="entrust_code" property="entrust_code"/>
+ <result column="inspection_item" property="inspection_item"/>
+ <result column="name" property="name"/>
+ <result column="create_time" property="create_time"/>
+ </resultMap>
+
+ <sql id="selectSampleProductDto2">
+ i.id,
+ isa.sample_code,
+ isa.sample,
+ isa.model,
+ isa.ins_state,
+ ip.id insProductId,
+ ip.state,
+ ip.unit,
+ ip.inspection_item_class,
+ ip.inspection_item_class_en,
+ ip.inspection_item,
+ ip.inspection_item_en,
+ ip.inspection_item_subclass,
+ ip.inspection_item_subclass_en,
+ ip.son_laboratory,
+ ip.inspection_item_type,
+ ip.inspection_value_type,
+ ip.ask,
+ ip.tell,
+ ip.`last_value`,
+ ip.ins_result,
+ ip.radius,
+ isa.quantity,
+ ip.sort,
+ ip.cable_tag
+ </sql>
+
+ <sql id="selectInsOrderExport">
+ SELECT
+ io.*,
+ isau.user_id assign,
+ ir.id report_id,
+ ir.url,
+ ir.url_s,
+ sample_counts.sample_num,
+ CONCAT(ROUND(approved_product_counts.approved_count / total_product_counts.total_count * 100, 2), '%') AS insProgress,
+ io.sample_view AS sample_name,
+ GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model,
+ u.name,
+ testing_name,
+ case when io.type = 0 then '鏅��'
+ when io.type = 1 then '浼樺厛'
+ when io.type = 2 then '绱ф��'
+ end typeString,
+ case when io.ins_result = 1 then '鍚堟牸'
+ when io.ins_result = 0 then '涓嶅悎鏍�'
+ else '寰呮楠�' end insResultString
+ FROM
+ ins_order io
+ LEFT JOIN
+ ins_sample isa ON io.id = isa.ins_order_id
+ LEFT JOIN
+ ins_sample_user isau ON isau.ins_sample_id = io.id
+ LEFT JOIN
+ (SELECT id, ins_order_id, is_ratify, url, url_s FROM ins_report WHERE is_ratify = 1) ir ON io.id = ir.ins_order_id
+ LEFT JOIN
+ user u ON io.create_user = u.id
+ LEFT JOIN
+ (SELECT ins_order_id, COUNT(*) AS sample_num
+ FROM ins_sample
+ WHERE id in(select id1 from (select is2.id id1 ,ip.id from ins_sample is2 left join ins_product ip on is2.id = ip.ins_sample_id where ip.id is not null)s )
+ GROUP BY ins_order_id) sample_counts ON io.id = sample_counts.ins_order_id
+ LEFT JOIN
+ (SELECT ins_sample.ins_order_id, COUNT(*) AS total_count
+ FROM ins_product
+ JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id
+ WHERE ins_product.state = 1
+ GROUP BY ins_sample.ins_order_id) total_product_counts ON io.id = total_product_counts.ins_order_id
+ LEFT JOIN
+ (SELECT ins_sample.ins_order_id, COUNT(*) AS approved_count
+ FROM ins_product
+ JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id
+ WHERE ins_product.state = 1 AND ins_product.ins_result IS NOT NULL
+ GROUP BY ins_sample.ins_order_id) approved_product_counts ON io.id = approved_product_counts.ins_order_id
+ LEFT JOIN (SELECT ins_sample_id, GROUP_CONCAT(DISTINCT uu.name SEPARATOR ',') AS testing_name
+ FROM ins_sample_user u
+ LEFT JOIN user uu ON u.user_id = uu.id
+ WHERE u.state = 0
+ GROUP BY ins_sample_id
+ ORDER BY ins_sample_id) isu ON isu.ins_sample_id = io.id
+ </sql>
+
+ <select id="selectInsOrderPage" resultType="com.ruoyi.inspect.dto.SampleOrderDto">
+ select *
+ from (
+ SELECT
+ io.*,
+ isau.user_id assign,
+ ir.id report_id,
+ ir.url,
+ ir.url_s,
+ sample_counts.sample_num,
+ CONCAT(ROUND(approved_product_counts.approved_count / total_product_counts.total_count * 100, 2), '%') AS insProgress,
+ io.sample_view AS sample_name,
+ GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model,
+ u.name,
+ testing_name,
+ ip.son_laboratory,
+ isr.reject_remark AS sample_reject_remark
+ FROM
+ ins_order io
+ LEFT JOIN
+ ins_sample isa ON io.id = isa.ins_order_id
+ left join ins_product ip on ip.ins_sample_id = isa.id
+ LEFT JOIN ins_sample_receipt isr ON isr.ins_order_id = io.id
+ LEFT JOIN
+ ins_sample_user isau ON isau.ins_sample_id = io.id
+ LEFT JOIN
+ (SELECT id, ins_order_id, is_ratify, url, url_s FROM ins_report WHERE is_ratify = 1) ir ON io.id = ir.ins_order_id
+ LEFT JOIN
+ user u ON io.create_user = u.id
+ LEFT JOIN
+ (SELECT ins_order_id, COUNT(*) AS sample_num
+ FROM ins_sample
+ WHERE id in(select id1 from (select is2.id id1 ,ip.id from ins_sample is2 left join ins_product ip on is2.id = ip.ins_sample_id where ip.id is not null)s )
+ GROUP BY ins_order_id) sample_counts ON io.id = sample_counts.ins_order_id
+ LEFT JOIN
+ (SELECT ins_sample.ins_order_id, COUNT(*) AS total_count
+ FROM ins_product
+ JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id
+ WHERE ins_product.state = 1 and is_binding !=1
+ GROUP BY ins_sample.ins_order_id) total_product_counts ON io.id = total_product_counts.ins_order_id
+ LEFT JOIN
+ (SELECT ins_sample.ins_order_id, COUNT(*) AS approved_count
+ FROM ins_product
+ JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id
+ WHERE ins_product.state = 1 and is_binding !=1 AND ins_product.ins_result IS NOT NULL
+ GROUP BY ins_sample.ins_order_id) approved_product_counts ON io.id = approved_product_counts.ins_order_id
+ LEFT JOIN (SELECT ins_sample_id, GROUP_CONCAT(DISTINCT uu.name SEPARATOR ',') AS testing_name
+ FROM ins_sample_user u
+ LEFT JOIN user uu ON u.user_id = uu.id
+ WHERE u.state = 0
+ GROUP BY ins_sample_id
+ ORDER BY ins_sample_id) isu ON isu.ins_sample_id = io.id
+ where (io.ifs_inventory_id IS NULL OR TRIM(io.ifs_inventory_id) = '')
+ <if test="isOrderAll != null and isOrderAll != ''">
+ AND io.state in (1, 4, 5)
+ </if>
+ <if test="receiptSubmitted != null and receiptSubmitted != ''">
+ AND isr.status = 1
+ </if>
+ <if test="laboratory!=null and laboratory!=''">
+ AND io.laboratory=#{laboratory}
+ </if>
+ GROUP BY io.id,type
+ order by type desc,io.id desc
+ ) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+
+ <select id="selectInsOrderParameter" resultType="com.ruoyi.inspect.pojo.InsOrder">
+ select *
+ from (
+ select
+ id,
+ appointed,
+ user_id,
+ create_user,
+ otc_code,
+ code,
+ custom,
+ update_user,
+ update_time,
+ type,
+ entrust_code,
+ company,
+ sample,
+ sample_view,
+ remark,
+ create_time,
+ state
+ from ins_order
+ ) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+ <select id="getLaboratoryCode" resultType="java.lang.String">
+ select laboratory_number
+ from laboratory
+ where laboratory_name = #{name}
+ </select>
+ <select id="selectSampleAndProductByOrderId" resultType="com.ruoyi.inspect.dto.SampleProductDto2">
+ select *
+ from (
+ select
+ i.id,
+ isa.sample_code,
+ isa.sample,
+ isa.model,
+ isa.ins_state,
+ ip.id insProductId,
+ ip.state,
+ ip.unit,
+ ip.inspection_item,
+ ip.inspection_item_subclass,
+ ip.son_laboratory,
+ ip.inspection_item_type,
+ ip.inspection_value_type,
+ ip.tell,
+ ip.ask,
+ ip.`last_value`,
+ ip.ins_result,
+ ip.inspection_item_class,
+ i.ifs_inventory_id,
+ i.order_type,
+ ip.sort,
+ ip.cable_tag,
+ ip.radius
+ from ins_sample isa
+ left join ins_order i on isa.ins_order_id = i.id
+ left join ins_product ip on isa.id = ip.ins_sample_id
+ where ip.state = 1
+ and i.id=#{id}
+ and ip.is_binding != 1
+ ) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+
+ <select id="selectDeviceListByIds" resultType="java.util.Map">
+ select device_name,
+ en_device_name,
+ specification_model,
+ management_number,
+ date_format(activation_date,'%Y-%m-%d')
+ latest_traceability
+ from device
+ where device.id in
+ <foreach collection="deviceIds" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ order by field(device.id,
+ <foreach collection="deviceIds" index="index" separator="," item="val">
+ #{val}
+ </foreach>)
+ </select>
+
+ <update id="updateStatus">
+ update ins_order
+ set state=3
+ where id = #{id}
+ </update>
+
+ <select id="selectSampleDefects" resultMap="selectSampleDefectsMap">
+ SELECT io.entrust_code,sam.sample,ip.inspection_item,u.name,b.create_time, sam.id
+ from ins_order io
+ left JOIN ins_sample sam on io.id=sam.ins_order_id
+ LEFT JOIN ins_product ip on ip.ins_sample_id=sam.id
+ LEFT JOIN
+ (SELECT create_time,create_user,ins_product_id FROM
+ (select * FROM ins_product_user ORDER BY ins_product_user.create_time DESC) a
+ GROUP BY a.ins_product_id) b
+ on b.ins_product_id=ip.id
+ left JOIN `user` u on u.id=b.create_user
+ WHERE (ip.ins_result=0 OR ip.state=0)
+ <if test="inspectionItems != null and inspectionItems != ''">
+ and inspection_item like concat('%', #{inspectionItems}, '%')
+ </if>
+ <if test="orderNumber != null and orderNumber != ''">
+ and io.entrust_code like concat('%', #{orderNumber}, '%')
+ </if>
+ </select>
+
+ <select id="getStandardMethodCode" resultType="java.lang.String">
+ select code
+ from standard_method
+ where id = #{id}
+ </select>
+ <select id="getStandardMethodReportText" resultType="java.lang.String">
+ select case
+ when name is null or trim(name) = '' then code
+ else concat(code, '銆�', name, '銆�')
+ end
+ from standard_method
+ where id = #{id}
+ </select>
+ <select id="getStandardMethodReportTextByCode" resultType="java.lang.String">
+ select case
+ when name is null or trim(name) = '' then code
+ else concat(code, '銆�', name, '銆�')
+ end
+ from standard_method
+ where code = #{code}
+ limit 1
+ </select>
+ <select id="selLaboratoryCode" resultType="java.lang.String">
+ select laboratory_code
+ from laboratory
+ where laboratory_name = #{laboratory}
+ </select>
+ <select id="selectReportModelByOrderId" resultType="java.util.Map">
+ select distinct id, name
+ from standard_template
+ where id in (select template_id
+ from ins_product
+ where son_laboratory = #{laboratory}
+ and ins_sample_id in
+ (select id from ins_sample where ins_order_id = #{id}))
+ </select>
+
+ <select id="seldepLimsId" resultType="java.lang.String">
+ select name
+ from department_lims
+ where id = #{depLimsId}
+ </select>
+ <select id="selectSampleBySampleId" resultType="com.ruoyi.inspect.dto.SampleProductExportDto">
+ select <include refid="selectSampleProductDto2"/>
+ from ins_sample isa
+ left join ins_order i on isa.ins_order_id = i.id
+ left join ins_product ip on isa.id = ip.ins_sample_id
+ where ip.state = 1
+ and ip.is_binding != 1
+ and isa.id in
+ <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ order by ip.sort asc
+ </select>
+ <select id="selectSampleMax" resultType="java.lang.Integer">
+ SELECT COUNT(*)
+ FROM ins_sample isa
+ LEFT JOIN ins_order i ON isa.ins_order_id = i.id
+ LEFT JOIN ins_product ip ON isa.id = ip.ins_sample_id
+ WHERE ip.state = 1
+ AND isa.id = #{id}
+ and ip.is_binding != 1
+ GROUP BY ip.inspection_item,
+ ip.inspection_item_subclass,
+ ip.inspection_item_class
+ ORDER BY COUNT(*) DESC
+ LIMIT 1;
+ </select>
+ <select id="selectSampleCableTag" resultType="java.lang.String">
+ SELECT ip.cable_tag
+ FROM ins_sample isa
+ LEFT JOIN ins_order i ON isa.ins_order_id = i.id
+ LEFT JOIN ins_product ip ON isa.id = ip.ins_sample_id
+ WHERE ip.state = 1
+ AND isa.id = #{id}
+ and ip.cable_tag is not null
+ GROUP BY ip.cable_tag
+ order by MIN(ip.id)
+ </select>
+ <select id="selectSampleItemS" resultType="java.lang.Integer">
+ select count(*)
+ from (select distinct ip.inspection_item
+ from ins_sample isa
+ left join ins_order i on isa.ins_order_id = i.id
+ left join ins_product ip on isa.id = ip.ins_sample_id
+ where ip.state = 1
+ and i.id = #{id}) a
+ </select>
+ <select id="selectSampleBySampleIdOne" resultType="com.ruoyi.inspect.dto.SampleProductExportDto">
+ select <include refid="selectSampleProductDto2"/>
+ from ins_sample isa
+ left join ins_order i on isa.ins_order_id = i.id
+ left join ins_product ip on isa.id = ip.ins_sample_id
+ where ip.state = 1
+ and isa.id = #{id}
+ and ip.raw_material_tag = 1
+ order by ip.sort asc
+ </select>
+ <select id="selectCalendarWorkByWeek" resultType="java.util.Map">
+ select io2.entrust_code text,
+ io2.type type,
+ ios.ins_state insState,
+ u.name name
+ from ins_order io2
+ left join ins_order_state ios on ios.ins_order_id = io2.id
+ left join user u on u.id = io2.create_user
+ where DATE(io2.create_time) = CURDATE() - INTERVAL #{day} DAY
+ </select>
+ <select id="selectProductByPartNo" resultType="com.ruoyi.basic.pojo.StructureTestObject">
+ select sto.id,
+ object_type
+ from product_part pp
+ left join product p on p.id = pp.product_id
+ left join structure_test_object sto on sto.id = p.object_id
+ where pp.part_no = #{partNo}
+ </select>
+ <select id="selectByPartNo" resultType="com.ruoyi.basic.pojo.StructureTestObject">
+ select sto.id,
+ object_type
+ from structure_test_object_part stop
+ left join structure_test_object sto on sto.id = stop.test_object_id
+ where stop.part_no = #{partNo}
+ </select>
+
+ <!-- 鎴愬搧鏍囩鎵撳嵃 -->
+ <select id="labelOrderPrinting" resultType="com.ruoyi.inspect.vo.InsOrderPrintingVo">
+ select *
+ from (select io2.id insOrderId,
+ io2.sample_view,
+ io2.production,
+ io2.send_time,
+ GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model,
+ io2.prepare_user,
+ io2.entrust_code,
+ GROUP_CONCAT(DISTINCT isa.sample_code SEPARATOR ' ') AS sample_code,
+ io2.test_quantity,
+ io2.ins_state,
+ JSON_OBJECT(
+ 'sample_name', io2.sample_view,
+ 'entrust_code', io2.entrust_code
+ ) labelBarCode
+ from ins_order io2
+ LEFT JOIN ins_sample isa ON io2.id = isa.ins_order_id
+ where type_source = -1
+ GROUP BY io2.id) a
+ where insOrderId in
+ <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ </select>
+
+ <!-- 鏌ヨ妫�楠屽崟鏁版嵁 -->
+ <select id="rawAllInsOrderExport" resultType="com.ruoyi.inspect.dto.SampleOrderDto">
+ select *
+ from ( <include refid="selectInsOrderExport"/>
+ where (io.ifs_inventory_id IS NULL OR TRIM(io.ifs_inventory_id) = '')
+ <if test="isOrderAll != null and isOrderAll != ''">
+ AND io.state in (1, 4, 5)
+ </if>
+ <if test="laboratory!=null and laboratory!=''">
+ AND io.laboratory=#{laboratory}
+ </if>
+ GROUP BY io.id,type
+ order by type desc,io.id desc
+ ) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+
+ <!-- 鏍规嵁璁㈠崟鏌ヨ璇曢獙瀹� -->
+ <select id="selectLaboratoryByOrderId" resultType="java.lang.String">
+ select ip.son_laboratory
+ from ins_product ip
+ left join ins_sample is2 on is2.id = ip.ins_sample_id
+ where is2.ins_order_id = #{insOrderId}
+ limit 1
+ </select>
+
+ <select id="selectFirstSubmit" resultType="com.ruoyi.inspect.pojo.InsOrder">
+ select io.id,
+ io.is_first_submit
+ from ins_order io
+ left join ins_sample is2 on is2.ins_order_id = io.id
+ where is2.id = #{insSampleId}
+ </select>
+
+ <!-- 鏍规嵁璁㈠崟id鏌ヨ璁㈠崟瀵煎嚭淇℃伅 -->
+ <select id="getInsOrderExportByIds" resultType="com.ruoyi.inspect.dto.SampleOrderDto">
+ <include refid="selectInsOrderExport"/>
+ where (io.ifs_inventory_id IS NULL OR TRIM(io.ifs_inventory_id) = '')
+ and io.id in
+ <foreach item="id" collection="orderIds" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ GROUP BY io.id,type
+ order by type desc,io.id desc
+ </select>
+
+ <!-- 鏌ヨ褰撳墠鏃堕棿鏄惁鏈夎妫�娴嬮」鐨勬娊鏍疯鍒掕鍗� -->
+ <select id="selectNotSpotCheckOrder" resultType="java.lang.Integer">
+ select count(*)
+ from (select io.id
+ from ins_product ip
+ left join ins_sample is2 on is2.id = ip.ins_sample_id
+ left join ins_order io on io.id = is2.ins_order_id
+ left join spot_check_quarter_item scqi on scqi.quarter_item_id = io.quarter_item_id
+ where io.quarter_item_id is not null
+ and scqi.spot_check_time between #{startTime} and #{endTime}
+ and ip.structure_item_parameter_id = #{itmeId}
+ group by io.id) a
+ </select>
+ <select id="selectOrderInfoById" resultType="com.ruoyi.inspect.vo.IfsOrderVO">
+ select io.*,
+ iiq.is_split_order,
+ iiq.order_type AS ifs_order_type,
+ iiq.part_no,
+ iiq.update_batch_no AS lot_batch_no,
+ ipps.id AS lot_part_id,
+ case
+ when ipps.drum_no is not null and ipps.drum_no!='' then ipps.drum_no
+ else isor.drum_no
+ end AS drum_no,
+ case
+ when ipps.insulation_color is not null and ipps.insulation_color!='' then ipps.insulation_color
+ else isor.insulation_color
+ end AS insulation_color,
+ case
+ when ipps.outer_color is not null and ipps.outer_color!='' then ipps.outer_color
+ else isor.outer_color
+ end AS outer_color,
+ case
+ when ipps.lettering_info is not null and ipps.lettering_info!='' then ipps.lettering_info
+ else isor.lettering_info
+ end AS lettering_info,
+ ipps.start_meter_mark,
+ ipps.end_meter_mark
+ from ins_order io left join ifs_inventory_quantity iiq on io.ifs_inventory_id=iiq.id
+ left join ifs_split_order_record isor
+ on iiq.order_no=isor.order_no
+ and iiq.line_no=isor.line_no
+ and iiq.release_no=isor.release_no
+ and iiq.receipt_no=isor.receipt_no
+ and iiq.part_no=isor.part_no
+ AND iiq.update_batch_no = isor.lot_batch_no
+ LEFT JOIN ifs_part_props_record ipps ON iiq.id = ipps.ifs_inventory_id
+ where io.state !=-1
+ AND io.id = #{id}
+ LIMIT 1
+ </select>
+
+ <!-- 澶栬喘涓嬪崟鎴愬搧鏍囩鎵撳嵃 -->
+ <select id="labelOutsideOrderPrinting" resultType="com.ruoyi.basic.dto.InventoryDetailDTO">
+ SELECT
+ iiq.id,
+ iiq.part_desc,
+ iiq.lot_batch_no,
+ iiq.part_no,
+ ippr.insulation_color,
+ ippr.outer_color,
+ ippr.drum_no,
+ ippr.start_meter_mark,
+ ippr.end_meter_mark,
+ io.update_time,
+ io.ins_state,
+ -- 妫�楠屼汉鏌ヨ锛氫紭鍏堝彇鎸囨淳鐨勮礋璐d汉锛屽鏋滄病鏈夊垯鍙栬鍗曞垱寤轰汉
+ COALESCE(isu.userName, u.name) AS inspector_name
+ FROM ifs_inventory_quantity iiq
+ LEFT JOIN ifs_part_props_record ippr ON ippr.ifs_inventory_id = iiq.id
+ LEFT JOIN ins_order io ON io.ifs_inventory_id = iiq.id AND io.state != -1
+ -- 鍏宠仈鐢ㄦ埛琛紝鐢ㄤ簬鑾峰彇璁㈠崟鍒涘缓浜哄鍚�
+ LEFT JOIN user u ON io.create_user = u.id
+ -- 鍏宠仈瀛愭煡璇紝鐢ㄤ簬鑾峰彇 ins_sample_user 琛ㄤ腑鎸囨淳鐨勬楠岃礋璐d汉
+ LEFT JOIN (
+ SELECT
+ ins_sample_id,
+ GROUP_CONCAT(DISTINCT uu.name SEPARATOR ',') AS userName
+ FROM ins_sample_user isu_inner
+ LEFT JOIN user uu ON isu_inner.user_id = uu.id
+ WHERE isu_inner.state = 0
+ GROUP BY ins_sample_id
+ ) isu ON isu.ins_sample_id = io.id
+ WHERE iiq.id IN
+ <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsOrderRatesMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderRatesMapper.xml
new file mode 100644
index 0000000..4791cf3
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsOrderRatesMapper.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.InsOrderRatesMapper">
+ <!-- 鏌ヨ璐圭敤鍒楄〃 -->
+ <select id="selectInsOrderRates" resultType="com.ruoyi.inspect.dto.SampleOrderDto">
+ select *
+ from (select io.*,
+ case
+ when
+ io.type_source = 0
+ then io.sample_view
+ else io.sample end sampleStr,
+ GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model,
+ COALESCE(sum(st.price), 0) total_price
+ from ins_order io
+ LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
+ left join ins_order_standard_template iost on iost.ins_order_id = io.id
+ left join standard_template st on st.id = iost.template_id
+ where iost.id is not null
+ group by io.id) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+
+ <!-- 鏌ヨ璁㈠崟璐圭敤璇︽儏锛堟ā鏉夸环鏍硷級 -->
+ <select id="selectTemplateRatesDetail" resultType="com.ruoyi.inspect.dto.TemplateRateDto">
+ select iost.number, iost.name, COALESCE(st.price, 0) as price
+ from ins_order_standard_template iost
+ left join standard_template st on st.id = iost.template_id
+ where iost.ins_order_id = #{insOrderId}
+ order by iost.sort, iost.id
+ </select>
+
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsOrderStateMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderStateMapper.xml
new file mode 100644
index 0000000..684e104
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsOrderStateMapper.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.InsOrderStateMapper">
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsOrderTemplateDeviceMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderTemplateDeviceMapper.xml
new file mode 100644
index 0000000..3ccd014
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsOrderTemplateDeviceMapper.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsOrderTemplateDeviceMapper">
+
+ <select id="selectExistingDeviceIds" resultType="java.lang.Integer">
+ select id
+ from device
+ where id in
+ <foreach collection="deviceIds" item="deviceId" open="(" separator="," close=")">
+ #{deviceId}
+ </foreach>
+ </select>
+
+ <select id="selectDeviceIdsByOrderId" resultType="java.lang.Integer">
+ select otd.device_id
+ from ins_order_template_device otd
+ where otd.ins_order_id = #{orderId}
+ and otd.device_id is not null
+ group by otd.device_id
+ order by min(otd.sort), otd.device_id
+ </select>
+
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsOrderTemplateMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderTemplateMapper.xml
new file mode 100644
index 0000000..15d3b2c
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsOrderTemplateMapper.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.InsOrderTemplateMapper">
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsProductDeviationWarningDetailMapper.xml b/inspect-server/src/main/resources/mapper/InsProductDeviationWarningDetailMapper.xml
new file mode 100644
index 0000000..22c9732
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsProductDeviationWarningDetailMapper.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsProductDeviationWarningDetailMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail">
+ <id column="deviation_warning_detail_id" property="deviationWarningDetailId" />
+ <result column="deviation_warning_id" property="deviationWarningId" />
+ <result column="ins_order_id" property="insOrderId" />
+ <result column="ins_sample_id" property="insSampleId" />
+ <result column="ins_product_id" property="insProductId" />
+ <result column="entrust_code" property="entrustCode" />
+ <result column="sample_code" property="sampleCode" />
+ <result column="supplier_name" property="supplierName" />
+ <result column="test_value" property="testValue" />
+ <result column="detection_time" property="detectionTime" />
+ <result column="create_user" property="createUser" />
+ <result column="update_user" property="updateUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_time" property="updateTime" />
+ </resultMap>
+
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml b/inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml
new file mode 100644
index 0000000..bbd8071
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsProductDeviationWarningMapper">
+
+ <!-- 鏌ョ湅棰勮鍒楄〃 -->
+ <select id="selectDeviationWarningPage" resultType="com.ruoyi.inspect.dto.InsProductDeviationWarningDto">
+<!-- select *-->
+<!-- from (select ipdw.*,-->
+<!-- isa.sample sample_name,-->
+<!-- isa.model sample_model,-->
+<!-- concat(ip.inspection_item, ip.inspection_item_subclass) inspection_item_name-->
+<!-- from ins_product_deviation_warning ipdw-->
+<!-- left join ins_sample isa on isa.id = ipdw.ins_sample_id-->
+<!-- left join ins_product ip On ip.id = ipdw.ins_product_id) a-->
+<!-- <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">-->
+<!-- ${ew.customSqlSegment}-->
+<!-- </if>-->
+<!-- order by ipdw.detection_time desc-->
+ SELECT
+ a.*,
+ sto.object_type
+ FROM (
+ SELECT
+ ipdw.*,
+ sip.sample AS sss,
+ isa.sample AS sample_name,
+ isa.model AS sample_model,
+ CONCAT(ip.inspection_item, ip.inspection_item_subclass) AS inspection_item_name
+ FROM ins_product_deviation_warning ipdw
+ LEFT JOIN ins_sample isa ON isa.id = ipdw.ins_sample_id
+ LEFT JOIN ins_product ip ON ip.id = ipdw.ins_product_id
+ LEFT JOIN structure_item_parameter sip ON sip.id = ip.structure_item_parameter_id
+ ) a
+ LEFT JOIN structure_test_object sto
+ ON a.sss LIKE CONCAT('%"', sto.specimen_name, '"%') -- 妯$硦鍖归厤
+ WHERE
+ sto.object_type != 3 -- 杩囨护鏉′欢锛氭帓闄� object_type 涓� 3 鐨勮褰�
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ AND ${ew.customSqlSegment} -- 鍔ㄦ�佹坊鍔犺嚜瀹氫箟SQL鏉′欢
+ </if>
+ ORDER BY a.detection_time DESC
+ </select>
+
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsProductMapper.xml b/inspect-server/src/main/resources/mapper/InsProductMapper.xml
new file mode 100644
index 0000000..b4b0a48
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsProductMapper.xml
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsProductMapper">
+
+ <update id="updateInspected">
+ UPDATE ins_product p
+ SET p.state=0
+ WHERE EXISTS(
+ SELECT 1
+ FROM ins_sample s
+ WHERE s.ins_order_id IN (
+ SELECT o.id
+ FROM ins_order o
+ WHERE o.id = #{id}
+ )
+ AND p.ins_sample_id = s.id
+ AND p.state = 1
+ AND p.ins_result IS NULL
+ );
+ </update>
+
+ <select id="selectOrderManDay" resultType="java.lang.Integer">
+ select coalesce(max(ip.man_day), 0)
+ from ins_order io
+ left join ins_sample isa on io.id = isa.ins_order_id
+ left join ins_product ip on isa.id = ip.ins_sample_id
+ where io.id = #{orderId}
+ </select>
+ <select id="selectUserById" resultType="java.util.Map">
+ select account, name, company, phone, name_en
+ from user
+ where id = #{userId}
+ </select>
+ <select id="getProductAndResult" resultType="com.ruoyi.inspect.dto.ProductResultDto2">
+ select ip.id,
+ ip.inspection_item,
+ ip.inspection_item_subclass,
+ ip.laboratory,
+ ip.unit,
+ ipr.equip_name equipValue,
+ io.entrust_code,
+ ipr.update_time,
+ ip.ins_result,
+ u.name updateUserName
+ from ins_product ip
+ left join ins_product_result ipr on ip.id = ipr.ins_product_id
+ left join ins_sample isa on isa.id = ip.ins_sample_id
+ left join ins_order io on io.id = isa.ins_order_id
+ left join user u on u.id = ipr.update_user
+ where ip.ins_sample_id = #{sampleId}
+ and ip.ins_result is not null
+ and template_id is not null
+ </select>
+ <select id="selectFiberInsProduct" resultType="com.ruoyi.inspect.pojo.InsProduct">
+ select * from ins_product
+ where state = 1
+ and is_binding != 1
+ and (ins_fibers_id is not null or ins_fiber_id is not null)
+ and ins_result is null
+ and son_laboratory = #{laboratory}
+ and ins_sample_id in
+ <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </select>
+ <select id="selectNoProducts" resultType="com.ruoyi.inspect.pojo.InsProduct">
+ select *
+ from (select ip.*, sample_code
+ from ins_product ip
+ left join ins_sample is2 on ip.ins_sample_id = is2.id
+ where state = 1
+ and is2.ins_order_id = #{orderId}
+ <if test="noIds != null and noIds.size() > 0">
+ and ip.id in
+ <foreach collection="noIds" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ </if>
+ ) A
+ </select>
+ <select id="selectInsProductCountByOrderId" resultType="java.lang.Integer">
+ select COUNT(1)
+ from ins_product ip
+ left join ins_sample isa on ip.ins_sample_id = isa.id
+ left join ins_order io on isa.ins_order_id = io.id
+ where io.id = #{orderId}
+ and (ip.ins_result is null or ip.ins_result = 2)
+ and ip.state = 1
+ </select>
+ <select id="selectListBySampleIds" resultType="com.ruoyi.inspect.dto.SampleProductRawAnalysisDto">
+ select ins.id ins_sample_id,
+ ins.sample_code,
+ ip.id ins_product_id,
+ concat(ip.inspection_item, ip.inspection_item_subclass) inspection_item,
+ ip.`last_value`,
+ iiq.update_batch_no,
+ iiq.supplier_name,
+ ins.sample,
+ ip.ins_result
+ from ins_product ip
+ left join ins_sample ins on ins.id = ip.ins_sample_id
+ left join ins_order io1 on io1.id = ins.ins_order_id
+ left join ifs_inventory_quantity iiq on iiq.id = io1.ifs_inventory_id
+ where ip.inspection_value_type = 1
+ and ip.ins_sample_id in
+ <foreach collection="sampleIds" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ </select>
+ <select id="selectItemNameBySampleIds" resultType="java.lang.String">
+ select concat(ip.inspection_item, ip.inspection_item_subclass)
+ from ins_product ip
+ left join ins_sample ins on ins.id = ip.ins_sample_id
+ where ip.inspection_value_type = 1
+ and ip.ins_sample_id in
+ <foreach collection="sampleIds" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+
+ group by concat(ip.inspection_item, ip.inspection_item_subclass)
+ </select>
+ <select id="selectUnqualifiedList" resultType="java.lang.String">
+ select distinct concat(ip.inspection_item_class, ip.inspection_item, ip.inspection_item_subclass)
+ from ins_product ip
+ left join ins_sample is2 on is2.id = ip.ins_sample_id
+ left join ins_order io2 on io2.id = is2.ins_order_id
+ where io2.id = #{orderId}
+ </select>
+
+ <!--鏌ヨ鍒ゆ柇鏄惁鏈変笉鍒ゅ畾椤圭洰,鍜屽叏閮芥槸鍒ゅ畾椤�-->
+ <select id="selectNoJudge" resultType="java.lang.Integer">
+ select CASE
+ WHEN SUM(CASE WHEN ip.ins_result = 3 THEN 1 ELSE 0 END) = COUNT(*) THEN 3
+ WHEN SUM(CASE WHEN ip.ins_result = 3 THEN 1 ELSE 0 END) > 0 THEN 2
+ ELSE 1 END AS result_flag
+ from ins_product ip
+ left join ins_sample is2 on is2.id = ip.ins_sample_id
+ left join ins_order io2 on io2.id = is2.ins_order_id
+ where io2.id = #{orderId}
+ and ip.is_binding != 1
+ </select>
+
+ <!-- 鏍规嵁璁㈠崟鏌ヨ浜у搧id -->
+ <select id="selectProductByOrderId" resultType="com.ruoyi.inspect.pojo.InsProduct">
+ select ip.*, is2.sample_code
+ from ins_product ip
+ left join ins_sample is2 on is2.id = ip.ins_sample_id
+ where is2.ins_order_id = #{orderId}
+ </select>
+ <select id="selectAnalysis" resultType="com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail">
+ select io.id insOrderId,
+ is2.id insSampleId,
+ ip.id insProductId,
+ io.entrust_code,
+ is2.sample_code,
+ iiq.supplier_name,
+ ip.`last_value` testValue,
+ ip.update_time detectionTime
+ from ins_product ip
+ left join ins_sample is2 on is2.id = ip.ins_sample_id
+ left join ins_order io on io.id = is2.ins_order_id
+ left join ifs_inventory_quantity iiq on iiq.id = io.ifs_inventory_id
+ left join ins_product_deviation_warning ipdw on ipdw.ins_product_id = ip.id
+ where concat(ip.inspection_item, ip.inspection_item_subclass) = concat(#{insProduct.inspectionItem}, #{insProduct.inspectionItemSubclass})
+ and ip.model = #{insProduct.model}
+ and iiq.supplier_name = #{supplierName}
+ and io.state = 4
+ and ip.ins_result = 1
+ and ipdw.deviation_warning_id is null
+ order by io.first_submit_date desc
+ limit 10
+ </select>
+ <select id="getRevocationInsProductList" resultType="com.ruoyi.inspect.pojo.InsProduct">
+ select *
+ from ins_product
+ WHERE state = 1
+ AND id in
+ <foreach collection="ids" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsProductResultMapper.xml b/inspect-server/src/main/resources/mapper/InsProductResultMapper.xml
new file mode 100644
index 0000000..519d61a
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsProductResultMapper.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsProductResultMapper">
+ <resultMap id="BaseResultMap" type="com.ruoyi.inspect.pojo.InsProductResult">
+ <id property="id" column="id" jdbcType="INTEGER"/>
+ <result property="insProductId" column="ins_product_id" jdbcType="INTEGER"/>
+ <result property="insValue" column="ins_value" jdbcType="VARCHAR"/>
+ <result property="comValue" column="com_value" jdbcType="VARCHAR"/>
+ <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/>
+ <result property="createUser" column="create_user" jdbcType="INTEGER"/>
+ <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+ <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+ </resultMap>
+
+ <select id="selDetail" resultMap="BaseResultMap">
+ select *
+ from ins_product_result
+ where 1=1
+ <!--and ins_product_id in (#{ips})-->
+ <if test="ips != null and ips.size() > 0">
+ <!-- 浣跨敤foreach鍏冪礌鏋勫缓IN瀛愬彞 -->
+ and ins_product_id in
+ <foreach item="item" collection="ips" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </if>
+ </select>
+
+ <!-- 鏍规嵁璁㈠崟id鏌ヨ妫�楠岀粨鏋� -->
+ <select id="selectResultByOrderId" resultType="com.ruoyi.inspect.pojo.InsProductResult">
+ select ipr.equip_value,
+ ipr.create_user
+ from ins_product_result ipr
+ left join ins_product ip on ip.id = ipr.ins_product_id
+ left join ins_sample is2 on is2.id = ip.ins_sample_id
+ where is2.ins_order_id = #{orderId}
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsProductUserMapper.xml b/inspect-server/src/main/resources/mapper/InsProductUserMapper.xml
new file mode 100644
index 0000000..474ae59
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsProductUserMapper.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.InsProductUserMapper">
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsReportMapper.xml b/inspect-server/src/main/resources/mapper/InsReportMapper.xml
new file mode 100644
index 0000000..07d0518
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsReportMapper.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsReportMapper">
+
+ <select id="pageInsReport" resultType="com.ruoyi.inspect.dto.ReportPageDto">
+ select *
+ from (
+ select
+ ir.*,
+ io.entrust_code,
+ u.name write_user_name,
+ u1.name ratify_user,
+ u2.name examine_user,
+ io.type_source,
+ io.order_type,
+ io.laboratory,
+ io.ifs_inventory_id,
+ iiq.is_copper,
+ iiq.material_prop,
+ ip.son_laboratory
+ from ins_report ir
+ left join ins_order io on io.id = ir.ins_order_id
+ LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id
+ left join user u on u.id = ir.write_user_id
+ left join user u1 on u1.id = ir.ratify_user_id
+ left join user u2 on u2.id = ir.examine_user_id
+ left join ins_sample is2 on is2.ins_order_id = io.id
+ left join ins_product ip on ip.ins_sample_id = is2.id
+ where 1=1
+ and ir.is_pass = 1
+ <if test="createOrderUser != null and createOrderUser != ''">
+ and (ir.write_user_id = #{createOrderUser} or ir.examine_user_id = #{createOrderUser} or ir.ratify_user_id = #{createOrderUser})
+ </if>
+ <if test="laboratory!=null and laboratory!=''">
+ and laboratory=#{laboratory}
+ </if>
+ <if test="queryStatus != null and queryStatus != ''">
+ <!-- 寰呮彁浜�-->
+ <if test='queryStatus == 0'>
+ and ir.state = 0
+ </if>
+ <!-- 寰呭鎵�-->
+ <if test='queryStatus == 1'>
+ and ir.state = 1 and (ir.is_examine != 1 or ir.is_examine is null)
+ </if>
+ <!-- 寰呮壒鍑�-->
+ <if test='queryStatus == 2'>
+ and ir.state = 1 and ir.is_examine = 1 and (ir.is_ratify != 1 or ir.is_ratify is null)
+ </if>
+ </if>
+ group by ir.id
+ ) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ ORDER BY a.create_time DESC
+ </select>
+ <select id="getLaboratoryByName" resultType="java.lang.String">
+ select s.address from seal s
+ left join laboratory l on s.lab_id = l.id
+ where l.laboratory_name = #{name}
+ and s.type = #{type}
+ order by s.create_time desc
+ limit 1
+ </select>
+
+ <select id="selectDownloadableReport" resultType="com.ruoyi.inspect.pojo.InsReport">
+ select ir.*
+ from ins_report ir
+ where ir.id = #{id}
+ and ir.is_pass = 1
+ <if test="createOrderUser != null">
+ and (ir.write_user_id = #{createOrderUser}
+ or ir.examine_user_id = #{createOrderUser}
+ or ir.ratify_user_id = #{createOrderUser})
+ </if>
+ limit 1
+ </select>
+
+ <!-- 鎶ュ憡鎶ヨ〃瀵煎嚭 -->
+ <select id="reportAllExport" resultType="com.ruoyi.inspect.dto.InsReportExport">
+ select code,
+ case
+ when inspection_url is not null and inspection_url != '' then '妫�娴嬫姤鍛娿�佹楠屾姤鍛�'
+ when report_type = 0 then '妫�娴嬫姤鍛�'
+ else '妫�楠屾姤鍛�' end report_type_name,
+ case when type_source = 0 then '鎴愬搧涓嬪崟' else '鍘熸潗鏂欎笅鍗�' end type_source,
+ case
+ when order_type = '鎶芥' then '鎶芥'
+ when order_type = 'Customer-ordered test' then '濮旀墭妫�楠�'
+ when order_type = '杩涘巶妫�楠�' then '杩涘巶妫�楠�'
+ when order_type = 'Quarterly inspection' then '瀛e害妫�楠�'
+ else '' end order_type,
+ DATE_FORMAT(create_Time, '%Y-%m-%d %H:%i:%s') create_Time,
+ write_user_name,
+ DATE_FORMAT(write_time, '%Y-%m-%d %H:%i:%s') write_time,
+ case when state = 0 then '寰呮彁浜�' when state = 1 then '宸叉彁浜�' else '' end state,
+ examine_user,
+ DATE_FORMAT(examine_time, '%Y-%m-%d %H:%i:%s') examine_time,
+ case when is_examine = 0 then '涓嶉�氳繃' when is_examine = 1 then '閫氳繃' else '' end is_examine,
+ examine_tell,
+ ratify_user,
+ DATE_FORMAT(ratify_time, '%Y-%m-%d %H:%i:%s') ratify_time,
+ case when is_ratify = 0 then '涓嶆壒鍑�' when is_ratify = 1 then '鎵瑰噯' else '' end is_ratify,
+ ratify_tell
+ from (
+ select
+ ir.*,
+ io.entrust_code,
+ u.name write_user_name,
+ u1.name ratify_user,
+ u2.name examine_user,
+ io.type_source,
+ io.order_type,
+ io.laboratory,
+ io.ifs_inventory_id,
+ iiq.is_copper,
+ ip.son_laboratory
+ from ins_report ir
+ left join ins_order io on io.id = ir.ins_order_id
+ LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id
+ left join user u on u.id = ir.write_user_id
+ left join user u1 on u1.id = ir.ratify_user_id
+ left join user u2 on u2.id = ir.examine_user_id
+ left join ins_sample is2 on is2.ins_order_id = io.id
+ left join ins_product ip on ip.ins_sample_id = is2.id
+ where 1=1
+ and ir.is_pass = 1
+ <if test="createOrderUser != null and createOrderUser != ''">
+ and (ir.write_user_id = #{createOrderUser} or ir.examine_user_id = #{createOrderUser} or ir.ratify_user_id = #{createOrderUser})
+ </if>
+ <if test="queryStatus != null and queryStatus != ''">
+ <!-- 寰呮彁浜�-->
+ <if test='queryStatus == 0'>
+ and ir.state = 0
+ </if>
+ <!-- 寰呭鎵�-->
+ <if test='queryStatus == 1'>
+ and ir.state = 1 and (ir.is_examine != 1 or ir.is_examine is null)
+ </if>
+ <!-- 寰呮壒鍑�-->
+ <if test='queryStatus == 2'>
+ and ir.state = 1 and ir.is_examine = 1 and (ir.is_ratify != 1 or ir.is_ratify is null)
+ </if>
+ </if>
+ group by ir.id
+ ) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ ORDER BY a.create_time DESC
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
new file mode 100644
index 0000000..ad6224c
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -0,0 +1,780 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsSampleMapper">
+
+ <resultMap id="sampleDto" type="com.ruoyi.inspect.dto.SampleProductDto">
+ <id property="id" column="id" jdbcType="INTEGER"/>
+ <result property="insResult" column="ins_result" jdbcType="INTEGER"/>
+ <result property="insOrderId" column="ins_order_id" jdbcType="INTEGER"/>
+ <result property="joinModel" column="join_model" jdbcType="VARCHAR"/>
+ <result property="joinName" column="join_name" jdbcType="VARCHAR"/>
+ <result property="sampleCode" column="sample_code" jdbcType="VARCHAR"/>
+ <result property="factory" column="factory" jdbcType="VARCHAR"/>
+ <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/>
+ <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
+ <result property="sample" column="sample" jdbcType="VARCHAR"/>
+ <result property="model" column="model" jdbcType="VARCHAR"/>
+ <result property="insState" column="ins_state" jdbcType="INTEGER"/>
+ <result property="joinNum" column="join_num" jdbcType="INTEGER"/>
+ <result property="remark" column="remark" jdbcType="VARCHAR"/>
+ <result property="createUser" column="create_user" jdbcType="INTEGER"/>
+ <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+ <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+ <result property="standardMethodListId" column="standard_method_list_id"/>
+ <result property="unit" column="unit"/>
+ <result property="quantity" column="quantity"/>
+ <result property="specialStandardMethod" column="special_standard_method"/>
+ <collection property="insProduct" resultMap="product"/>
+ </resultMap>
+
+ <resultMap id="product" type="com.ruoyi.inspect.pojo.InsProduct">
+ <id property="id" column="ip_id" jdbcType="INTEGER"/>
+ <result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/>
+ <result property="inspectionItemEn" column="inspection_item_en" jdbcType="VARCHAR"/>
+ <result property="inspectionItemSubclass" column="inspection_item_subclass" jdbcType="VARCHAR"/>
+ <result property="inspectionItemSubclassEn" column="inspection_item_subclass_en" jdbcType="VARCHAR"/>
+ <result property="inspectionItemClass" column="inspection_item_class" jdbcType="VARCHAR"/>
+ <result property="inspectionItemClassEn" column="inspection_item_class_en" jdbcType="VARCHAR"/>
+ <result property="factory" column="ip_factory" jdbcType="VARCHAR"/>
+ <result property="laboratory" column="ip_laboratory" jdbcType="VARCHAR"/>
+ <result property="sampleType" column="ip_sample_type" jdbcType="VARCHAR"/>
+ <result property="sample" column="ip_sample" jdbcType="VARCHAR"/>
+ <result property="model" column="ip_model" jdbcType="VARCHAR"/>
+ <result property="sonLaboratory" column="son_laboratory" jdbcType="VARCHAR"/>
+ <result property="unit" column="ip_unit" jdbcType="VARCHAR"/>
+ <result property="price" column="price" jdbcType="DECIMAL"/>
+ <result property="manHour" column="man_hour" jdbcType="DOUBLE"/>
+ <result property="manHourGroup" column="man_hour_group" jdbcType="VARCHAR"/>
+ <result property="inspectionItemType" column="inspection_item_type" jdbcType="VARCHAR"/>
+ <result property="inspectionValueType" column="inspection_value_type" jdbcType="VARCHAR"/>
+ <result property="deviceGroup" column="device_group" jdbcType="VARCHAR"/>
+ <result property="checkoutNumber" column="checkout_number" jdbcType="INTEGER"/>
+ <result property="section" column="section" jdbcType="VARCHAR"/>
+ <result property="valueType" column="value_type" jdbcType="VARCHAR"/>
+ <result property="method" column="method" jdbcType="VARCHAR"/>
+ <result property="manDay" column="man_day" jdbcType="INTEGER"/>
+ <result property="bsm" column="bsm" jdbcType="VARCHAR"/>
+ <result property="ask" column="ask" jdbcType="VARCHAR"/>
+ <result property="tell" column="tell" jdbcType="VARCHAR"/>
+ <result property="lastValue" column="last_value" jdbcType="VARCHAR"/>
+ <result property="insResult" column="ip_ins_result" jdbcType="INTEGER"/>
+ <result property="isBinding" column="ip_is_binding" jdbcType="INTEGER"/>
+ <result property="state" column="state" jdbcType="INTEGER"/>
+ <result property="insBushId" column="ins_bush_id" jdbcType="INTEGER"/>
+ <result property="insSampleId" column="ins_sample_id" jdbcType="INTEGER"/>
+ <result property="createUser" column="ip_create_user" jdbcType="INTEGER"/>
+ <result property="updateUser" column="ip_update_user" jdbcType="INTEGER"/>
+ <result property="createTime" column="ip_create_time" jdbcType="TIMESTAMP"/>
+ <result property="updateTime" column="ip_update_time" jdbcType="TIMESTAMP"/>
+ <result property="templateId" column="template_id" jdbcType="INTEGER"/>
+ <result property="templateRowIndex" column="template_row_index" jdbcType="INTEGER"/>
+ <result property="methodS" column="method_s"/>
+ <result property="tell" column="tell"/>
+ <result property="dic" column="dic"/>
+ <result property="sort" column="sort"/>
+ <result property="temperature" column="temperature"/>
+ <result property="humidity" column="humidity"/>
+ <result property="radius" column="radius"/>
+ <result property="cableTag" column="cable_tag"/>
+ <result property="structureItemParameterId" column="structure_item_parameter_id"/>
+ <collection property="insProductResult" resultMap="insProductResult"/>
+ </resultMap>
+
+
+ <resultMap id="insProductResult" type="com.ruoyi.inspect.pojo.InsProductResult">
+ <result property="insValue" column="ins_value" jdbcType="VARCHAR"/>
+ <result property="comValue" column="com_value" jdbcType="VARCHAR"/>
+ <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/>
+ <result property="equipName" column="equip_name" jdbcType="VARBINARY"/>
+ </resultMap>
+
+ <resultMap id="sampleVo" type="com.ruoyi.inspect.vo.SampleVo">
+ <id property="id" column="id" jdbcType="INTEGER"/>
+ <result property="insResult" column="ins_result" jdbcType="INTEGER"/>
+ <result property="insOrderId" column="ins_order_id" jdbcType="INTEGER"/>
+ <result property="joinModel" column="join_model" jdbcType="VARCHAR"/>
+ <result property="joinName" column="join_name" jdbcType="VARCHAR"/>
+ <result property="sampleCode" column="sample_code" jdbcType="VARCHAR"/>
+ <result property="factory" column="factory" jdbcType="VARCHAR"/>
+ <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/>
+ <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
+ <result property="sample" column="sample" jdbcType="VARCHAR"/>
+ <result property="model" column="model" jdbcType="VARCHAR"/>
+ <result property="insState" column="ins_state" jdbcType="INTEGER"/>
+ <result property="joinNum" column="join_num" jdbcType="INTEGER"/>
+ <result property="remark" column="remark" jdbcType="VARCHAR"/>
+ <result property="createUser" column="create_user" jdbcType="INTEGER"/>
+ <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+ <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+ <result property="standardMethodListId" column="standard_method_list_id"/>
+ <result property="methodName" column="methodName" jdbcType="VARCHAR"/>
+ <result property="unit" column="unit"/>
+ </resultMap>
+
+ <sql id="getInsProducSql">
+ ip.id ip_id,
+ inspection_item,
+ inspection_item_en,
+ inspection_item_class,
+ inspection_item_class_en,
+ inspection_item_subclass,
+ inspection_item_subclass_en,
+ ip.factory ip_factory,
+ ip.laboratory ip_laboratory,
+ ip.sample_type ip_sample_type,
+ ip.sample ip_sample,
+ ip.model ip_model,
+ son_laboratory,
+ ip.unit ip_unit,
+ price,
+ man_hour,
+ man_hour_group,
+ inspection_item_type,
+ inspection_value_type,
+ device_group,
+ checkout_number,
+ section,
+ value_type,
+ method,
+ man_day,
+ bsm,
+ ask,
+ `last_value`,
+ ip.ins_result ip_ins_result,
+ ip.is_binding ip_is_binding,
+ state,
+ ins_sample_id,
+ ip.create_user ip_create_user,
+ ip.update_user ip_update_user,
+ ip.create_time ip_create_time,
+ ip.update_time ip_update_time,
+ template_id,
+ template_row_index,
+ ipr.ins_value,
+ ipr.com_value,
+ ipr.equip_value,
+ ipr.equip_name,
+ ip.method_s,
+ ip.tell,
+ ip.dic,
+ ip.sort,
+ ip.cable_tag,
+ ip.structure_item_parameter_id
+ </sql>
+
+ <!--
+ 鐩寸粦妯℃澘璁㈠崟涓嶄緷璧� ins_product銆傞�氳繃璁㈠崟妯℃澘蹇収鍜屽崟鏍峰搧鏍囧噯缁撴瀯璇嗗埆锛�
+ 鍒楄〃銆佷换鍔″垏鎹㈠強璇︽儏缁熶竴浣跨敤鍥哄畾浠诲姟瀹為獙瀹も�滄柊鑱氣�濄��
+ -->
+ <sql id="directTemplateOrderJoin">
+ LEFT JOIN (
+ SELECT DISTINCT iost.ins_order_id
+ FROM ins_order_standard_template iost
+ INNER JOIN ins_order dto ON dto.id = iost.ins_order_id
+ INNER JOIN ins_sample dts ON dts.ins_order_id = dto.id
+ WHERE dts.standard_method_list_id IS NULL
+ AND (dts.factory IS NULL OR TRIM(dts.factory) = '')
+ AND (dts.sample_type IS NULL OR TRIM(dts.sample_type) = '')
+ AND (dts.model IS NULL OR TRIM(dts.model) = '')
+ AND (dto.factory IS NULL OR TRIM(dto.factory) = '')
+ AND (dto.sample_type IS NULL OR TRIM(dto.sample_type) = '')
+ ) direct_template ON direct_template.ins_order_id = io.id
+ </sql>
+
+
+ <select id="findInsSampleAndOrder" resultType="com.ruoyi.inspect.vo.InsOrderPlanVO">
+ select * from(select * from(
+ SELECT
+ a.*,
+ CASE
+ WHEN ios.ins_state IS NULL AND a.direct_template = 1 THEN 0
+ ELSE ios.ins_state
+ END AS ins_state,
+ ios.verify_tell,
+ verify_user
+ FROM
+ (
+ SELECT
+ io.id,
+ io.entrust_code,
+ io.type,
+ io.appointed,
+ io.send_time,
+ io.order_type,
+ case when
+ io.type_source = 0
+ then io.sample_view
+ else io.sample end sample,
+ GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model,
+ userName,
+ checkName,
+ CASE
+ WHEN direct_template.ins_order_id IS NOT NULL THEN '鏂拌仛'
+ ELSE ip.son_laboratory
+ END AS son_laboratory,
+ CASE WHEN direct_template.ins_order_id IS NOT NULL THEN 1 ELSE 0 END AS direct_template,
+ io.ins_time,
+ io.laboratory,
+ io.type_source,
+ io.ifs_inventory_id,
+ ira.id ins_report_id,
+ ira.url,
+ ira.url_s,
+ ira.temp_url_pdf,
+ iiq.is_copper,
+ iiq.is_split_order,
+ iiq.material_prop AS material_prop
+ FROM
+ ins_order io
+ LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
+ LEFT JOIN ins_report ira ON ira.ins_order_id = io.id
+ LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id
+ <include refid="directTemplateOrderJoin"/>
+ LEFT JOIN (
+ SELECT ins_sample_id,GROUP_CONCAT( DISTINCT uu.name SEPARATOR ',') AS userName
+ FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id
+ WHERE u.state=0
+ <if test="sonLaboratory!= null and sonLaboratory != ''">
+ and son_laboratory=#{sonLaboratory}
+ </if>
+ GROUP BY ins_sample_id
+ ORDER BY ins_sample_id
+ ) isu ON isu.ins_sample_id = io.id
+ LEFT JOIN (
+ SELECT ins_sample_id,uu.name checkName
+ FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id
+ WHERE u.state=1
+ <if test="sonLaboratory!= null and sonLaboratory != ''">
+ and son_laboratory=#{sonLaboratory}
+ </if>
+ GROUP BY ins_sample_id
+ ORDER BY ins_sample_id
+ )isu2 ON isu2.ins_sample_id = io.id
+ LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id
+ WHERE io.state = 1 and send_time is not null
+ <if test="isCheck != null">
+ <if test="userName !=null and userName!=''">
+ and checkName like CONCAT ('%', #{userName},'%')
+ </if>
+ </if>
+ <if test="isCheck == null">
+ <if test="userName !=null and userName!=''">
+ and userName like CONCAT ('%', #{userName},'%')
+ </if>
+ </if>
+ <if test="sonLaboratory!= null and sonLaboratory != ''">
+ and CASE
+ WHEN direct_template.ins_order_id IS NOT NULL THEN '鏂拌仛'
+ ELSE ip.son_laboratory
+ END = #{sonLaboratory}
+ </if>
+ GROUP BY
+ CASE
+ WHEN direct_template.ins_order_id IS NOT NULL THEN '鏂拌仛'
+ ELSE ip.son_laboratory
+ END,
+ io.id
+ ) a
+ LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory
+ ORDER BY
+ a.type DESC,
+ a.id
+ ) b
+ where (ins_state is not null or direct_template = 1)
+ <if test="laboratory!=null and laboratory!=''">
+ and laboratory=#{laboratory}
+ </if>
+ )A
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ ORDER BY send_time desc
+
+ </select>
+
+ <select id="inspectionOrderDetailsTaskSwitching" resultType="com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo">
+ select * from(
+ SELECT
+ a.*,
+ CASE
+ WHEN ios.ins_state IS NULL AND a.direct_template = 1 THEN 0
+ ELSE ios.ins_state
+ END AS ins_state,
+ ios.verify_tell,isu2.order_user_id,<!--(ios.verify_user = #{userId})--> verify_user
+ FROM
+ (
+ SELECT
+ io.id,
+ io.entrust_code,
+ io.type,
+ io.appointed,
+ io.send_time,
+ group_concat(distinct isa.sample,' ') sampleType,
+ isu.user_id,
+ user.name userName,
+ CASE
+ WHEN direct_template.ins_order_id IS NOT NULL THEN '鏂拌仛'
+ ELSE ip.son_laboratory
+ END AS son_laboratory,
+ CASE WHEN direct_template.ins_order_id IS NOT NULL THEN 1 ELSE 0 END AS direct_template,
+ io.ins_time,
+ io.laboratory
+ FROM
+ ins_order io
+ LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
+ <include refid="directTemplateOrderJoin"/>
+ LEFT JOIN ( <!--SELECT * FROM ins_sample_user GROUP BY ins_sample_id, user_id -->
+ SELECT *
+ FROM ins_sample_user u
+ WHERE son_laboratory=#{sonLaboratory} and (ins_sample_id, id) IN (
+ SELECT ins_sample_id, MAX(id)
+ FROM ins_sample_user
+ WHERE son_laboratory=#{sonLaboratory}
+ GROUP BY ins_sample_id
+ )
+ ORDER BY ins_sample_id, id
+ ) isu ON isu.ins_sample_id = io.id
+ LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id
+ LEFT JOIN user ON isu.user_id = user.id
+ WHERE
+ io.state = 1
+-- # AND io.ins_state != 5
+ and send_time is not null
+ <if test="userId !=null and userId!=''">
+ and (isu.user_id = #{userId} OR isu.user_id is NULL )
+ </if>
+ OR isu.user_id is NULL
+ GROUP BY
+ CASE
+ WHEN direct_template.ins_order_id IS NOT NULL THEN '鏂拌仛'
+ ELSE ip.son_laboratory
+ END,
+ io.id
+ ) a
+ LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory
+ left join (SELECT td.user_id order_user_id, td.ins_sample_id FROM ins_sample_user td,(SELECT max(id) id FROM
+ ins_sample_user where son_laboratory=#{sonLaboratory} GROUP BY ins_sample_id) md where td.id = md.id
+ <if test="userId !=null and userId!=''">
+ and user_id = #{userId} OR user_id is NULL
+ </if>
+ OR user_id is NULL
+ ) isu2 on
+ isu2.ins_sample_id = a.id
+ where (ins_state is not null or direct_template = 1)
+ <if test="laboratory != null and laboratory != ''">
+ and a.laboratory=#{laboratory}
+ </if>
+ ORDER BY
+ <!--a.user_id DESC,-->
+ a.type DESC,
+ a.id
+ ) b
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+
+ <select id="selectSampleProductListByOrderId" resultMap="sampleDto">
+ select isa.*,
+ ip.id ip_id,
+ inspection_item,
+ inspection_item_en,
+ inspection_item_class,
+ inspection_item_class_en,
+ inspection_item_subclass,
+ inspection_item_subclass_en,
+ ip.factory ip_factory,
+ ip.laboratory ip_laboratory,
+ ip.sample_type ip_sample_type,
+ ip.sample ip_sample,
+ ip.model ip_model,
+ son_laboratory,
+ ip.unit ip_unit,
+ price,
+ man_hour,
+ man_hour_group,
+ inspection_item_type,
+ inspection_value_type,
+ device_group,
+ checkout_number,
+ section,
+ value_type,
+ method,
+ man_day,
+ bsm,
+ ask,
+ tell,
+ `last_value`,
+ ip.ins_result ip_ins_result,
+ ip.is_binding ip_is_binding,
+ state,
+ ins_sample_id,
+ ip.create_user ip_create_user,
+ ip.update_user ip_update_user,
+ ip.create_time ip_create_time,
+ ip.update_time ip_update_time,
+ template_id,
+ ipr.ins_value,
+ ipr.com_value,
+ ipr.equip_value,
+ ip.method_s
+ from ins_sample isa
+ left join ins_product ip on isa.id = ip.ins_sample_id
+ left join ins_product_result ipr on ip.id = ipr.ins_product_id
+ where ins_order_id = #{id}
+ and state = 1
+-- and ins_fiber_id is null
+-- and ins_fibers_id is null
+ and <!--isa.sample_code NOT REGEXP '/'-->
+ isa.id in(select id1 from (select is2.id id1 ,ip.id from ins_sample is2 left join ins_product ip on is2.id = ip.ins_sample_id where ip.id is not null)s )
+ order by ip.sort asc,
+ case when man_hour_group is NULL then 1
+ when man_hour_group ='' then 1 else 0 end,
+ CASE
+ WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
+ WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
+ ,id asc
+ </select>
+ <select id="getInsOrderAndSample" resultMap="sampleDto">
+ select isa.*,
+ ip.id ip_id,
+ inspection_item,
+ inspection_item_en,
+ inspection_item_class,
+ inspection_item_class_en,
+ inspection_item_subclass,
+ inspection_item_subclass_en,
+ ip.factory ip_factory,
+ ip.laboratory ip_laboratory,
+ ip.sample_type ip_sample_type,
+ ip.sample ip_sample,
+ ip.model ip_model,
+ ip.son_laboratory,
+ ip.unit ip_unit,
+ price,
+ man_hour,
+ man_hour_group,
+ inspection_item_type,
+ inspection_value_type,
+ device_group,
+ checkout_number,
+ section,
+ value_type,
+ method,
+ man_day,
+ bsm,
+ ask,
+ `last_value`,
+ ip.ins_result ip_ins_result,
+ ip.is_binding ip_is_binding,
+ state,
+ ins_sample_id,
+ ip.create_user ip_create_user,
+ ip.update_user ip_update_user,
+ ip.create_time ip_create_time,
+ ip.update_time ip_update_time,
+ template_id,
+ ipr.ins_value,
+ ipr.com_value,
+ ipr.equip_value,
+ ipr.equip_name,
+ ip.method_s,
+ ip.tell,
+ ip.dic,
+ ip.temperature,
+ ip.humidity
+ from ins_sample isa
+ left join ins_product ip on isa.id = ip.ins_sample_id
+ left join ins_product_result ipr on ip.id = ipr.ins_product_id
+ where ins_order_id = #{id}
+ <if test="laboratory != null and laboratory != ''">
+ and (
+ (ip.state = 1 and ip.son_laboratory = #{laboratory})
+ or (
+ ip.id is null
+ and #{laboratory} = '鏂拌仛'
+ and exists (
+ select 1
+ from ins_order_standard_template iost
+ where iost.ins_order_id = isa.ins_order_id
+ )
+ )
+ )
+ </if>
+ </select>
+ <select id="getSampleEn" resultType="java.lang.String">
+ select name_en
+ from product
+ where name = #{sample}
+ limit 1
+ </select>
+ <select id="getSampleEnByObject" resultType="java.lang.String">
+ select specimen_name_en
+ from structure_test_object
+ where specimen_name = #{sample}
+ limit 1
+ </select>
+ <select id="selectInsOrder" resultType="map">
+ SELECT
+ ifs.order_no AS orderNo,
+ ifs.supplier_id AS supplierId,
+ ifs.supplier_name AS supplierName,
+ ifs.part_no AS partNo,
+ ifs.qty_arrived AS qtyArrived,
+ ifs.receiver_date AS receiverDate,
+ ifs.update_batch_no AS updateBatchNo,
+ ifs.part_desc AS partDesc,
+ io.send_time AS sendTime,
+ ifs.declare_user declareUser,
+ ifs.id inventoryQuantityId,
+ ifs.buy_unit_meas buyUnitMeas,
+ io.test_quantity testQuantity,
+ ifs.buy_unit_meas buyUnitMeas,
+ ifs.declare_date declareDate
+ FROM
+ ifs_inventory_quantity ifs
+ LEFT JOIN ins_order io ON ifs.id = io.ifs_inventory_id
+ WHERE
+ io.id = #{id}
+ </select>
+ <select id="selectSampleProductListByOrderId2" resultMap="sampleDto">
+ select isa.*,
+ ip.id ip_id,
+ inspection_item,
+ inspection_item_en,
+ inspection_item_subclass,
+ inspection_item_subclass_en,
+ inspection_item_class,
+ inspection_item_class_en,
+ ip.factory ip_factory,
+ ip.laboratory ip_laboratory,
+ ip.sample_type ip_sample_type,
+ ip.sample ip_sample,
+ ip.model ip_model,
+ son_laboratory,
+ ip.unit ip_unit,
+ price,
+ man_hour,
+ man_hour_group,
+ inspection_item_type,
+ inspection_value_type,
+ device_group,
+ checkout_number,
+ section,
+ value_type,
+ method,
+ man_day,
+ bsm,
+ ask,
+ tell,
+ `last_value`,
+ ip.ins_result ip_ins_result,
+ ip.is_binding ip_is_binding,
+ state,
+ ins_sample_id,
+ ip.create_user ip_create_user,
+ ip.update_user ip_update_user,
+ ip.create_time ip_create_time,
+ ip.update_time ip_update_time,
+ template_id,
+ ipr.ins_value,
+ ipr.com_value,
+ ipr.equip_value,
+ ip.method_s,
+ ip.radius,
+ ip.structure_item_parameter_id,
+ isa.special_standard_method
+ from ins_sample isa
+ left join ins_product ip on isa.id = ip.ins_sample_id
+ left join ins_product_result ipr on ip.id = ipr.ins_product_id
+ where ins_order_id = #{id}
+ and (ip.standard_method_list_id is not null or ip.template_row_index is not null)
+ and state = 1
+ and ip.is_binding != 1
+ order by ip.sort asc,
+ case when man_hour_group is NULL then 1
+ when man_hour_group ='' then 1 else 0 end,
+ CASE
+ WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
+ WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
+ ,id asc
+ </select>
+
+ <select id="getInsProduct1" resultMap="product">
+ select <include refid="getInsProducSql"/>
+ from ins_product ip
+ left join ins_product_result ipr on ip.id = ipr.ins_product_id
+ where ins_sample_id = #{id}
+ and state = 1
+ <if test="laboratory != null and laboratory != ''">
+ and ip.son_laboratory = #{laboratory}
+ </if>
+ and ins_fiber_id is null
+ and ins_fibers_id is null
+ and template_id is not null
+ /* 鐢电紗閰嶇疆鏍囪瘑 */
+ <if test="cableTag == null or cableTag == ''">
+ and ip.cable_tag is null
+ </if>
+ <if test="cableTag != null and cableTag != ''">
+ and ip.cable_tag = #{cableTag}
+ </if>
+ /* 閲嶅鍊兼爣璇� */
+ <if test="repetitionTag == null or repetitionTag == ''">
+ and ip.repetition_tag is null
+ </if>
+ <if test="repetitionTag != null and repetitionTag != ''">
+ and ip.repetition_tag = #{repetitionTag}
+ </if>
+ order by sort asc
+ </select>
+
+ <select id="getInsProduct6" resultMap="product">
+ select <include refid="getInsProducSql"/>
+ from ins_product ip
+ left join ins_product_result ipr on ip.id = ipr.ins_product_id
+ where ins_sample_id = #{id}
+ and state = 1
+ <if test="laboratory != null and laboratory != ''">
+ and ip.son_laboratory = #{laboratory}
+ </if>
+ and ins_fiber_id is null
+ and ins_fibers_id is null
+ and template_id is not null
+ and ip.raw_material_tag = #{rawMaterialTag}
+ order by sort asc
+ </select>
+
+ <select id="getDetailById" resultMap="sampleVo">
+ select is2.*,
+ code methodName
+ from ins_sample is2
+ inner join standard_method sm on standard_method_list_id = sm.id
+ where is2.id = #{sampleId}
+ </select>
+
+ <select id="selMethodById" resultType="java.lang.String">
+ select code
+ from standard_method
+ where id = (select standard_method_list_id from ins_sample where id = #{sampleId})
+ </select>
+
+ <!-- 鏌ョ湅鐢电紗閰嶇疆鏍囪瘑 -->
+ <select id="getCableTag" resultType="java.util.Map">
+ select ip.cable_tag cableTag,
+ CASE
+ WHEN COUNT(ip.last_value) = 0 THEN '0'
+ WHEN COUNT(CASE WHEN ip.last_value = '' OR ip.last_value IS NULL THEN 1 END) = 0 THEN '2'
+ ELSE '2'
+ END AS status
+ from ins_product ip
+ where ins_sample_id = #{id}
+ and state = 1
+ and ip.son_laboratory = #{laboratory}
+ and ins_fiber_id is null
+ and ins_fibers_id is null
+ and standard_method_list_id is not null
+ and ip.cable_tag is not null
+ group by ip.cable_tag
+ </select>
+
+ <!-- 鍘熸潗鏂欐煡鐪嬮厤缃爣璇� -->
+ <select id="getRawMaterialTag" resultType="java.util.Map">
+ select ip.raw_material_tag rawMaterialTag,
+ CASE
+ WHEN COUNT(ip.last_value) = 0 THEN '0'
+ WHEN COUNT(CASE WHEN ip.last_value = '' OR ip.last_value IS NULL THEN 1 END) = 0 THEN '2'
+ ELSE '1'
+ END AS status
+ from ins_product ip
+ where ins_sample_id = #{id}
+ and state = 1
+ and ip.son_laboratory = #{laboratory}
+ and ins_fiber_id is null
+ and ins_fibers_id is null
+ and standard_method_list_id is not null
+ and ip.raw_material_tag is not null
+ group by ip.raw_material_tag
+ </select>
+
+ <!-- 鏌ョ湅閲嶅鏍囪瘑 -->
+ <select id="getRepetitionTag" resultType="java.util.Map">
+ select ip.repetition_tag repetitionTag,
+ CASE
+ WHEN COUNT(ip.last_value) = 0 THEN '0'
+ WHEN COUNT(CASE WHEN ip.last_value = '' OR ip.last_value IS NULL THEN 1 END) = 0 THEN '2'
+ ELSE '1'
+ END AS status,
+ GROUP_CONCAT(DISTINCT ip.radius SEPARATOR '锛�') AS radius
+ from ins_product ip
+ where ins_sample_id = #{id}
+ and state = 1
+ and ip.son_laboratory = #{laboratory}
+ and ins_fiber_id is null
+ and ins_fibers_id is null
+ and standard_method_list_id is not null
+ and ip.repetition_tag is not null
+ /* 鐢电紗閰嶇疆鏍囪瘑 */
+ <if test="cableTag == null or cableTag == ''">
+ and ip.cable_tag is null
+ </if>
+ <if test="cableTag != null and cableTag != ''">
+ and ip.cable_tag = #{cableTag}
+ </if>
+ group by ip.repetition_tag
+ </select>
+
+ <select id="selectExemptionByOrderId" resultType="com.ruoyi.inspect.dto.SampleProductDto">
+ select *
+ from ins_sample
+ where ins_order_id = #{id}
+ </select>
+ <select id="selectSupplierDensityModel" resultType="java.lang.String">
+ select psd.density_value densityValue
+ from product_supplier_density psd
+ where psd.product_id = (select id
+ from product
+ where name = #{sample}
+ limit 1)
+ and psd.supplier_name = #{production}
+ and psd.model = #{model}
+ limit 1
+ </select>
+ <select id="selectSupplierDensity" resultType="java.lang.String">
+ select psd.density_value densityValue
+ from product_supplier_density psd
+ where psd.product_id = (select id
+ from product
+ where name = #{sample}
+ limit 1)
+ and psd.supplier_name = #{production}
+ and (psd.model = '' or psd.model is null)
+ limit 1
+ </select>
+
+ <!-- 鏌ヨ妫�楠岄」妫�楠岀粨鏋� -->
+ <select id="selectProductResult" resultMap="product">
+ select <include refid="getInsProducSql"/>
+ from ins_product ip
+ left join ins_product_result ipr on ip.id = ipr.ins_product_id
+ where ip.id in
+ <foreach collection="itemIds" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ order by ip.sort asc
+ </select>
+
+ <!-- 鏍规嵁璁㈠崟id鏌ヨ鏍峰搧 -->
+ <select id="getSampleByOrderId" resultType="com.ruoyi.inspect.pojo.InsSample">
+ select is2.*,
+ sml.name standard_method_name
+ from ins_sample is2
+ left join standard_method sml on sml.id = is2.standard_method_list_id
+ where is2.ins_order_id = #{insOrderId}
+ </select>
+
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsSampleReceiptMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleReceiptMapper.xml
new file mode 100644
index 0000000..8dbe4e5
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsSampleReceiptMapper.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsSampleReceiptMapper">
+ <sql id="receiptColumns">
+ r.id receipt_id, r.ins_order_id order_id, r.ins_sample_id sample_id, r.status,
+ COALESCE(NULLIF(io.sample_view, ''), isa.sample) AS sample_name, isa.sample_code, io.entrust_code,
+ COALESCE(iost.method_standard, sm.code) method_standard,
+ ip.inspection_item, r.main_inspector_id, u.name main_inspector_name,
+ COALESCE(isa.remark, io.remark) remark, r.reject_remark, r.receive_time,
+ ru.name receive_user_name
+ </sql>
+ <select id="selectPage" resultType="com.ruoyi.inspect.dto.SampleReceiptPageDto">
+ SELECT
+ <include refid="receiptColumns"/>
+ FROM ins_sample_receipt r
+ JOIN ins_order io ON io.id = r.ins_order_id
+ JOIN ins_sample isa ON isa.id = r.ins_sample_id
+ LEFT JOIN standard_method sm ON sm.id = isa.standard_method_list_id
+ LEFT JOIN (
+ SELECT ins_order_id,
+ GROUP_CONCAT(DISTINCT number ORDER BY sort SEPARATOR '\n') method_standard
+ FROM ins_order_standard_template
+ GROUP BY ins_order_id
+ ) iost ON iost.ins_order_id = io.id
+ LEFT JOIN (
+ SELECT ins_sample_id,
+ GROUP_CONCAT(DISTINCT inspection_item ORDER BY sort SEPARATOR '\n') inspection_item
+ FROM ins_product
+ WHERE state = 1
+ GROUP BY ins_sample_id
+ ) ip ON ip.ins_sample_id = isa.id
+ LEFT JOIN user u ON u.id = r.main_inspector_id
+ LEFT JOIN user ru ON ru.id = r.receive_user_id
+ WHERE 1 = 1
+ <if test="query.status != null">AND r.status = #{query.status}</if>
+ <if test="query.entrustCode != null and query.entrustCode != ''">AND io.entrust_code LIKE CONCAT('%',
+ #{query.entrustCode}, '%')
+ </if>
+ <if test="query.sampleCode != null and query.sampleCode != ''">AND isa.sample_code LIKE CONCAT('%',
+ #{query.sampleCode}, '%')
+ </if>
+ <if test="query.sampleName != null and query.sampleName != ''">AND COALESCE(NULLIF(io.sample_view, ''), isa.sample)
+ LIKE CONCAT('%', #{query.sampleName}, '%')
+ </if>
+ GROUP BY r.id
+ ORDER BY r.create_time DESC
+ </select>
+ <select id="selectDetail" resultType="com.ruoyi.inspect.dto.SampleReceiptPageDto">
+ SELECT <include refid="receiptColumns"/>
+ FROM ins_sample_receipt r
+ JOIN ins_order io ON io.id = r.ins_order_id
+ JOIN ins_sample isa ON isa.id = r.ins_sample_id
+ LEFT JOIN standard_method sm ON sm.id = isa.standard_method_list_id
+ LEFT JOIN (
+ SELECT ins_order_id,
+ GROUP_CONCAT(DISTINCT number ORDER BY sort SEPARATOR '\n') method_standard
+ FROM ins_order_standard_template
+ GROUP BY ins_order_id
+ ) iost ON iost.ins_order_id = io.id
+ LEFT JOIN (
+ SELECT ins_sample_id,
+ GROUP_CONCAT(DISTINCT inspection_item ORDER BY sort SEPARATOR '\n') inspection_item
+ FROM ins_product
+ WHERE state = 1
+ GROUP BY ins_sample_id
+ ) ip ON ip.ins_sample_id = isa.id
+ LEFT JOIN user u ON u.id = r.main_inspector_id
+ LEFT JOIN user ru ON ru.id = r.receive_user_id
+ WHERE r.id = #{id}
+ GROUP BY r.id
+ </select>
+ <select id="selectExportList" resultType="com.ruoyi.inspect.dto.SampleReceiptPageDto">
+ SELECT <include refid="receiptColumns"/>
+ FROM ins_sample_receipt r
+ JOIN ins_order io ON io.id = r.ins_order_id
+ JOIN ins_sample isa ON isa.id = r.ins_sample_id
+ LEFT JOIN standard_method sm ON sm.id = isa.standard_method_list_id
+ LEFT JOIN (
+ SELECT ins_order_id,
+ GROUP_CONCAT(DISTINCT number ORDER BY sort SEPARATOR '\n') method_standard
+ FROM ins_order_standard_template
+ GROUP BY ins_order_id
+ ) iost ON iost.ins_order_id = io.id
+ LEFT JOIN (
+ SELECT ins_sample_id,
+ GROUP_CONCAT(DISTINCT inspection_item ORDER BY sort SEPARATOR '\n') inspection_item
+ FROM ins_product
+ WHERE state = 1
+ GROUP BY ins_sample_id
+ ) ip ON ip.ins_sample_id = isa.id
+ LEFT JOIN user u ON u.id = r.main_inspector_id
+ LEFT JOIN user ru ON ru.id = r.receive_user_id
+ WHERE 1 = 1
+ <if test="query.status != null"> AND r.status = #{query.status}</if>
+ <if test="query.entrustCode != null and query.entrustCode != ''"> AND io.entrust_code LIKE CONCAT('%', #{query.entrustCode}, '%')</if>
+ <if test="query.sampleCode != null and query.sampleCode != ''"> AND isa.sample_code LIKE CONCAT('%', #{query.sampleCode}, '%')</if>
+ <if test="query.sampleName != null and query.sampleName != ''"> AND COALESCE(NULLIF(io.sample_view, ''), isa.sample) LIKE CONCAT('%', #{query.sampleName}, '%')</if>
+ GROUP BY r.id
+ ORDER BY r.create_time DESC
+ </select>
+ <select id="selectForUpdate" resultType="com.ruoyi.inspect.pojo.InsSampleReceipt">
+ SELECT * FROM ins_sample_receipt WHERE id = #{id} FOR UPDATE
+ </select>
+ <insert id="insertIgnore">
+ INSERT IGNORE INTO ins_sample_receipt(ins_order_id, ins_sample_id, status, create_time, update_time)
+ VALUES(#{orderId}, #{sampleId}, 0, NOW(), NOW())
+ </insert>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsSampleUserMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleUserMapper.xml
new file mode 100644
index 0000000..c28afad
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsSampleUserMapper.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.InsSampleUserMapper">
+ <select id="selectUserNameByOrderId" resultType="com.ruoyi.inspect.vo.InsSampleUserVO">
+ select
+ group_concat(DISTINCT u.name separator ',') AS inspector,
+ date_format(isu.create_time,'%Y-%m-%d') AS inspect_date,
+ isa.model
+ from ins_sample_user isu
+ left join ins_sample isa on isu.ins_sample_id = isa.ins_order_id
+ left join user u on isu.user_id=u.id
+ where isu.ins_sample_id=#{orderId} and isu.state=0
+ group by isu.ins_sample_id
+ order by isu.create_time
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsUnqualifiedHandlerMapper.xml b/inspect-server/src/main/resources/mapper/InsUnqualifiedHandlerMapper.xml
new file mode 100644
index 0000000..f971b19
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsUnqualifiedHandlerMapper.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.InsUnqualifiedHandlerMapper">
+
+ <sql id="Base_Column_List">
+ id,no,supplier_name,
+ material_name,production_batch,cargo_quantity,
+ specs_models,inspect_time,feedback_user,
+ feedback_time,classification,off_grade_ascription,
+ unqualified_desc,inventory_quantity_id
+ </sql>
+ <select id="selectPageList" resultType="com.ruoyi.inspect.vo.UnqualifiedHandlerVO">
+ select * from (select
+ iiq.*,
+ iuh.id as handler_id,
+ iuh.no,
+ iuh.material_name,
+ iuh.production_batch,
+ iuh.cargo_quantity,
+ iuh.specs_models,
+ iuh.inspect_time,
+ iuh.feedback_user,
+ iuh.feedback_time,
+ iuh.classification,
+ iuh.off_grade_ascription,
+ iuh.unqualified_desc,
+ iuh.inventory_quantity_id,
+ iuh.headline
+ from
+ ins_unqualified_handler iuh
+ inner join
+ ifs_inventory_quantity iiq
+ on
+ iuh.inventory_quantity_id = iiq.id)tempA
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ order by id desc
+ </select>
+ <select id="findById" resultType="com.ruoyi.inspect.vo.UnqualifiedHandlerVO">
+ select * from (select
+ iiq.*,
+ iuh.id as handler_id,
+ iuh.no,
+ iuh.headline,
+ iuh.material_name,
+ iuh.production_batch,
+ iuh.cargo_quantity,
+ iuh.specs_models,
+ iuh.inspect_time,
+ iuh.feedback_user,
+ iuh.feedback_time,
+ iuh.classification,
+ iuh.off_grade_ascription,
+ iuh.unqualified_desc,
+ iuh.inventory_quantity_id
+ from
+ ins_unqualified_handler iuh
+ inner join
+ ifs_inventory_quantity iiq
+ on
+ iuh.inventory_quantity_id = iiq.id)tempA
+ where tempA.handler_id = #{id}
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/InsUnqualifiedRetestProductMapper.xml b/inspect-server/src/main/resources/mapper/InsUnqualifiedRetestProductMapper.xml
new file mode 100644
index 0000000..06b9f6e
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/InsUnqualifiedRetestProductMapper.xml
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.InsUnqualifiedRetestProductMapper">
+ <resultMap id="product" type="com.ruoyi.inspect.pojo.InsProduct">
+ <id property="id" column="ip_id" jdbcType="INTEGER"/>
+ <result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/>
+ <result property="inspectionItemEn" column="inspection_item_en" jdbcType="VARCHAR"/>
+ <result property="inspectionItemSubclass" column="inspection_item_subclass" jdbcType="VARCHAR"/>
+ <result property="inspectionItemSubclassEn" column="inspection_item_subclass_en" jdbcType="VARCHAR"/>
+ <result property="inspectionItemClass" column="inspection_item_class" jdbcType="VARCHAR"/>
+ <result property="inspectionItemClassEn" column="inspection_item_class_en" jdbcType="VARCHAR"/>
+ <result property="factory" column="ip_factory" jdbcType="VARCHAR"/>
+ <result property="laboratory" column="ip_laboratory" jdbcType="VARCHAR"/>
+ <result property="sampleType" column="ip_sample_type" jdbcType="VARCHAR"/>
+ <result property="sample" column="ip_sample" jdbcType="VARCHAR"/>
+ <result property="model" column="ip_model" jdbcType="VARCHAR"/>
+ <result property="sonLaboratory" column="son_laboratory" jdbcType="VARCHAR"/>
+ <result property="unit" column="ip_unit" jdbcType="VARCHAR"/>
+ <result property="price" column="price" jdbcType="DECIMAL"/>
+ <result property="manHour" column="man_hour" jdbcType="DOUBLE"/>
+ <result property="manHourGroup" column="man_hour_group" jdbcType="VARCHAR"/>
+ <result property="inspectionItemType" column="inspection_item_type" jdbcType="VARCHAR"/>
+ <result property="inspectionValueType" column="inspection_value_type" jdbcType="VARCHAR"/>
+ <result property="deviceGroup" column="device_group" jdbcType="VARCHAR"/>
+ <result property="checkoutNumber" column="checkout_number" jdbcType="INTEGER"/>
+ <result property="section" column="section" jdbcType="VARCHAR"/>
+ <result property="valueType" column="value_type" jdbcType="VARCHAR"/>
+ <result property="method" column="method" jdbcType="VARCHAR"/>
+ <result property="manDay" column="man_day" jdbcType="INTEGER"/>
+ <result property="bsm" column="bsm" jdbcType="VARCHAR"/>
+ <result property="ask" column="ask" jdbcType="VARCHAR"/>
+ <result property="tell" column="tell" jdbcType="VARCHAR"/>
+ <result property="lastValue" column="last_value" jdbcType="VARCHAR"/>
+ <result property="insResult" column="ip_ins_result" jdbcType="INTEGER"/>
+ <result property="state" column="state" jdbcType="INTEGER"/>
+ <result property="insBushId" column="ins_bush_id" jdbcType="INTEGER"/>
+ <result property="insSampleId" column="ins_sample_id" jdbcType="INTEGER"/>
+ <result property="createUser" column="ip_create_user" jdbcType="INTEGER"/>
+ <result property="updateUser" column="ip_update_user" jdbcType="INTEGER"/>
+ <result property="createTime" column="ip_create_time" jdbcType="TIMESTAMP"/>
+ <result property="updateTime" column="ip_update_time" jdbcType="TIMESTAMP"/>
+ <result property="templateId" column="template_id" jdbcType="INTEGER"/>
+ <result property="methodS" column="method_s"/>
+ <result property="tell" column="tell"/>
+ <result property="dic" column="dic"/>
+ <result property="temperature" column="temperature"/>
+ <result property="humidity" column="humidity"/>
+ <result property="cableTag" column="cable_tag"/>
+ <collection property="insProductResult" resultMap="insProductResult"/>
+ </resultMap>
+
+ <resultMap id="insProductResult" type="com.ruoyi.inspect.pojo.InsProductResult">
+ <result property="insValue" column="ins_value" jdbcType="VARCHAR"/>
+ <result property="comValue" column="com_value" jdbcType="VARCHAR"/>
+ <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/>
+ <result property="equipName" column="equip_name" jdbcType="VARBINARY"/>
+ </resultMap>
+
+ <sql id="getInsProducSql">
+ ip.id ip_id,
+ inspection_item,
+ inspection_item_en,
+ inspection_item_class,
+ inspection_item_class_en,
+ inspection_item_subclass,
+ inspection_item_subclass_en,
+ ip.factory ip_factory,
+ ip.laboratory ip_laboratory,
+ ip.sample_type ip_sample_type,
+ ip.sample ip_sample,
+ ip.model ip_model,
+ son_laboratory,
+ ip.unit ip_unit,
+ price,
+ man_hour,
+ man_hour_group,
+ inspection_item_type,
+ inspection_value_type,
+ device_group,
+ checkout_number,
+ section,
+ value_type,
+ method,
+ man_day,
+ bsm,
+ ask,
+ `last_value`,
+ ip.ins_result ip_ins_result,
+ state,
+ ins_sample_id,
+ ip.create_user ip_create_user,
+ ip.update_user ip_update_user,
+ ip.create_time ip_create_time,
+ ip.update_time ip_update_time,
+ template_id,
+ ipr.ins_value,
+ ipr.com_value,
+ ipr.equip_value,
+ ipr.equip_name,
+ ip.method_s,
+ ip.tell,
+ ip.dic,
+ ip.sort,
+ ip.cable_tag,
+ ip.structure_item_parameter_id
+ </sql>
+
+ <select id="selectRetestProduct" resultType="com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct">
+ select id ins_product_id,
+ inspection_item,
+ inspection_item_subclass,
+ factory,
+ laboratory,
+ sample_type,
+ sample,
+ model,
+ son_laboratory,
+ unit,
+ price,
+ man_hour,
+ man_hour_group,
+ '0' inspection_item_type,
+ inspection_value_type,
+ device_group,
+ checkout_number,
+ section,
+ value_type,
+ method,
+ man_day,
+ bsm,
+ ask,
+ tell,
+ state,
+ ins_sample_id,
+ create_user,
+ update_user,
+ create_time,
+ update_time,
+ template_id,
+ dic,
+ method_s,
+ ins_fiber_id,
+ ins_fibers_id,
+ inspection_item_en,
+ inspection_item_subclass_en,
+ inspection_item_class,
+ inspection_item_class_en,
+ standard_method_list_id,
+ temperature,
+ humidity,
+ ins_bush_id,
+ radius,
+ cable_tag,
+ raw_material_tag,
+ sort,
+ '1' retest_tag
+ from ins_product
+ where id in
+ <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
+ #{val}
+ </foreach>
+ </select>
+ <select id="getInsProductUnqualifiedRetest1" resultMap="product">
+ select <include refid="getInsProducSql"/>
+ from ins_unqualified_retest_product ip
+ left join ins_unqualified_retest_result ipr on ip.id = ipr.retest_product_id
+ where ins_sample_id = #{id}
+ and state = 1
+ and ip.son_laboratory = #{laboratory}
+ and ins_fiber_id is null
+ and ins_fibers_id is null
+ and standard_method_list_id is not null
+ /* 鐢电紗閰嶇疆鏍囪瘑 */
+ <if test="cableTag == null or cableTag == ''">
+ and ip.cable_tag is null
+ </if>
+ <if test="cableTag != null and cableTag != ''">
+ and ip.cable_tag = #{cableTag}
+ </if>
+ /* 閲嶅鍊兼爣璇� */
+ <if test="repetitionTag == null or repetitionTag == ''">
+ and ip.repetition_tag is null
+ </if>
+ <if test="repetitionTag != null and repetitionTag != ''">
+ and ip.repetition_tag = #{repetitionTag}
+ </if>
+ and ip.retest_tag = #{retestTag}
+ order by sort asc
+ </select>
+
+ <select id="getInsProductUnqualifiedRetest6" resultMap="product">
+ select <include refid="getInsProducSql"/>
+ from ins_unqualified_retest_product ip
+ left join ins_unqualified_retest_result ipr on ip.id = ipr.retest_product_id
+ where ins_sample_id = #{id}
+ and state = 1
+ and ip.son_laboratory = #{laboratory}
+ and ins_fiber_id is null
+ and ins_fibers_id is null
+ and standard_method_list_id is not null
+ and ip.raw_material_tag = #{rawMaterialTag}
+ and ip.retest_tag = #{retestTag}
+ order by sort asc
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/RawMaterialOrderTemplateMapper.xml b/inspect-server/src/main/resources/mapper/RawMaterialOrderTemplateMapper.xml
new file mode 100644
index 0000000..cc06bb9
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/RawMaterialOrderTemplateMapper.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.RawMaterialOrderTemplateMapper">
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/SpotCheckQuarterItemMapper.xml b/inspect-server/src/main/resources/mapper/SpotCheckQuarterItemMapper.xml
new file mode 100644
index 0000000..f1404a5
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/SpotCheckQuarterItemMapper.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.SpotCheckQuarterItemMapper">
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/SpotCheckQuarterMapper.xml b/inspect-server/src/main/resources/mapper/SpotCheckQuarterMapper.xml
new file mode 100644
index 0000000..6238257
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/SpotCheckQuarterMapper.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.SpotCheckQuarterMapper">
+ <select id="getQuarterPage" resultType="com.ruoyi.inspect.dto.SpotCheckQuarterDto">
+ select * from ( select scq.quarter_id,
+ scq.quarter_no,
+ scq.quarter_status,
+ scq.file_url,
+ scq.remark,
+ u.name create_user_name,
+ scq.create_time
+ from spot_check_quarter scq
+ left join user u on u.id = scq.create_user) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+ <select id="getQuarterOnOrder" resultType="java.util.Map">
+ select quarter_id value,
+ quarter_no label
+ from spot_check_quarter
+ </select>
+
+
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/SpotCheckYearMapper.xml b/inspect-server/src/main/resources/mapper/SpotCheckYearMapper.xml
new file mode 100644
index 0000000..9584e96
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/SpotCheckYearMapper.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.inspect.mapper.SpotCheckYearMapper">
+
+ <select id="getSpotCheckYearPage" resultType="com.ruoyi.inspect.dto.SpotCheckYearDto">
+ select * from (select scy.year_id,
+ scy.year_head,
+ scy.table_remark,
+ scy.file_url,
+ scy.remark,
+ u.name create_user_name,
+ scy.create_time
+ from spot_check_year scy
+ left join user u on u.id = scy.create_user) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/WarehouseCellMapper.xml b/inspect-server/src/main/resources/mapper/WarehouseCellMapper.xml
new file mode 100644
index 0000000..2c673ee
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/WarehouseCellMapper.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.WarehouseCellMapper">
+
+ <select id="getWarehouse" resultMap="WarehouseCellAndHistoryDto">
+ select wc.id, wc.row, wc.col, i.id sampleId, i.sample, i.model, i.sample_code from warehouse_cell wc
+ left join ins_sample i on i.cell_id = wc.id
+ where wc.state = 1
+ and wc.shelf_id = #{shelfId}
+ order by wc.id
+ </select>
+
+ <resultMap id="WarehouseCellAndHistoryDto" type="com.ruoyi.inspect.dto.WarehouseCellAndSampleDto">
+ <id property="id" column="id" jdbcType="INTEGER"/>
+ <result property="row" column="row" jdbcType="INTEGER"/>
+ <result property="col" column="col" jdbcType="INTEGER"/>
+ <collection property="samples" resultMap="InsSample"/>
+ </resultMap>
+
+ <resultMap id="InsSample" type="com.ruoyi.inspect.pojo.InsSample">
+ <id property="id" column="sampleId"/>
+ <result property="sample" column="sample"/>
+ <result property="model" column="model"/>
+ <result property="sampleCode" column="sample_code"/>
+ </resultMap>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/WarehouseHistoryMapper.xml b/inspect-server/src/main/resources/mapper/WarehouseHistoryMapper.xml
new file mode 100644
index 0000000..5a26e39
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/WarehouseHistoryMapper.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.WarehouseHistoryMapper">
+
+ <select id="getUserNameById" resultType="java.lang.String">
+ select name from user where id = #{userId}
+ </select>
+ <select id="getHistoryListBySampleId" resultType="com.ruoyi.inspect.dto.HistoryDto">
+ select wh.*,u.name createUserName from warehouse_history wh
+ left join user u on u.id = wh.create_user
+ where wh.ins_sample_id = #{sampleId}
+ order by wh.id desc
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/WarehouseMapper.xml b/inspect-server/src/main/resources/mapper/WarehouseMapper.xml
new file mode 100644
index 0000000..2bbc6e8
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/WarehouseMapper.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.inspect.mapper.WarehouseMapper">
+
+ <resultMap id="Warehouse" type="com.ruoyi.inspect.dto.WarehouseDto">
+ <id property="id" column="id" jdbcType="INTEGER"/>
+ <result property="name" column="name" jdbcType="VARCHAR"/>
+ <collection property="warehouseShelfList" resultMap="shelf"/>
+ </resultMap>
+
+ <resultMap id="shelf" type="com.ruoyi.inspect.pojo.WarehouseShelf">
+ <id property="id" column="sId" jdbcType="INTEGER"/>
+ <result property="name" column="sName" jdbcType="VARCHAR"/>
+ <result property="row" column="row" jdbcType="INTEGER"/>
+ <result property="col" column="col" jdbcType="INTEGER"/>
+ </resultMap>
+
+ <select id="selectWarehouseList" resultMap="Warehouse">
+ select w.id,w.name,ws.id sId,ws.name sName,ws.row,ws.col,ws.warehouse_id from warehouse w
+ left join warehouse_shelf ws on w.id = ws.warehouse_id
+ </select>
+</mapper>
diff --git a/inspect-server/src/main/resources/static/detection-report-template-v2.docx b/inspect-server/src/main/resources/static/detection-report-template-v2.docx
new file mode 100644
index 0000000..81ec55c
--- /dev/null
+++ b/inspect-server/src/main/resources/static/detection-report-template-v2.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/detection-report-template.docx b/inspect-server/src/main/resources/static/detection-report-template.docx
new file mode 100644
index 0000000..e748edb
--- /dev/null
+++ b/inspect-server/src/main/resources/static/detection-report-template.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/factory_verify.docx b/inspect-server/src/main/resources/static/factory_verify.docx
new file mode 100644
index 0000000..c74f9d8
--- /dev/null
+++ b/inspect-server/src/main/resources/static/factory_verify.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/inspection-report-template-v2.docx b/inspect-server/src/main/resources/static/inspection-report-template-v2.docx
new file mode 100644
index 0000000..2c2a1a7
--- /dev/null
+++ b/inspect-server/src/main/resources/static/inspection-report-template-v2.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/report-template.docx b/inspect-server/src/main/resources/static/report-template.docx
new file mode 100644
index 0000000..0502472
--- /dev/null
+++ b/inspect-server/src/main/resources/static/report-template.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/small-detection-template.docx b/inspect-server/src/main/resources/static/small-detection-template.docx
new file mode 100644
index 0000000..8cbfc1f
--- /dev/null
+++ b/inspect-server/src/main/resources/static/small-detection-template.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/small-report-template.docx b/inspect-server/src/main/resources/static/small-report-template.docx
new file mode 100644
index 0000000..8fc7a23
--- /dev/null
+++ b/inspect-server/src/main/resources/static/small-report-template.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/small-wg-detection-template.docx b/inspect-server/src/main/resources/static/small-wg-detection-template.docx
new file mode 100644
index 0000000..053779f
--- /dev/null
+++ b/inspect-server/src/main/resources/static/small-wg-detection-template.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/small-wg-report-template.docx b/inspect-server/src/main/resources/static/small-wg-report-template.docx
new file mode 100644
index 0000000..4a2285b
--- /dev/null
+++ b/inspect-server/src/main/resources/static/small-wg-report-template.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/split_order_import_template.xlsx b/inspect-server/src/main/resources/static/split_order_import_template.xlsx
new file mode 100644
index 0000000..1ac0789
--- /dev/null
+++ b/inspect-server/src/main/resources/static/split_order_import_template.xlsx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/spot_check_quarter.docx b/inspect-server/src/main/resources/static/spot_check_quarter.docx
new file mode 100644
index 0000000..0d1c843
--- /dev/null
+++ b/inspect-server/src/main/resources/static/spot_check_quarter.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/spot_check_year.docx b/inspect-server/src/main/resources/static/spot_check_year.docx
new file mode 100644
index 0000000..0df5e76
--- /dev/null
+++ b/inspect-server/src/main/resources/static/spot_check_year.docx
Binary files differ
diff --git a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryCorrectionHoursController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryCorrectionHoursController.java
index 2dd39a4..7057e1b 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryCorrectionHoursController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryCorrectionHoursController.java
@@ -35,7 +35,7 @@
AuxiliaryCorrectionHoursService auxiliaryCorrectionHoursService;
@Operation(summary = "鏌ヨ淇宸ユ椂")
- @PostMapping("/selectAuxiliaryCorrectionHours")
+ @GetMapping("/selectAuxiliaryCorrectionHours")
public Result selectAuxiliaryCorrectionHours(Page page,AuxiliaryCorrectionHoursDto entity) throws Exception {
return Result.success(auxiliaryCorrectionHoursService.selectAuxiliaryCorrectionHours(page, entity));
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOriginalHoursController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOriginalHoursController.java
index a8ca501..bd8cc96 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOriginalHoursController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOriginalHoursController.java
@@ -25,20 +25,20 @@
AuxiliaryOriginalHoursService auxiliaryOriginalHoursService;
@Operation(summary = "鏌ヨ鍘熷宸ユ椂")
- @PostMapping("/selectAuxiliaryOriginalHours")
+ @GetMapping("/selectAuxiliaryOriginalHours")
public Result selectAuxiliaryOriginalHours(Page page, AuxiliaryOriginalHoursLookDto entity) throws Exception {
return Result.success(auxiliaryOriginalHoursService.selectAuxiliaryOriginalHours(page, entity));
}
@Operation(summary = "瀵煎嚭鍘熷宸ユ椂")
- @PostMapping("/exportOriginalHours")
+ @GetMapping("/exportOriginalHours")
public void exportOriginalHours(@RequestParam("month") String month, @RequestParam("name") String name, @RequestParam("departLims") String departLims,HttpServletResponse response) throws IOException {
auxiliaryOriginalHoursService.exportWorkingHours(month,name,departLims,response);
}
@Operation(summary = "鏌ヨ鏈堜唤鍏ㄩ儴宸ユ椂")
- @PostMapping("/selectAuxiliaryAllByMonth")
- public Result selectAuxiliaryAllByMonth(@RequestBody AuxiliaryOriginalHoursLookDto dto){
+ @GetMapping("/selectAuxiliaryAllByMonth")
+ public Result selectAuxiliaryAllByMonth(AuxiliaryOriginalHoursLookDto dto){
return Result.success(auxiliaryOriginalHoursService.selectAuxiliaryAllByMonth(dto));
}
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOutputWorkingHoursController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOutputWorkingHoursController.java
index f5d7c7d..0b60235 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOutputWorkingHoursController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOutputWorkingHoursController.java
@@ -33,15 +33,14 @@
private AuxiliaryOutputWorkingHoursService auxiliaryOutputWorkingHoursService;
@Operation(summary = "鏌ヨ浜ч噺宸ユ椂")
- @PostMapping("/selectAuxiliaryOutputWorkingHours")
+ @GetMapping("/selectAuxiliaryOutputWorkingHours")
public Result selectAuxiliaryOutputWorkingHours(Page page,AuxiliaryOutputWorkingHoursDto entity) throws Exception {
return Result.success(auxiliaryOutputWorkingHoursService.selectAuxiliaryOutputWorkingHours(page, entity));
}
@Operation(summary = "缁熻浜ч噺宸ユ椂姹囨�诲拰杈呭姪宸ユ椂姹囨��")
- @PostMapping("/collectWorkingHours")
- public Result collectWorkingHours(@RequestBody Map<String, Object> data)throws Exception{
- AuxiliaryOutputWorkingHoursDto entity = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), AuxiliaryOutputWorkingHoursDto.class);
+ @GetMapping("/collectWorkingHours")
+ public Result collectWorkingHours(AuxiliaryOutputWorkingHoursDto entity)throws Exception{
return Result.success(auxiliaryOutputWorkingHoursService.collectWorkingHours(entity));
}
@@ -65,9 +64,8 @@
* @throws IOException
*/
@Operation(summary = "瀵煎嚭浜ч噺宸ユ椂")
- @PostMapping("/exportOutputHours")
- public void exportOutputHours(@RequestBody Map<String, Object> data, HttpServletResponse response) throws Exception {
- AuxiliaryOutputWorkingHoursDto entity = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), AuxiliaryOutputWorkingHoursDto.class);
+ @GetMapping("/exportOutputHours")
+ public void exportOutputHours(AuxiliaryOutputWorkingHoursDto entity, HttpServletResponse response) throws Exception {
auxiliaryOutputWorkingHoursService.exportOutputHours(entity, response);
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursController.java
index 7eb3e1f..5455151 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursController.java
@@ -8,10 +8,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.Map;
@@ -33,15 +30,17 @@
private AuxiliaryWorkingHoursService auxiliaryWorkingHoursService;
@Operation(summary = "鏌ヨ杈呭姪宸ユ椂")
- @PostMapping("/selectAuxiliaryWorkingHours")
+ @GetMapping("/selectAuxiliaryWorkingHours")
public Result selectAuxiliaryWorkingHours(Page page,AuxiliaryWorkingHours entity) throws Exception {
return Result.success(auxiliaryWorkingHoursService.selectAuxiliaryWorkingHours(page,entity));
}
@Operation(summary = "鍒犻櫎杈呭姪宸ユ椂")
- @PostMapping("/deleteAuxiliaryWorkingHours")
+ @DeleteMapping("/deleteAuxiliaryWorkingHours")
public Result deleteAuxiliaryWorkingHours(Integer id){
+
return Result.success(auxiliaryWorkingHoursService.deleteAuxiliaryWorkingHours(id));
+
}
@Operation(summary = "淇敼杈呭姪宸ユ椂")
diff --git a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursDayController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursDayController.java
index 6b0acd3..9026c39 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursDayController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursDayController.java
@@ -10,10 +10,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
@@ -39,19 +36,19 @@
private AuxiliaryWorkingHoursDayService auxiliaryWorkingHoursDayService;
@Operation(summary = "鏌ヨ宸ユ椂缁熻鐨勮緟鍔╁伐鏃�")
- @PostMapping("/selectAuxiliaryWorkingHoursDay")
+ @GetMapping("/selectAuxiliaryWorkingHoursDay")
public Result selectAuxiliaryWorkingHoursDay(Page page,AuxiliaryWorkingHoursDayDto entity) throws Exception {
return Result.success(auxiliaryWorkingHoursDayService.selectAuxiliaryWorkingHoursDay(page, entity));
}
@Operation(summary = "鏍规嵁缂栧彿鏌ヨ杈呭姪宸ユ椂閰嶇疆淇℃伅")
- @PostMapping("/selectAuxiliaryWorkingHoursByNumber")
+ @GetMapping("/selectAuxiliaryWorkingHoursByNumber")
public Result selectAuxiliaryWorkingHoursByNumber(String number) {
return Result.success(auxiliaryWorkingHoursDayService.selectAuxiliaryWorkingHoursByNumber(number));
}
@Operation(summary = "鏍规嵁缂栧彿褰撳墠鐢ㄦ埛淇℃伅鏌ヨ鎵�鍦ㄧ彮娆�")
- @PostMapping("/selectshiftByUser")
+ @GetMapping("/selectshiftByUser")
public Result selectshiftByUser(LocalDateTime dateTime) {
return Result.success(auxiliaryWorkingHoursDayService.selectshiftByUser(dateTime));
}
@@ -81,7 +78,7 @@
}
@Operation(summary = "鍒犻櫎宸ユ椂缁熻鐨勮緟鍔╁伐鏃�")
- @PostMapping("/deleteAuxiliaryWorkingHoursDay")
+ @DeleteMapping("/deleteAuxiliaryWorkingHoursDay")
public Result deleteAuxiliaryWorkingHoursDay(Integer id) {
return Result.success(auxiliaryWorkingHoursDayService.deleteAuxiliaryWorkingHoursDay(id));
}
@@ -92,9 +89,8 @@
* @throws IOException
*/
@Operation(summary = "瀵煎嚭杈呭姪宸ユ椂")
- @PostMapping("/exportAssistantHours")
- public void exportAssistantHours(@RequestBody Map<String, Object> data, HttpServletResponse response) throws Exception {
- AuxiliaryWorkingHoursDayDto entity = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), AuxiliaryWorkingHoursDayDto.class);
+ @GetMapping("/exportAssistantHours")
+ public void exportAssistantHours(AuxiliaryWorkingHoursDayDto entity, HttpServletResponse response) throws Exception {
auxiliaryWorkingHoursDayService.exportWorkingHours(entity, response);
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
index 11af777..185ac2e 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
@@ -63,19 +63,19 @@
}
@Operation(summary = "鏈堜唤鍒嗛〉鏌ヨ")
- @PostMapping("page")
+ @GetMapping("page")
public Result<?> performanceShiftPage(Integer size, Integer current, String time, String userName, String laboratory) {
return Result.success(performanceShiftService.performanceShiftPage(new Page<>(current, size), time, userName, laboratory));
}
@Operation(summary = "骞翠唤鍒嗛〉鏌ヨ")
- @PostMapping("pageYear")
+ @GetMapping("pageYear")
public Result<?> performanceShiftPageYear(Integer size, Integer current, String time, String userName, String laboratory) {
return Result.success(performanceShiftService.performanceShiftPageYear(new Page<>(current, size), time, userName, laboratory));
}
@Operation(summary = "鐝鐘舵�佷慨鏀�")
- @PutMapping("update")
+ @PostMapping("update")
public Result<?> performanceShiftUpdate(@RequestBody PerformanceShift performanceShift) {
performanceShiftService.performanceShiftUpdate(performanceShift);
return Result.success();
@@ -114,7 +114,6 @@
@Operation(summary = "涓存椂鎺ュ彛-娣诲姞7鏈堜唤8鏈堜唤鐨勬暟鎹�")
@GetMapping("temporaryInterface")
public void temporaryInterface() {
- System.out.println("寮�濮嬬粰姣忎釜浜鸿繘琛屾帓鐝�,榛樿鏃╃彮======start");
// TODO 缁欐瘡涓汉閮借繘琛屾帓鐝�(榛樿鏃╃彮)
PerformanceShiftAddDto performanceShiftAddDto = new PerformanceShiftAddDto();
//鐝--鏃�(鏌ヨ瀛楀吀)
@@ -140,13 +139,11 @@
endOfWeek = startOfWeek.plusDays(6);
LocalDateTime startDateTime = LocalDateTime.of(startOfWeek, LocalTime.MIDNIGHT);
LocalDateTime endDateTime = LocalDateTime.of(endOfWeek, LocalTime.MIDNIGHT);
- System.out.println("Week starts on " + startDateTime + " and ends on " + endDateTime);
performanceShiftAddDto.setStartWeek(startDateTime);
performanceShiftAddDto.setEndWeek(endDateTime);
performanceShiftService.performanceShiftAdd(performanceShiftAddDto);
startOfWeek = startOfWeek.plusWeeks(1);
}
- System.out.println("鎺掔彮缁撴潫======end");
}
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/controller/ShiftTimeController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/ShiftTimeController.java
index e253271..c3c0a21 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/controller/ShiftTimeController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/controller/ShiftTimeController.java
@@ -6,10 +6,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
/**
* <p>
@@ -35,13 +32,13 @@
}
@Operation(summary = "鎺掔彮鏃堕棿閰嶇疆鏌ヨ")
- @PostMapping("list")
+ @GetMapping("list")
public Result<?> shiftTimeList() {
return Result.success(shiftTimeService.shiftTimeList());
}
@Operation(summary = "鎺掔彮鏃堕棿閰嶇疆鍒犻櫎")
- @PostMapping("remove")
+ @DeleteMapping("remove")
public Result<?> shiftTimeRemove(Long id) {
return Result.success(shiftTimeService.removeById(id));
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryAllDto.java b/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryAllDto.java
index 80e3494..4620382 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryAllDto.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryAllDto.java
@@ -1,7 +1,9 @@
package com.ruoyi.performance.dto;
import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@@ -12,6 +14,8 @@
* @Date 2024/10/25
*/
@Data
+@AllArgsConstructor
+@NoArgsConstructor
public class AuxiliaryAllDto {
@Schema(description = "浜ч噺宸ユ椂")
diff --git a/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryOriginalHoursLookDto.java b/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryOriginalHoursLookDto.java
index 3a4eead..2ab297e 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryOriginalHoursLookDto.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryOriginalHoursLookDto.java
@@ -23,4 +23,11 @@
@Schema(description = "缁撴潫鏃堕棿")
private String endDate;
+
+
+ @Schema(description = "杈呭姪宸ユ椂寮�濮嬫椂闂�")
+ private String assistBeginDate;
+
+ @Schema(description = "杈呭姪宸ユ椂缁撴潫鏃堕棿")
+ private String assistEndDate;
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryOutputWorkingHoursTemporaryDto.java b/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryOutputWorkingHoursTemporaryDto.java
new file mode 100644
index 0000000..669b3b9
--- /dev/null
+++ b/performance-server/src/main/java/com/ruoyi/performance/dto/AuxiliaryOutputWorkingHoursTemporaryDto.java
@@ -0,0 +1,20 @@
+package com.ruoyi.performance.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @Author zhuo
+ * @Date 2025/3/16
+ */
+@Data
+public class AuxiliaryOutputWorkingHoursTemporaryDto extends AuxiliaryOutputWorkingHoursTemporary {
+
+ @Schema(description = "妫�娴嬩汉")
+ private String name;
+
+ @Schema(description = "鐢电紗鏍囪瘑")
+ private String cableTag;
+}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryCorrectionHoursMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryCorrectionHoursMapper.java
index 96db341..d1f2978 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryCorrectionHoursMapper.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryCorrectionHoursMapper.java
@@ -20,7 +20,7 @@
*/
public interface AuxiliaryCorrectionHoursMapper extends BaseMapper<AuxiliaryCorrectionHours> {
- IPage<AuxiliaryCorrectionHoursDto> selectAuxiliaryCorrectionHours(Page page, @Param("ew") QueryWrapper<AuxiliaryCorrectionHoursDto> ew, @Param("ids") List<Long> ids);
+ IPage<AuxiliaryCorrectionHoursDto> selectAuxiliaryCorrectionHours(Page page, @Param("ew") QueryWrapper<AuxiliaryCorrectionHoursDto> ew, @Param("ids") List<Integer> ids);
List<Integer> selDepartLimsByName(String departLims);
diff --git a/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryOutputWorkingHoursMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryOutputWorkingHoursMapper.java
index a563f4a..b331be6 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryOutputWorkingHoursMapper.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryOutputWorkingHoursMapper.java
@@ -8,6 +8,7 @@
import com.ruoyi.performance.dto.AuxiliaryOriginalHoursLookDto;
import com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursDto;
import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
+import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -21,27 +22,28 @@
* @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
* @since 2024-05-28 03:48:48
*/
+@Mapper
public interface AuxiliaryOutputWorkingHoursMapper extends BaseMapper<AuxiliaryOutputWorkingHours> {
IPage<AuxiliaryOutputWorkingHoursDto> selectAuxiliaryOutputWorkingHours(Page page, @Param("ew") QueryWrapper<AuxiliaryOutputWorkingHoursDto> ew, @Param("ids") List<Long> ids);
//鏌ヨ缁熻宸ユ椂瀵煎嚭鏁版嵁
- List<AuxiliaryOutputWorkingHoursDto> selectDataByUser(@Param("ids") List<Long> ids);
+ List<AuxiliaryOutputWorkingHoursDto> selectDataByUser(@Param("ids") List<Integer> ids);
//鏌ヨ璇ユ湀鐨勪骇閲忓伐鏃�
- List<Map<String, Object>> totalHours(@Param("month") String month, @Param("ids") List<Long> ids, @Param("type") String type);
+ List<Map<String, Object>> totalHours(@Param("month") String month, @Param("ids") List<Integer> ids, @Param("type") String type);
- List<AuxiliaryOutputWorkingHours> selectListByIds(@Param("ids") List<Long> ids);
+ List<AuxiliaryOutputWorkingHours> selectListByIds(@Param("ids") List<Integer> ids);
- List<AuxiliaryOutputWorkingHours> selectLists(@Param("ew") QueryWrapper<AuxiliaryOutputWorkingHours> ew, @Param("ids") List<Long> ids);
+ List<AuxiliaryOutputWorkingHours> selectLists(@Param("ew") QueryWrapper<AuxiliaryOutputWorkingHours> ew, @Param("ids") List<Integer> ids);
/**
* 鏌ヨ
* @param dto
* @return
*/
- List<AuxiliaryAllDto> selectAuxiliaryAllByMonth(@Param("dto") AuxiliaryOriginalHoursLookDto dto, @Param("userIds") List<Long> userIds);
+ List<AuxiliaryAllDto> selectAuxiliaryAllByMonth(@Param("dto") AuxiliaryOriginalHoursLookDto dto, @Param("userIds") List<Integer> userIds);
/**
* 鏌ヨ杈呭姪宸ユ椂
@@ -49,7 +51,7 @@
* @param userIds
* @return
*/
- List<AuxiliaryAllDto> selectSubsidiaryAllByMonth(@Param("dto") AuxiliaryOriginalHoursLookDto dto, @Param("userIds") List<Long> userIds);
+ List<AuxiliaryAllDto> selectSubsidiaryAllByMonth(@Param("dto") AuxiliaryOriginalHoursLookDto dto, @Param("userIds") List<Integer> userIds);
- List<AuxiliaryOutputWorkingHoursDto> selectAuxiliaryOutputWorkingHoursList(@Param("ew") QueryWrapper<AuxiliaryOutputWorkingHoursDto> ew, @Param("ids") List<Long> ids);
+ List<AuxiliaryOutputWorkingHoursDto> selectAuxiliaryOutputWorkingHoursList(@Param("ew") QueryWrapper<AuxiliaryOutputWorkingHoursDto> ew, @Param("ids") List<Integer> ids);
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryOutputWorkingHoursTemporaryMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryOutputWorkingHoursTemporaryMapper.java
new file mode 100644
index 0000000..d90b522
--- /dev/null
+++ b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryOutputWorkingHoursTemporaryMapper.java
@@ -0,0 +1,26 @@
+package com.ruoyi.performance.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursTemporaryDto;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 宸ユ椂鏆傚瓨琛�
+ *
+ * @author zhuo
+ * @since 2025-02-27
+ */
+public interface AuxiliaryOutputWorkingHoursTemporaryMapper extends BaseMapper<AuxiliaryOutputWorkingHoursTemporary> {
+
+ /**
+ * 鏍规嵁璁㈠崟鏌ヨ宸ユ椂璇︽儏
+ * @param page
+ * @return
+ */
+ IPage<AuxiliaryOutputWorkingHoursTemporaryDto> getWorkingHoursByOrderId(Page page, @Param("ew") QueryWrapper<AuxiliaryOutputWorkingHoursTemporary> ew);
+}
+
diff --git a/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursDayMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursDayMapper.java
index 58d7e12..6dc4532 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursDayMapper.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursDayMapper.java
@@ -21,17 +21,17 @@
*/
public interface AuxiliaryWorkingHoursDayMapper extends BaseMapper<AuxiliaryWorkingHoursDay> {
- IPage<AuxiliaryWorkingHoursDayDto> selectAuxiliaryWorkingHoursDay(Page page, @Param("ew") QueryWrapper<AuxiliaryWorkingHoursDayDto> ew, @Param("ids") List<Long> ids);
+ IPage<AuxiliaryWorkingHoursDayDto> selectAuxiliaryWorkingHoursDay(Page page, @Param("ew") QueryWrapper<AuxiliaryWorkingHoursDayDto> ew, @Param("ids") List<Integer> ids);
//鏌ヨ杈呭姪宸ユ椂瀵煎嚭淇℃伅
- List<AuxiliaryWorkingHoursDayDto> selectDataByUser(@Param("ids") List<Long> ids);
+ List<AuxiliaryWorkingHoursDayDto> selectDataByUser(@Param("ids") List<Integer> ids);
- List<AuxiliaryWorkingHoursDay> selectListByIds(@Param("ids") List<Long> ids);
+ List<AuxiliaryWorkingHoursDay> selectListByIds(@Param("ids") List<Integer> ids);
//鏌ヨ璇ユ湀鐨勮緟鍔╁伐鏃�
- List<Map<String, Object>> totalHours(@Param("month") String month, @Param("ids") List<Long> ids);
+ List<Map<String, Object>> totalHours(@Param("month") String month, @Param("ids") List<Integer> ids);
- List<AuxiliaryWorkingHoursDay> selectLists(@Param("ew") QueryWrapper<AuxiliaryWorkingHoursDay> ew, @Param("ids") List<Long> ids);
+ List<AuxiliaryWorkingHoursDay> selectLists(@Param("ew") QueryWrapper<AuxiliaryWorkingHoursDay> ew, @Param("ids") List<Integer> ids);
/**
* 鏌ヨ杈呭姪宸ユ椂闆嗗悎
@@ -39,5 +39,5 @@
* @param ids
* @return
*/
- List<AuxiliaryWorkingHoursDayDto> selectAuxiliaryWorkingHoursDayList(@Param("ew") QueryWrapper<AuxiliaryWorkingHoursDayDto> ew, @Param("ids") List<Long> ids);
+ List<AuxiliaryWorkingHoursDayDto> selectAuxiliaryWorkingHoursDayList(@Param("ew") QueryWrapper<AuxiliaryWorkingHoursDayDto> ew, @Param("ids") List<Integer> ids);
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursMapper.java
index 46f2c6a..8e8e6e3 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursMapper.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursMapper.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.performance.pojo.AuxiliaryWorkingHours;
+import org.apache.ibatis.annotations.Param;
/**
* <p>
@@ -15,5 +16,13 @@
* @since 2024-05-09 06:58:31
*/
public interface AuxiliaryWorkingHoursMapper extends BaseMapper<AuxiliaryWorkingHours> {
- IPage<AuxiliaryWorkingHours> selectAuxiliaryWorkingHours(Page page, QueryWrapper<AuxiliaryWorkingHours> ew);
+ IPage<AuxiliaryWorkingHours> selectAuxiliaryWorkingHours(@Param("page") Page page, @Param("ew") QueryWrapper<AuxiliaryWorkingHours> ew);
+
+ /**
+ * 缁戝畾杈呭姪宸ユ椂閰嶇疆鐨勬棩宸ユ椂绠$悊鏁伴噺
+ *
+ * @param auxiliaryWorkingHoursId
+ * @return
+ */
+ int hourDayBindAuxiliaryCount(@Param("auxiliaryWorkingHoursId") Integer auxiliaryWorkingHoursId);
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java
index 091ad29..b339b4f 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java
@@ -5,7 +5,7 @@
import com.ruoyi.framework.mybatis_config.MyBaseMapper;
import com.ruoyi.performance.dto.PerformanceShiftMapDto;
import com.ruoyi.performance.pojo.PerformanceShift;
-import org.springframework.data.repository.query.Param;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@@ -31,11 +31,11 @@
@Param("userName") String userName,
@Param("laboratory") String laboratory);
- IPage<Map<String, Object>> performanceShiftYear(Page<Object> page, String time, String userName, String laboratory);
+ IPage<Map<String, Object>> performanceShiftYear(@Param("page") Page<Object> page, @Param("time") String time, @Param("userName") String userName, @Param("laboratory") String laboratory);
- List<Map<String, Object>> performanceShiftYearList(String time, String userName, String laboratory);
+ List<Map<String, Object>> performanceShiftYearList(@Param("time") String time, @Param("userName") String userName, @Param("laboratory") String laboratory);
- List<PerformanceShiftMapDto> performanceShiftList(String time, String userName, String laboratory);
+ List<PerformanceShiftMapDto> performanceShiftList(@Param("time") String time, @Param("userName") String userName, @Param("laboratory") String laboratory);
- String seldepLimsId(int depLimsId);
+ String seldepLimsId(@Param("depLimsId") int depLimsId);
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/pojo/AuxiliaryOutputWorkingHoursTemporary.java b/performance-server/src/main/java/com/ruoyi/performance/pojo/AuxiliaryOutputWorkingHoursTemporary.java
new file mode 100644
index 0000000..867c49c
--- /dev/null
+++ b/performance-server/src/main/java/com/ruoyi/performance/pojo/AuxiliaryOutputWorkingHoursTemporary.java
@@ -0,0 +1,116 @@
+package com.ruoyi.performance.pojo;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 宸ユ椂鏆傚瓨琛�
+ *
+ * @author zhuo
+ * @since 2025-02-27
+ */
+@Data
+@TableName("auxiliary_output_working_hours_temporary")
+public class AuxiliaryOutputWorkingHoursTemporary {
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @Schema(description = "妫�娴嬮」鍒嗙被")
+ @ExcelProperty(index = 2, value = "妫�娴嬮」鍒嗙被")
+ private String inspectionItemClass;
+
+ @Schema(description = "妫�娴嬮」")
+ @ExcelProperty(index = 3, value = "妫�娴嬮」")
+ private String inspectionItem;
+
+ @Schema(description = "妫�娴嬪瓙椤�")
+ @ExcelProperty(index = 4, value = "妫�娴嬪瓙椤�")
+ private String inspectionItemSubclass;
+
+ @Schema(description = "鏍峰搧id")
+ private Integer sampleId;
+
+ @Schema(description = "鏍峰搧缂栧彿")
+ @ExcelProperty(index = 6, value = "鏍峰搧缂栧彿")
+ private String sample;
+
+ @Schema(description = "鍔犵彮濮旀墭鍗曞彿")
+ private String overtimeOrderNo;
+
+ @Schema(description = "鍔犵彮宸ユ椂")
+ private BigDecimal overtimeWorkTime;
+
+ @Schema(description = "鍔犵彮鏁伴噺")
+ private Integer overtimeAmount;
+
+ @Schema(description = "闈炲姞鐝鎵樺崟鍙�")
+ private Integer orderId;
+
+ @Schema(description = "濮旀墭鍗曞彿")
+ @ExcelProperty(index = 5, value = "濮旀墭鍗曞彿")
+ private String orderNo;
+
+ @Schema(description = "宸ユ椂")
+ private BigDecimal workTime;
+
+ @Schema(description = "鏁伴噺")
+ private Integer amount;
+
+ @Schema(description = "浜ч噺宸ユ椂")
+ @ExcelProperty(index = 7, value = "浜ч噺宸ユ椂")
+ private BigDecimal outputWorkTime;
+
+ @Schema(description = "鏃ユ湡")
+ @ExcelProperty(index = 10, value = "鏃ユ湡")
+ private String dateTime;
+
+ @Schema(description = "鍛ㄦ")
+ @ExcelProperty(index = 11, value = "鍛ㄦ")
+ private String week;
+
+ @Schema(description = "鏄熸湡")
+ @ExcelProperty(index = 12, value = "鏄熸湡")
+ private String weekDay;
+
+ @Schema(description = "妫�娴嬩汉id")
+ @TableField("`check`")
+ private Integer check;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @Schema(description = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ @Schema(description = "鍒涘缓浜篿d")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @Schema(description = "淇敼浜篿d")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @Schema(description = "宸ユ椂鍒嗙粍")
+ @ExcelProperty(index = 8, value = "宸ユ椂鍒嗙粍")
+ private String manHourGroup;
+
+ @Schema(description = "鍗曚环")
+ @ExcelProperty(index = 9, value = "鍗曚环")
+ private BigDecimal price;
+
+ @Schema(description = "妫�楠岄」id")
+ private Integer insProductId;
+}
+
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/AuxiliaryOutputWorkingHoursTemporaryService.java b/performance-server/src/main/java/com/ruoyi/performance/service/AuxiliaryOutputWorkingHoursTemporaryService.java
new file mode 100644
index 0000000..e11b75a
--- /dev/null
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/AuxiliaryOutputWorkingHoursTemporaryService.java
@@ -0,0 +1,25 @@
+package com.ruoyi.performance.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursTemporaryDto;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary;
+
+/**
+ * 宸ユ椂鏆傚瓨琛�
+ *
+ * @author zhuo
+ * @since 2025-02-27
+ */
+public interface AuxiliaryOutputWorkingHoursTemporaryService extends IService<AuxiliaryOutputWorkingHoursTemporary> {
+
+ /**
+ * 鏍规嵁璁㈠崟鏌ヨ宸ユ椂璇︽儏
+ * @param page
+ * @param workingHoursTemporary
+ * @return
+ */
+ IPage<AuxiliaryOutputWorkingHoursTemporaryDto> getWorkingHoursByOrderId(Page page, AuxiliaryOutputWorkingHoursTemporaryDto workingHoursTemporary);
+}
+
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryCorrectionHoursServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryCorrectionHoursServiceImpl.java
index 20a72b8..ef2c1a9 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryCorrectionHoursServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryCorrectionHoursServiceImpl.java
@@ -45,7 +45,7 @@
@Override
public IPage<AuxiliaryCorrectionHoursDto> selectAuxiliaryCorrectionHours(Page page, AuxiliaryCorrectionHoursDto auxiliaryCorrectionHoursDto) {
- List<Long> ids = new ArrayList<>();
+ List<Integer> ids = new ArrayList<>();
String departLims = auxiliaryCorrectionHoursDto.getDepartLims();
auxiliaryCorrectionHoursDto.setDepartLims(null);
if (ObjectUtils.isNotEmpty(departLims)) {
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOriginalHoursServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOriginalHoursServiceImpl.java
index 129e837..caad150 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOriginalHoursServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOriginalHoursServiceImpl.java
@@ -58,7 +58,7 @@
@Override
public IPage<AuxiliaryOriginalHoursDto> selectAuxiliaryOriginalHours(Page page, AuxiliaryOriginalHoursLookDto auxiliaryOriginalHoursLookDto) {
- List<Long> ids = new ArrayList<>();
+ List<Integer> ids = new ArrayList<>();
String departLims = auxiliaryOriginalHoursLookDto.getDepartLims();
auxiliaryOriginalHoursLookDto.setDepartLims(null);
String name = auxiliaryOriginalHoursLookDto.getName();
@@ -207,7 +207,7 @@
if (StringUtils.isBlank(dto.getMonth())) {
throw new BaseException("缂哄皯鏈堜唤");
}
- List<Long> userIds = new ArrayList<>();
+ List<Integer> userIds = new ArrayList<>();
String name = dto.getName();
if (ObjectUtils.isNotEmpty(name)) {
@@ -226,10 +226,10 @@
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String beginDate = previousMonth26th.atStartOfDay().format(outputFormatter);
String endDate = currentMonth25th.atStartOfDay().format(outputFormatter);
-// dto.setBeginDate(beginDate + " 00:00:00");
-// dto.setEndDate(endDate + " 23:59:59");
- dto.setBeginDate(beginDate);
- dto.setEndDate(endDate);
+ dto.setBeginDate(beginDate + " 00:00:00");
+ dto.setEndDate(endDate + " 23:59:59");
+ dto.setAssistBeginDate(beginDate);
+ dto.setAssistEndDate(endDate);
// 鏌ヨ浜ч噺宸ユ椂
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java
index 5b313c6..2cb906e 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java
@@ -106,7 +106,7 @@
public Map<String, Object> collectWorkingHours(AuxiliaryOutputWorkingHoursDto auxiliaryOutputWorkingHoursDto) {
AuxiliaryOutputWorkingHours outputWorkingHours = new AuxiliaryOutputWorkingHours();
AuxiliaryWorkingHoursDay workingHoursDay = new AuxiliaryWorkingHoursDay();
- List<Long> ids = new ArrayList<>();
+ List<Integer> ids = new ArrayList<>();
if (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHoursDto.getWeekDay())){
outputWorkingHours.setWeekDay(auxiliaryOutputWorkingHoursDto.getWeekDay());
workingHoursDay.setWeekDay(auxiliaryOutputWorkingHoursDto.getWeekDay());
@@ -172,7 +172,7 @@
public void exportWorkingHours(HttpServletResponse response) throws IOException {
List<AuxiliaryOutputWorkingHoursDto> auxiliaryOutputWorkingHoursDtos = new ArrayList<>();
List<AuxiliaryWorkingHoursDayDto> auxiliaryWorkingHoursDayDtos = new ArrayList<>();
- List<Long> ids = new ArrayList<>();
+ List<Integer> ids = new ArrayList<>();
//鏌ヨ杈呭姪宸ユ椂
auxiliaryWorkingHoursDayDtos = auxiliaryWorkingHoursDayMapper.selectDataByUser(ids);
//鏌ヨ缁熻宸ユ椂
@@ -210,7 +210,7 @@
auxiliaryOutputWorkingHoursDto.setDateTime(null);
auxiliaryOutputWorkingHoursDto.setWeek(null);
- List<Long> ids = new ArrayList<>();
+ List<Integer> ids = new ArrayList<>();
String name = auxiliaryOutputWorkingHoursDto.getName();
if (ObjectUtils.isNotEmpty(name)) {
ids.addAll(userMapper.selectList(Wrappers.<User>lambdaQuery().like(User::getName, name)).stream().map(User::getId).collect(Collectors.toList()));
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOutputWorkingHoursTemporaryServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOutputWorkingHoursTemporaryServiceImpl.java
new file mode 100644
index 0000000..776e934
--- /dev/null
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryOutputWorkingHoursTemporaryServiceImpl.java
@@ -0,0 +1,33 @@
+package com.ruoyi.performance.service.impl;
+
+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.common.utils.QueryWrappers;
+import com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursTemporaryDto;
+import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursTemporaryMapper;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary;
+import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 宸ユ椂鏆傚瓨琛�
+ *
+ * @author zhuo
+ * @since 2025-02-27
+ */
+@Service
+public class AuxiliaryOutputWorkingHoursTemporaryServiceImpl extends ServiceImpl<AuxiliaryOutputWorkingHoursTemporaryMapper, AuxiliaryOutputWorkingHoursTemporary> implements AuxiliaryOutputWorkingHoursTemporaryService {
+
+ /**
+ * 鏍规嵁璁㈠崟鏌ヨ宸ユ椂璇︽儏
+ * @param page
+ * @param workingHoursTemporary
+ * @return
+ */
+ @Override
+ public IPage<AuxiliaryOutputWorkingHoursTemporaryDto> getWorkingHoursByOrderId(Page page, AuxiliaryOutputWorkingHoursTemporaryDto workingHoursTemporary) {
+ return baseMapper.getWorkingHoursByOrderId(page, QueryWrappers.queryWrappers(workingHoursTemporary));
+ }
+}
+
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java
index d293c30..331d0de 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java
@@ -68,7 +68,7 @@
auxiliaryWorkingHoursDayDto.setDateTime(null);
auxiliaryWorkingHoursDayDto.setWeek(null);
Map<String, Object> map = new HashMap<>();
- List<Long> ids = new ArrayList<>();
+ List<Integer> ids = new ArrayList<>();
if (ids.size() == 0) {
ids = null;
}
@@ -104,7 +104,7 @@
} else {
IPage<AuxiliaryWorkingHoursDayDto> auxiliaryWorkingHoursDayDtoIPage = auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto), ids);
for (AuxiliaryWorkingHoursDayDto record : auxiliaryWorkingHoursDayDtoIPage.getRecords()) {
- record.setDateTime(record.getDateTime().substring(0, 10));
+ record.setDateTime(ObjectUtils.isEmpty(record.getDateTime())? null : record.getDateTime().substring(0, 10));
}
return auxiliaryWorkingHoursDayDtoIPage;
}
@@ -151,8 +151,8 @@
//缂栬緫
@Override
public int updateAuxiliaryWorkingHoursDay(AuxiliaryWorkingHoursDay auxiliaryWorkingHoursDay) {
- Integer userId = SecurityUtils.getUserId().intValue();
- auxiliaryWorkingHoursDay.setNameUser(userId);//濮撳悕id
+// Integer userId = SecurityUtils.getUserId().intValue();
+// auxiliaryWorkingHoursDay.setNameUser(userId);//濮撳悕id
return auxiliaryWorkingHoursDayMapper.updateById(auxiliaryWorkingHoursDay);
}
@@ -184,7 +184,7 @@
String week = auxiliaryWorkingHoursDayDto.getWeek();
auxiliaryWorkingHoursDayDto.setDateTime(null);
auxiliaryWorkingHoursDayDto.setWeek(null);
- List<Long> ids = new ArrayList<>();
+ List<Integer> ids = new ArrayList<>();
String name = auxiliaryWorkingHoursDayDto.getName();
if (ObjectUtils.isNotEmpty(name)) {
ids.addAll(userMapper.selectList(Wrappers.<User>lambdaQuery().like(User::getName, name)).stream().map(User::getId).collect(Collectors.toList()));
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursServiceImpl.java
index 46428af..40f5daf 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/impl/AuxiliaryWorkingHoursServiceImpl.java
@@ -35,6 +35,11 @@
@Override
public int deleteAuxiliaryWorkingHours(Integer id) {
+ // 鍒ゆ柇鏃ュ伐鏃剁鐞嗕腑鏄惁宸茬粦瀹氬緟鍒犻櫎杈呭姪宸ユ椂閰嶇疆
+ int count = auxiliaryWorkingHoursMapper.hourDayBindAuxiliaryCount(id);
+ if(count > 0){
+ throw new RuntimeException("宸插湪鏃ュ伐鏃剁鐞嗕腑缁戝畾锛岀姝㈠垹闄わ紒");
+ }
return auxiliaryWorkingHoursMapper.deleteById(id);
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/utils/CustomerDoubleSerialize.java b/performance-server/src/main/java/com/ruoyi/performance/utils/CustomerDoubleSerialize.java
new file mode 100644
index 0000000..576ae14
--- /dev/null
+++ b/performance-server/src/main/java/com/ruoyi/performance/utils/CustomerDoubleSerialize.java
@@ -0,0 +1,26 @@
+package com.ruoyi.performance.utils;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+import java.io.IOException;
+import java.text.DecimalFormat;
+
+public class CustomerDoubleSerialize extends JsonSerializer {
+ private DecimalFormat df = new DecimalFormat("0.0000");
+
+ @Override
+ public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
+ if(o.toString() != null && !o.toString().equals("0.0")) {
+ Double dd=Double.parseDouble(o.toString());
+ jsonGenerator.writeString(df.format(dd));
+ } else{
+ if(o.toString().equals("0.0")) {
+ jsonGenerator.writeString("0");
+ } else {
+ jsonGenerator.writeString(o.toString());
+ }
+ }
+ }
+}
diff --git a/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml b/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml
index 9229c98..a82faab 100644
--- a/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml
+++ b/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml
@@ -45,7 +45,8 @@
aowh.sample,
aowh.price,
aowh.man_hour_group,
- ip.cable_tag
+ ip.cable_tag,
+ aowh.create_time
FROM auxiliary_output_working_hours aowh
left join ins_product ip on ip.id = aowh.ins_product_id
left join user on user.id=aowh.`check`
@@ -60,6 +61,7 @@
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
+ order by create_time desc
</sql>
<select id="selectAuxiliaryOutputWorkingHours" resultType="com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursDto">
<include refid="selectAuxiliaryOutputWorking"/>
@@ -142,16 +144,16 @@
u.name userName,
aowh.`check` userId,
#{dto.month} month
- from (SELECT *
- FROM auxiliary_output_working_hours
- GROUP BY CASE
- WHEN man_hour_group IS NOT NULL AND man_hour_group != '' THEN man_hour_group
- ELSE id
- END
- , CASE
- WHEN man_hour_group IS NOT NULL AND man_hour_group != '' THEN order_id
- ELSE id
- END) aowh
+ from (SELECT ao.*, ip.cable_tag
+ FROM auxiliary_output_working_hours ao
+ left join ins_product ip on ip.id = ao.ins_product_id
+ GROUP BY CASE
+ WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ao.man_hour_group
+ ELSE ao.id END,
+ CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ao.sample_id ELSE ao.id END,
+ CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ip.radius ELSE ao.id END,
+ CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ip.cable_tag ELSE ao.id END,
+ CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ao.order_id ELSE ao.id END) aowh
left join user u on u.id = aowh.`check`
where aowh.date_time between #{dto.beginDate} and #{dto.endDate}
<if test="userIds !=null and userIds.size() > 0">
@@ -169,7 +171,7 @@
#{dto.month} month
from auxiliary_working_hours_day awhd
left join user u on u.id = awhd.name_user
- where awhd.date_time between #{dto.beginDate} and #{dto.endDate}
+ where awhd.date_time between #{dto.assistBeginDate} and #{dto.assistEndDate}
and awhd.state = '宸叉壒鍑�'
<if test="userIds !=null and userIds.size() > 0">
and awhd.name_user in
diff --git a/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursTemporaryMapper.xml b/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursTemporaryMapper.xml
new file mode 100644
index 0000000..e6bec02
--- /dev/null
+++ b/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursTemporaryMapper.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursTemporaryMapper">
+
+ <!-- 鏍规嵁璁㈠崟鏌ヨ宸ユ椂璇︽儏 -->
+
+ <select id="getWorkingHoursByOrderId"
+ resultType="com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursTemporaryDto">
+ select *
+ from (select aowh.*,
+ user.name,
+ ip.cable_tag
+ FROM auxiliary_output_working_hours_temporary aowh
+ left join ins_product ip on ip.id = aowh.ins_product_id
+ left join user on user.id=aowh.`check`) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+</mapper>
diff --git a/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml b/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml
index 48e6bb2..48ee262 100644
--- a/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml
+++ b/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml
@@ -43,6 +43,7 @@
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
+ order by create_time desc
</sql>
<select id="selectAuxiliaryWorkingHoursDay" resultType="com.ruoyi.performance.dto.AuxiliaryWorkingHoursDayDto">
@@ -62,7 +63,7 @@
</select>
<select id="selectListByIds" resultType="com.ruoyi.performance.pojo.AuxiliaryWorkingHoursDay">
select * from auxiliary_working_hours_day
- where state='宸插鏍�'
+ where state='宸叉壒鍑�'
<if test="ids !=null and ids != ''">
and name_user in
<foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
diff --git a/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursMapper.xml b/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursMapper.xml
index 0c4fd2c..1ff785f 100644
--- a/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursMapper.xml
+++ b/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursMapper.xml
@@ -35,4 +35,13 @@
${ew.customSqlSegment}
</if>
</select>
+
+ <select id="hourDayBindAuxiliaryCount">
+ SELECT
+ COUNT(*)
+ FROM
+ auxiliary_working_hours_day T1
+ LEFT JOIN auxiliary_working_hours T2 ON T1.number = T2.number
+ WHERE T2.id = #{auxiliaryWorkingHoursId}
+ </select>
</mapper>
diff --git a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
index 751ca1a..56bd55b 100644
--- a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
+++ b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -11,13 +11,14 @@
<select id="performanceShiftPage" resultMap="performanceShiftPageMap">
SELECT
- if(u2.department is not null and u2.department != '', CONCAT(u2.name, '锛�', u2.department, '锛�'), u2.name) name,
+ u2.name name,
GROUP_CONCAT(s.work_time, '锛�', s.shift, '锛�', s.id order by s.work_time SEPARATOR ';') AS shift_time, u2.id user_id
FROM performance_shift s
LEFT JOIN (SELECT distinct u.* from
user u
left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id)
- where state=1
+ where status = '0'
+ and del_flag = '0'
<if test="laboratory != null and laboratory != ''">
and dl.name=#{laboratory}
</if>
@@ -31,8 +32,8 @@
and u2.name like concat('%', #{userName}, '%')
</if>
</where>
- order by s.create_time
GROUP BY u2.id
+ order by s.create_time
</select>
<select id="performanceShiftYearPage" resultType="map">
@@ -42,7 +43,8 @@
LEFT JOIN (SELECT u.* from
user u
left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id)
- where state=1
+ where status = '0'
+ and del_flag = '0'
<if test="laboratory != null and laboratory != ''">
and dl.name=#{laboratory}
</if>
@@ -60,7 +62,8 @@
</select>
<select id="performanceShiftYear" resultType="java.util.Map">
- SELECT if(u2.department is not null and u2.department != '', CONCAT(u2.name, '锛�', u2.department, '锛�'), u2.name) name,
+ SELECT
+ u2.name name,
s.user_id, u2.account,
DATE_FORMAT(s.work_time, '%c') work_time,
GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), '锛�', s.shift order by s.work_time SEPARATOR ';') month_str
@@ -68,7 +71,8 @@
LEFT JOIN (SELECT u.* from
user u
left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id)
- where state=1
+ where status = '0'
+ and del_flag = '0'
<if test="laboratory != null and laboratory != ''">
and dl.name=#{laboratory}
</if>
@@ -87,7 +91,8 @@
</select>
<select id="performanceShiftYearList" resultType="map">
- SELECT if(u.department is not null and u.department != '', CONCAT(u.name, '锛�', u.department, '锛�'), u.name) name,
+ SELECT
+ u.name name,
s.user_id, u.account,
DATE_FORMAT(s.work_time, '%c') work_time,
GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), '锛�', s.shift order by s.work_time SEPARATOR ';') month_str
@@ -109,8 +114,8 @@
<select id="performanceShiftList" resultMap="performanceShiftPageMap">
SELECT
- if(u.department is not null and u.department != '', CONCAT(u.name, '锛�', u.department, '锛�'), u.name) name,
- GROUP_CONCAT(s.work_time, '锛�', s.shift, '锛�', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id, u.department
+ u.name name,
+ GROUP_CONCAT(s.work_time, '锛�', s.shift, '锛�', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id
FROM performance_shift s
LEFT JOIN user u on u.id = s.user_id
<where>
@@ -123,8 +128,8 @@
<if test="laboratory != null and laboratory != ''">
</if>
</where>
- order by s.create_time
GROUP BY u.id
+ order by s.create_time
</select>
<select id="seldepLimsId" resultType="java.lang.String">
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java
index 2f978e5..5e41ee2 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java
@@ -18,10 +18,10 @@
@Schema(description = "涓婚敭")
@TableId(type = IdType.AUTO)
- private Long id;
+ private Integer id;
@Schema(description = "閮ㄩ棬ID")
- private Long deptId;
+ private Integer deptId;
@Schema(description = "鐢ㄦ埛璐﹀彿")
private String account;
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/QueryWrappers.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/QueryWrappers.java
index 0878afb..9c46a62 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/QueryWrappers.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/QueryWrappers.java
@@ -41,7 +41,6 @@
e.printStackTrace();
throw new RuntimeException("鏌ヨ鏉′欢鐢熸垚閿欒");
}
-// System.out.println(field.getName() + "|" + (value == null || value.equals("")) + "|" + value);
if(value == null || value.equals("")){
continue;
}
@@ -52,8 +51,10 @@
if (!field.getName().equals("orderBy")) {
if(value.getClass()== LocalDateTime.class){
wrapper.like(StrUtil.toUnderlineCase(field.getName()), ((LocalDateTime) value).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
- }else{
+ }else if(value.getClass()== String.class){
wrapper.like(StrUtil.toUnderlineCase(field.getName()), value);
+ }else{
+ wrapper.eq(StrUtil.toUnderlineCase(field.getName()), value);
}
} else {
Map<String, String> map = (Map<String, String>) value;
@@ -62,7 +63,6 @@
}
}
}
-// System.out.println(wrapper.getExpression().getSqlSegment());
return wrapper;
}
}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/exception/ErrorException.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/exception/ErrorException.java
new file mode 100644
index 0000000..4a39760
--- /dev/null
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/exception/ErrorException.java
@@ -0,0 +1,9 @@
+package com.ruoyi.framework.exception;
+
+public class ErrorException extends RuntimeException{
+
+ public ErrorException(String msg){
+ super(msg);
+ }
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
index 3479c57..c160b3c 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
@@ -1,6 +1,7 @@
package com.ruoyi.system.mapper;
import java.util.List;
+import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysDictType;
/**
@@ -88,4 +89,13 @@
* @return 瀛楀吀绫诲瀷闆嗗悎淇℃伅
*/
public List<SysDictType> selectList(String dictName);
+
+ /**
+ * 鏍规嵁瀛楀吀绫诲瀷, 瀛楀吀鍊兼煡璇abel鍐呭
+ *
+ * @param dictType 瀛楀吀绫诲瀷
+ * @param dictValue 瀛楀吀鍊�
+ * @return 缁撴灉
+ */
+ public String selectLabelByDict(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java
index 0f3eafd..210f2f9 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java
@@ -1,7 +1,13 @@
package com.ruoyi.system.mapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.system.domain.vo.UserVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
/**
* 鐢ㄦ埛淇℃伅琛�
@@ -11,5 +17,48 @@
*/
public interface UserMapper extends BaseMapper<User> {
+ /**
+ * 鏍规嵁鏉′欢鑾峰彇鐢ㄦ埛鍒楄〃
+ * @param ew
+ * @param type
+ * @return
+ */
+ List<User> selectUserCondition(@Param("ew") QueryWrapper<User> ew, @Param("type") String type);
+
+ /**
+ * 鑾峰彇鐢ㄦ埛閮ㄩ棬
+ * @param userId
+ * @return
+ */
+ String selectUserDepartmentLimsName(@Param("userId") Integer userId);
+
+ /**
+ * 鏌ヨ鐢ㄦ埛鍜岄儴闂�
+ * @param participant
+ * @return
+ */
+ List<Map<String, String>> selectNameAnddepartment(@Param("participant") String participant);
+
+ /**
+ * 鑾峰彇褰撳墠鐧诲綍鐨勫鎴蜂俊鎭�
+ * @param userId
+ * @return
+ */
+ UserVo getUserNow(@Param("userId") int userId);
+
+ /**
+ * 鑾峰彇妫�娴嬩汉鍛樹俊鎭�
+ * @return
+ */
+ List<User> selectQualityUserList();
+
+ /**
+ * 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛閮ㄩ棬涓嬬殑鎵�鏈夌敤鎴�
+ * @param userId
+ * @return
+ */
+ List<User> selectDepartmentLimsUserList(@Param("userId") Integer userId);
+
+
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java
index 921bff6..29915d6 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java
@@ -103,4 +103,13 @@
* @return 缁撴灉
*/
public boolean checkDictTypeUnique(SysDictType dictType);
+
+ /**
+ * 鏍规嵁瀛楀吀绫诲瀷, 瀛楀吀鍊兼煡璇abel鍐呭
+ *
+ * @param dictType 瀛楀吀绫诲瀷
+ * @param dictValue 瀛楀吀鍊�
+ * @return 缁撴灉
+ */
+ public String selectLabelByDict(String dictType, String dictValue);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java
index b073d56..89e6074 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.system.domain.vo.UserVo;
+
+import java.util.List;
/**
* 鐢ㄦ埛淇℃伅琛�
@@ -11,5 +14,40 @@
*/
public interface UserService extends IService<User> {
+
+ /**
+ * 鏍规嵁鏉′欢鑾峰彇鐢ㄦ埛鍒楄〃
+ * @param user
+ * @param type
+ * @return
+ */
+ List<User> selectUserCondition(User user, String type);
+
+ /**
+ * 鑾峰彇褰撳墠鐧诲綍鐨勫鎴蜂俊鎭�
+ * @return
+ */
+ UserVo getUserNow();
+
+ /**
+ * 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛閮ㄩ棬
+ * @return
+ */
+ String selectUserDepartmentLimsName();
+
+ /**
+ * 淇敼浜哄憳鏄庣粏鎵�鍦ㄧ粍缁囨灦鏋�
+ * @param ids
+ * @param id
+ * @return
+ */
+ int upUserDepardLimsId(String ids, String id);
+
+ /**
+ * 鍒犻櫎浜哄憳鏄庣粏鎵�鍦ㄧ粍缁囨灦鏋�
+ * @param id
+ * @return
+ */
+ int delUserDepardLimsId(Integer id);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
index 8ae23bd..3e91737 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
@@ -233,4 +233,17 @@
}
return UserConstants.UNIQUE;
}
+
+ /**
+ * 鏍规嵁瀛楀吀绫诲瀷, 瀛楀吀鍊兼煡璇abel鍐呭
+ *
+ * @param dictType 瀛楀吀绫诲瀷
+ * @param dictValue 瀛楀吀鍊�
+ * @return 缁撴灉
+ */
+ @Override
+ public String selectLabelByDict(String dictType, String dictValue)
+ {
+ return dictTypeMapper.selectLabelByDict(dictType, dictValue);
+ }
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java
index acc052e..71fe3b3 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java
@@ -1,10 +1,19 @@
package com.ruoyi.system.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.vo.UserVo;
import com.ruoyi.system.mapper.UserMapper;
import com.ruoyi.system.service.UserService;
import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.List;
/**
* 鐢ㄦ埛淇℃伅琛�
@@ -15,5 +24,68 @@
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
+ /**
+ * 鏍规嵁鏉′欢鑾峰彇鐢ㄦ埛鍒楄〃
+ * * todo: type : 1: 鑾峰彇妫�娴嬩汉鍛樹俊鎭�
+ * type : 2: 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛閮ㄩ棬涓嬬殑鎵�鏈夌敤鎴�
+ * @param user
+ * @param type
+ * @return
+ */
+ @Override
+ public List<User> selectUserCondition(User user, String type) {
+ if (StringUtils.isNotEmpty(type)) {
+
+ switch (type) {
+ case "1":
+ return baseMapper.selectQualityUserList();
+ case "2":
+ return baseMapper.selectDepartmentLimsUserList(SecurityUtils.getUserId().intValue());
+ }
+
+ }
+
+ return baseMapper.selectUserCondition(QueryWrappers.queryWrappers(user), type);
+ }
+
+ /**
+ * 鑾峰彇褰撳墠鐧诲綍鐨勫鎴蜂俊鎭�
+ * @return
+ */
+ @Override
+ public UserVo getUserNow() {
+ return baseMapper.getUserNow(SecurityUtils.getUserId().intValue());
+ }
+
+ /**
+ * 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛閮ㄩ棬
+ * @return
+ */
+ @Override
+ public String selectUserDepartmentLimsName() {
+ return baseMapper.selectUserDepartmentLimsName(SecurityUtils.getUserId().intValue());
+ }
+
+ /**
+ * 淇敼浜哄憳鏄庣粏鎵�鍦ㄧ粍缁囨灦鏋�
+ * @param ids
+ * @param id
+ * @return
+ */
+ @Override
+ public int upUserDepardLimsId(String ids, String id) {
+ List<Integer> userIds = JSON.parseArray(ids, Integer.class);
+ return baseMapper.update(null, Wrappers.<User>lambdaUpdate().in(User::getId, userIds).set(User::getDepartLimsId, id).set(User::getUpdateTime, LocalDateTime.now()).set(User::getUpdateBy, SecurityUtils.getLoginUser().getUsername()));
+ }
+
+ /**
+ * 鍒犻櫎浜哄憳鏄庣粏鎵�鍦ㄧ粍缁囨灦鏋�
+ * @param id
+ * @return
+ */
+ @Override
+ public int delUserDepardLimsId(Integer id) {
+ return baseMapper.update(null, Wrappers.<User>lambdaUpdate().eq(User::getId, id).set(User::getDepartLimsId, null).set(User::getUpdateTime, LocalDateTime.now()).set(User::getUpdateBy, SecurityUtils.getUsername()));
+ }
}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
index c030479..6ed730a 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
@@ -107,4 +107,11 @@
where dict_name = #{dictName}
</select>
+ <select id="selectLabelByDict" resultType="java.lang.String">
+ select dict_label
+ from sys_dict_data
+ where dict_type = #{dictType}
+ and dict_value = #{dictValue}
+ </select>
+
</mapper>
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml
new file mode 100644
index 0000000..e3a4e6e
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.system.mapper.UserMapper">
+
+ <!--鏍规嵁鏉′欢鑾峰彇鐢ㄦ埛鍒楄〃-->
+ <select id="selectUserCondition" resultType="com.ruoyi.common.core.domain.entity.User">
+ select * from (select id,
+ dept_id,
+ account,
+ name,
+ name_en,
+ user_type,
+ email,
+ phone,
+ sex,
+ age,
+ signature_url,
+ picture_url,
+ status,
+ del_flag,
+ login_ip,
+ login_date,
+ depart_lims_id,
+ company,
+ is_custom
+ from user
+ where del_flag = '0'
+ and id != 1) a
+ <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+ ${ew.customSqlSegment}
+ </if>
+ </select>
+
+ <!-- 鑾峰彇鐢ㄦ埛閮ㄩ棬 -->
+ <select id="selectUserDepartmentLimsName" resultType="java.lang.String">
+ select dl.name
+ from user u
+ left join department_lims dl on find_in_set(dl.id, u.depart_lims_id) and dl.id != 1
+ where u.id = #{userId}
+ limit 1
+ </select>
+
+ <!-- 鏌ヨ鐢ㄦ埛鍜岄儴闂� -->
+ <select id="selectNameAnddepartment" resultType="java.util.Map">
+ select u.name userName,
+ dl.name department
+ from user u
+ left join department_lims dl on find_in_set(dl.id, u.depart_lims_id) and dl.id != 1
+ where find_in_set(u.id, #{participant})
+ </select>
+
+ <!-- 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅 -->
+ <select id="getUserNow" resultType="com.ruoyi.system.domain.vo.UserVo">
+ select u.id,
+ c.company,
+ u.name,
+ c.code,
+ u.phone,
+ c.id departId
+ from user u
+ left join custom c on u.company = c.id
+ where u.id = #{userId}
+ </select>
+
+ <!-- 鑾峰彇妫�娴嬩汉鍛樹俊鎭� -->
+ <select id="selectQualityUserList" resultType="com.ruoyi.common.core.domain.entity.User">
+ select u1.id,
+ u1.account,
+ u1.name,
+ u1.age,
+ u1.email,
+ u1.phone,
+ u1.company,
+ u1.is_custom,
+ u1.signature_url,
+ u1.picture_url,
+ u1.name_en,
+ u1.depart_lims_id
+ from user u1
+ left join sys_user_role sur on sur.user_id = u1.id
+ where sur.role_id not in (1, 15, 16, 17)
+ and u1.status = '0'
+ group by u1.id
+ </select>
+
+ <!-- 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛閮ㄩ棬涓嬬殑鎵�鏈夌敤鎴� -->
+ <select id="selectDepartmentLimsUserList" resultType="com.ruoyi.common.core.domain.entity.User">
+ select id,
+ account,
+ name,
+ name_en,
+ status
+ from user u
+ where depart_lims_id is not null
+ and depart_lims_id != ''
+ and depart_lims_id = (select u2.depart_lims_id
+ from user u2
+ where u2.id = #{userId})
+ </select>
+
+</mapper>
--
Gitblit v1.9.3