zhuo
2025-02-17 9733594dd881627b4c00665e6f9bfbf08c1cacec
业务管理移植
已修改18个文件
已添加63个文件
7834 ■■■■ 文件已修改
basic-server/src/main/java/com/ruoyi/basic/pojo/Laboratory.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/SealMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java 636 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanDTO.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductBindingDto.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/OmitOrderProductDto.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/ProductResultDto2.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductExportDto.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductRawAnalysisDto.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderStateMapper.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductUserMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsReportMapper.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleMapper.java 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestProductMapper.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/SpotCheckQuarterItemMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderDeviceRecord.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerify.java 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFactoryVerifyItem.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFile.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderState.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplate.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductUser.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsReport.java 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsSampleUser.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnPass.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandler.java 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandlerFile.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedRetestResult.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarter.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckQuarterItem.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYear.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/SpotCheckYearItem.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductService.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/InsReportService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java 1050 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java 1174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java 1708 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/DeviationAnalyzeVo.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanTaskSwitchVo.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPrintingVo.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/ProductVo.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/RawMaterialSupplierVo.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/RawProductAnalysisVo.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsChildrenVo.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleDefectsFatherVo.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/SampleVo.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/vo/UnqualifiedHandlerVO.java 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/factory_verify.docx 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/report-template.docx 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/small-report-template.docx 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/spot_check_quarter.docx 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/spot_check_year.docx 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryCorrectionHoursController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOriginalHoursController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOutputWorkingHoursController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursDayController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/ShiftTimeController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/mapper/AuxiliaryWorkingHoursMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/constant/InsOrderTypeConstants.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/properties/IfsProperties.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/properties/WechatProperty.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/Base64.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/IfsApiUtils.java 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/IndustryChainUtils.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/LimsDateUtil.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/Laboratory.java
@@ -44,6 +44,7 @@
    private Integer createUser;
    @ApiModelProperty(value = "创建人")
    @TableField(select = false,exist = false)
    private String createUserName;
    @ApiModelProperty(value = "修改人id")
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>
inspect-server/pom.xml
@@ -36,6 +36,12 @@
            <artifactId>ruoyi-system</artifactId>
        </dependency>
        <!-- ç»©æ•ˆæœ¨å— -->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>performance-server</artifactId>
        </dependency>
        <!-- poi-tl包生成报告 -->
        <dependency>
            <groupId>com.deepoove</groupId>
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java
@@ -5,6 +5,11 @@
//import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
//import com.ruoyi.common.core.domain.Result;
//import com.ruoyi.inspect.dto.OmitOrderProductDto;
//import com.ruoyi.inspect.dto.SampleOrderDto;
//import com.ruoyi.inspect.service.InsOrderService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java
@@ -1,319 +1,317 @@
package com.ruoyi.inspect.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.*;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import com.ruoyi.inspect.dto.SampleProductDto;
import com.ruoyi.inspect.pojo.InsOrder;
import com.ruoyi.inspect.pojo.RawMaterialOrderTemplate;
import com.ruoyi.inspect.service.RawMaterialOrderService;
import com.ruoyi.inspect.service.RawMaterialOrderTemplateService;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.utils.JackSonUtil;
import com.ruoyi.common.utils.WxCpUtils;
import com.ruoyi.inspect.dto.CopperInsOrderDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
import java.util.Map;
/**
 * @Author zhuo
 * @Date 2024/7/31
 */
@RequestMapping("/rawMaterialOrder")
@RestController
@AllArgsConstructor
@Api(tags = "原材料下单")
public class RawMaterialOrderController {
    private RawMaterialOrderService rawMaterialOrderService;
    private RawMaterialOrderTemplateService rawMaterialOrderTemplateService;
    @ApiOperation(value = "更具零件号获取标准树")
    @GetMapping("/selectStandardTreeListByPartNo")
    public Result selectStandardTreeListByPartNo(String partNo) {
        return Result.success(rawMaterialOrderService.selectStandardTreeListByPartNo(partNo));
    }
    @ApiOperation(value = "原材料检验查询代下单")
    @GetMapping("/getPurchaseOrder")
    public Result getPurchaseOrder(Page page, IfsInventoryQuantityCheckDto ifsInventoryQuantity){
        return Result.success(rawMaterialOrderService.selectIfsInventoryQuantity(page, ifsInventoryQuantity));
    }
    @ApiOperation(value = "原材料检验查询检验中")
    @GetMapping("/getIfsByStateOne")
    public Result getIfsByStateOne(Page page, IfsInventoryQuantityDto ifsInventoryQuantityDto) throws Exception {
        return Result.success(rawMaterialOrderService.getIfsByStateOne(page, ifsInventoryQuantityDto));
    }
    @ApiOperation(value = "原材料检验查询已检验")
    @GetMapping("/getIfsByOver")
    public Result getIfsByOver(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) throws Exception {
        return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
    }
    @ApiOperation(value = "添加原材料检验单模板")
    @PostMapping("/addRawMaterOrderTemplate")
    public Result<?> addRawMaterOrderTemplate(@RequestBody RawMaterialOrderTemplate rawMaterialOrderTemplate) {
        return Result.success(rawMaterialOrderTemplateService.addRawMaterOrderTemplate(rawMaterialOrderTemplate));
    }
    @ApiOperation(value = "查询原材料检验单模板列表")
    @GetMapping("/selectRawMaterOrderTemplate")
    public Result<?> selectRawMaterOrderTemplate(String partNo) {
        return Result.success(rawMaterialOrderTemplateService.selectRawMaterOrderTemplate(partNo));
    }
    @ApiOperation(value = "通过原材料检验单模板id获取检验单模板内容")
    @GetMapping("/selectRawMaterOrderTemplateById")
    public Result<?> selectRawMaterOrderTemplateById(Integer id) {
        return Result.success("成功", rawMaterialOrderTemplateService.selectRawMaterOrderTemplateById(id));
    }
    @ApiOperation(value = "删除原材料检验单模板")
    @PostMapping("/delRawMaterOrderTemplate")
    public Result<?> delRawMaterOrderTemplate(Integer id) {
        return Result.success(rawMaterialOrderTemplateService.delRawMaterOrderTemplate(id));
    }
    /**
     * æŠ¥æ£€æ‰¹é‡
     * @param param åŽŸææ–™id
     * @return
     */
    @ApiOperation(value = "报检批量")
    @PostMapping("/inspectionReport")
    public Result<?> inspectionReport(@RequestBody Map<String, Object> param) {
        List<Integer> ids = (List<Integer>) param.get("ids");
        return Result.success(rawMaterialOrderService.inspectionReport(ids));
    }
    /**
     * å–消报检
     * @param id åŽŸææ–™ä¸‹å•
     * @return
     */
    @ApiOperation(value = "撤销报检")
    @PostMapping("/revokeInspectionReport")
    public Result<?> revokeInspectionReport(Integer id) {
        return Result.success(rawMaterialOrderService.revokeInspectionReport(id));
    }
    /**
     * æ‰“印标签查询
     * @param param åŽŸææ–™id
     * @return
     */
    @ApiOperation(value = "打印标签查询")
    @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
     */
    @ApiOperation(value = "报检")
    @PostMapping("/inspectionReportOne")
    public Result<?> inspectionReportOne(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) {
        return Result.success(rawMaterialOrderService.inspectionReportOne(ifsInventoryQuantity));
    }
    /**
     * èŽ·å–é“œäº§ä¸šé“¾æ£€æµ‹æ•°æ®
     * @param id åŽŸææ–™id
     * @return
     */
    @ApiOperation(value = "获取铜产业链检测数据")
    @GetMapping("/getIndustryChain")
    public Result<?> getIndustryChain(Integer id) {
        return Result.success("成功", rawMaterialOrderService.getIndustryChain(id));
    }
    /**
     * åŽŸææ–™æ’¤é”€
     * @param ifsInventoryId
     * @return
     */
    @ApiOperation(value = "原材料撤销下单")
    @PutMapping("/repealRawOrder")
    public Result<?> repealRawOrder(Integer ifsInventoryId){
        return Result.success(rawMaterialOrderService.repealRawOrder(ifsInventoryId));
    }
    @ApiOperation(value = "原材料下单免检")
    @PostMapping("/addExemptionOrder")
    public Result<?> addExemptionOrder(String str) {
        Map<String, Object> map = JSON.parseObject(str, Map.class);
        JSONArray jsonArray = JSON.parseArray(map.get("list")+"");
        List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class);
        InsOrder insOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), InsOrder.class);
        return Result.success(rawMaterialOrderService.addExemptionOrder(list, insOrder));
    }
    @ApiOperation(value = "仓库报检查询")
    @PostMapping("/getWarehouseSubmit")
    public Result getWarehouseSubmit(@RequestBody Map<String, Object> data) throws Exception {
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        IfsInventoryQuantity ifsInventoryQuantity = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantity.class);
        return Result.success(rawMaterialOrderService.getWarehouseSubmit(page, ifsInventoryQuantity));
    }
    /**
     * å–消报检
     * @param id åŽŸææ–™ä¸‹å•
     * @return
     */
    @ApiOperation(value = "删除原材料报检信息")
    @PostMapping("/delIfsInventory")
    public Result<?> delIfsInventory(Integer id) {
        return Result.success(rawMaterialOrderService.delIfsInventory(id));
    }
    /**
     * åŽŸææ–™ä¸‹å•æ”¾è¡Œ
     * @param param
     * @return
     */
    @ApiOperation(value = "原材料下单放行免检")
    @PostMapping("/rawOrderRelease")
    public Result<?> rawOrderRelease(@RequestBody Map<String, Object> param){
        Integer ifsInventoryId = (Integer) param.get("ifsInventoryId");
        String partDetail = (String) param.get("partDetail");
        return Result.success(rawMaterialOrderService.rawOrderRelease(ifsInventoryId, partDetail));
    }
    /**
     * åŽŸææ–™ä¸‹å•é€šçŸ¥å…æ£€æˆ–è€…å¤šæ¬¡æ£€éªŒ
     * @param ifsInventoryId
     * @return
     */
    @ApiOperation(value = "原材料下单通知免检或者多次检验")
    @GetMapping("/notificationRawOrder")
    public Result<?> notificationRawOrder(Integer ifsInventoryId){
        return Result.success(rawMaterialOrderService.notificationRawOrder(ifsInventoryId));
    }
    @ApiOperation(value = "原材料报检查询全部")
    @PostMapping("/getIfsByAll")
    public Result getIfsByAll(@RequestBody Map<String, Object> data) throws Exception {
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantitySupplierDto.class);
        return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
    }
    @ApiOperation(value = "新增原材料报检信息")
    @PostMapping("/addIfsInventoryQuantity")
    public Result addIfsInventoryQuantity(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) {
        rawMaterialOrderService.addIfsInventoryQuantity(ifsInventoryQuantity);
        return Result.success();
    }
    @ApiOperation(value = "原材料下单查看已完成信息")
    @PostMapping("/getIfsByFinish")
    public Result getIfsByFinish(@RequestBody Map<String, Object> data) throws Exception {
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantitySupplierDto.class);
        ifsInventoryQuantityDto.setIsFinish(1);
        return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
    }
    @ApiOperation(value = "测试移库")
    @PostMapping("/shiftingParking")
    public Result shiftingParking(@RequestBody List<Integer> ids){
        rawMaterialOrderService.shiftingParking(ids);
        return Result.success();
    }
    @ApiOperation(value = "微信发送文件测试")
    @GetMapping("/wxSend")
    public Result wxSend(String user, String content, String filePath) throws Exception {
        WxCpUtils.inform(user, content, new File(filePath));
        return Result.success();
    }
    @ApiOperation(value = "铜单丝下单免检")
    @PostMapping("/addRawCopperOrderExemptionOrder")
    public Result<?> addRawCopperOrderExemptionOrder(String str) {
        Map<String, Object> map = JSON.parseObject(str, Map.class);
        JSONArray jsonArray = JSON.parseArray(map.get("list")+"");
        List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class);
        CopperInsOrderDto CopperInsOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), CopperInsOrderDto.class);
        return Result.success(rawMaterialOrderService.addRawCopperOrderExemptionOrder(list, CopperInsOrder));
    }
    /**
     * è®©æ­¥æ”¾è¡Œ
     * @param ifsInventoryId
     * @return
     */
    @ApiOperation(value = "让步放行")
    @PostMapping("/concessionRelease")
    public Result<?> concessionRelease(Integer ifsInventoryId){
        return Result.success(rawMaterialOrderService.concessionRelease(ifsInventoryId));
    }
    /**
     * åŽŸææ–™è¿›åŽ‚æ’¤é”€ä¸‹å•
     * @param enterOrderId
     * @return
     */
    @ApiOperation(value = "原材料进厂撤销下单")
    @PostMapping("/repealEnterRawOrder")
    public Result<?> repealEnterRawOrder(Integer enterOrderId){
        return Result.success(rawMaterialOrderService.repealEnterRawOrder(enterOrderId));
    }
    /**
     * åŽŸææ–™å­£åº¦æ’¤é”€ä¸‹å•
     * @param quarterOrderId
     * @return
     */
    @ApiOperation(value = "原材料季度撤销下单")
    @PostMapping("/repealQuarterRawOrder")
    public Result<?> repealQuarterRawOrder(Integer quarterOrderId){
        return Result.success(rawMaterialOrderService.repealQuarterRawOrder(quarterOrderId));
    }
    @ApiOperation(value = "全部信息导出")
    @PostMapping("/rawAllExport")
    public void rawAllExport(@RequestBody Map<String, Object> data, HttpServletResponse response) throws Exception {
        IfsInventoryQuantitySupplierDto dto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantitySupplierDto.class);
        rawMaterialOrderService.rawAllExport(dto,response);
    }
    @ApiOperation(value = "原材料检验查询季度检验")
    @GetMapping("/getIfsByQuarter")
    public Result getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
        return Result.success(rawMaterialOrderService.getIfsByQuarter(page, ifsInventoryQuantityDto));
    }
    /**
     * æå‰å…¥åº“
     * @param ifsInventoryId
     * @return
     */
    @ApiOperation(value = "提前入库")
    @PostMapping("/advancedGodown")
    public Result<?> advancedGodown(Integer ifsInventoryId){
        return Result.success(rawMaterialOrderService.advancedGodown(ifsInventoryId));
    }
}
//package com.ruoyi.inspect.controller;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.ruoyi.basic.dto.*;
//import com.ruoyi.basic.pojo.IfsInventoryQuantity;
//import com.ruoyi.inspect.dto.SampleProductDto;
//import com.ruoyi.inspect.pojo.InsOrder;
//import com.ruoyi.inspect.pojo.RawMaterialOrderTemplate;
//import com.ruoyi.inspect.service.RawMaterialOrderService;
//import com.ruoyi.inspect.service.RawMaterialOrderTemplateService;
//import com.ruoyi.common.core.domain.Result;
//import com.ruoyi.common.utils.JackSonUtil;
//import com.ruoyi.common.utils.WxCpUtils;
//import com.ruoyi.inspect.dto.CopperInsOrderDto;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.AllArgsConstructor;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletResponse;
//import java.io.File;
//import java.util.List;
//import java.util.Map;
//
///**
// * @Author zhuo
// * @Date 2024/7/31
// */
//@RequestMapping("/rawMaterialOrder")
//@RestController
//@AllArgsConstructor
//@Api(tags = "原材料下单")
//public class RawMaterialOrderController {
//
//    private RawMaterialOrderService rawMaterialOrderService;
//    private RawMaterialOrderTemplateService rawMaterialOrderTemplateService;
//
//    @ApiOperation(value = "更具零件号获取标准树")
//    @GetMapping("/selectStandardTreeListByPartNo")
//    public Result selectStandardTreeListByPartNo(String partNo) {
//        return Result.success(rawMaterialOrderService.selectStandardTreeListByPartNo(partNo));
//    }
//
//    @ApiOperation(value = "原材料检验查询代下单")
//    @GetMapping("/getPurchaseOrder")
//    public Result getPurchaseOrder(Page page, IfsInventoryQuantityCheckDto ifsInventoryQuantity){
//        return Result.success(rawMaterialOrderService.selectIfsInventoryQuantity(page, ifsInventoryQuantity));
//    }
//
//    @ApiOperation(value = "原材料检验查询检验中")
//    @GetMapping("/getIfsByStateOne")
//    public Result getIfsByStateOne(Page page, IfsInventoryQuantityDto ifsInventoryQuantityDto) throws Exception {
//        return Result.success(rawMaterialOrderService.getIfsByStateOne(page, ifsInventoryQuantityDto));
//    }
//
//    @ApiOperation(value = "原材料检验查询已检验")
//    @GetMapping("/getIfsByOver")
//    public Result getIfsByOver(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) throws Exception {
//        return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
//    }
//
//    @ApiOperation(value = "添加原材料检验单模板")
//    @PostMapping("/addRawMaterOrderTemplate")
//    public Result<?> addRawMaterOrderTemplate(@RequestBody RawMaterialOrderTemplate rawMaterialOrderTemplate) {
//        return Result.success(rawMaterialOrderTemplateService.addRawMaterOrderTemplate(rawMaterialOrderTemplate));
//    }
//    @ApiOperation(value = "查询原材料检验单模板列表")
//    @GetMapping("/selectRawMaterOrderTemplate")
//    public Result<?> selectRawMaterOrderTemplate(String partNo) {
//        return Result.success(rawMaterialOrderTemplateService.selectRawMaterOrderTemplate(partNo));
//    }
//
//    @ApiOperation(value = "通过原材料检验单模板id获取检验单模板内容")
//    @GetMapping("/selectRawMaterOrderTemplateById")
//    public Result<?> selectRawMaterOrderTemplateById(Integer id) {
//        return Result.success("成功", rawMaterialOrderTemplateService.selectRawMaterOrderTemplateById(id));
//    }
//
//    @ApiOperation(value = "删除原材料检验单模板")
//    @PostMapping("/delRawMaterOrderTemplate")
//    public Result<?> delRawMaterOrderTemplate(Integer id) {
//        return Result.success(rawMaterialOrderTemplateService.delRawMaterOrderTemplate(id));
//    }
//
//
//    /**
//     * æŠ¥æ£€æ‰¹é‡
//     * @param param åŽŸææ–™id
//     * @return
//     */
//    @ApiOperation(value = "报检批量")
//    @PostMapping("/inspectionReport")
//    public Result<?> inspectionReport(@RequestBody Map<String, Object> param) {
//        List<Integer> ids = (List<Integer>) param.get("ids");
//        return Result.success(rawMaterialOrderService.inspectionReport(ids));
//    }
//
//    /**
//     * å–消报检
//     * @param id åŽŸææ–™ä¸‹å•
//     * @return
//     */
//    @ApiOperation(value = "撤销报检")
//    @PostMapping("/revokeInspectionReport")
//    public Result<?> revokeInspectionReport(Integer id) {
//        return Result.success(rawMaterialOrderService.revokeInspectionReport(id));
//    }
//
//    /**
//     * æ‰“印标签查询
//     * @param param åŽŸææ–™id
//     * @return
//     */
//    @ApiOperation(value = "打印标签查询")
//    @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
//     */
//    @ApiOperation(value = "报检")
//    @PostMapping("/inspectionReportOne")
//    public Result<?> inspectionReportOne(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) {
//
//        return Result.success(rawMaterialOrderService.inspectionReportOne(ifsInventoryQuantity));
//    }
//
//    /**
//     * èŽ·å–é“œäº§ä¸šé“¾æ£€æµ‹æ•°æ®
//     * @param id åŽŸææ–™id
//     * @return
//     */
//    @ApiOperation(value = "获取铜产业链检测数据")
//    @GetMapping("/getIndustryChain")
//    public Result<?> getIndustryChain(Integer id) {
//        return Result.success("成功", rawMaterialOrderService.getIndustryChain(id));
//    }
//
//    /**
//     * åŽŸææ–™æ’¤é”€
//     * @param ifsInventoryId
//     * @return
//     */
//    @ApiOperation(value = "原材料撤销下单")
//    @PutMapping("/repealRawOrder")
//    public Result<?> repealRawOrder(Integer ifsInventoryId){
//        return Result.success(rawMaterialOrderService.repealRawOrder(ifsInventoryId));
//    }
//
//
//    @ApiOperation(value = "原材料下单免检")
//    @PostMapping("/addExemptionOrder")
//    public Result<?> addExemptionOrder(String str) {
//        Map<String, Object> map = JSON.parseObject(str, Map.class);
//        JSONArray jsonArray = JSON.parseArray(map.get("list")+"");
//        List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class);
//        InsOrder insOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), InsOrder.class);
//        return Result.success(rawMaterialOrderService.addExemptionOrder(list, insOrder));
//    }
//
//
//    @ApiOperation(value = "仓库报检查询")
//    @PostMapping("/getWarehouseSubmit")
//    public Result getWarehouseSubmit(Page page, IfsInventoryQuantity ifsInventoryQuantity) throws Exception {
//        return Result.success(rawMaterialOrderService.getWarehouseSubmit(page, ifsInventoryQuantity));
//    }
//
//    /**
//     * å–消报检
//     * @param id åŽŸææ–™ä¸‹å•
//     * @return
//     */
//    @ApiOperation(value = "删除原材料报检信息")
//    @PostMapping("/delIfsInventory")
//    public Result<?> delIfsInventory(Integer id) {
//        return Result.success(rawMaterialOrderService.delIfsInventory(id));
//    }
//
//    /**
//     * åŽŸææ–™ä¸‹å•æ”¾è¡Œ
//     * @param param
//     * @return
//     */
//    @ApiOperation(value = "原材料下单放行免检")
//    @PostMapping("/rawOrderRelease")
//    public Result<?> rawOrderRelease(@RequestBody Map<String, Object> param){
//        Integer ifsInventoryId = (Integer) param.get("ifsInventoryId");
//        String partDetail = (String) param.get("partDetail");
//        return Result.success(rawMaterialOrderService.rawOrderRelease(ifsInventoryId, partDetail));
//    }
//
//    /**
//     * åŽŸææ–™ä¸‹å•é€šçŸ¥å…æ£€æˆ–è€…å¤šæ¬¡æ£€éªŒ
//     * @param ifsInventoryId
//     * @return
//     */
//    @ApiOperation(value = "原材料下单通知免检或者多次检验")
//    @GetMapping("/notificationRawOrder")
//    public Result<?> notificationRawOrder(Integer ifsInventoryId){
//        return Result.success(rawMaterialOrderService.notificationRawOrder(ifsInventoryId));
//    }
//
//
//    @ApiOperation(value = "原材料报检查询全部")
//    @PostMapping("/getIfsByAll")
//    public Result getIfsByAll(@RequestBody Map<String, Object> data) throws Exception {
//        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
//        IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantitySupplierDto.class);
//        return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
//    }
//
//
//    @ApiOperation(value = "新增原材料报检信息")
//    @PostMapping("/addIfsInventoryQuantity")
//    public Result addIfsInventoryQuantity(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) {
//        rawMaterialOrderService.addIfsInventoryQuantity(ifsInventoryQuantity);
//        return Result.success();
//    }
//
//    @ApiOperation(value = "原材料下单查看已完成信息")
//    @PostMapping("/getIfsByFinish")
//    public Result getIfsByFinish(@RequestBody Map<String, Object> data) throws Exception {
//        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
//        IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantitySupplierDto.class);
//        ifsInventoryQuantityDto.setIsFinish(1);
//        return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
//    }
//
//    @ApiOperation(value = "测试移库")
//    @PostMapping("/shiftingParking")
//    public Result shiftingParking(@RequestBody List<Integer> ids){
//        rawMaterialOrderService.shiftingParking(ids);
//        return Result.success();
//    }
//
//    @ApiOperation(value = "微信发送文件测试")
//    @GetMapping("/wxSend")
//    public Result wxSend(String user, String content, String filePath) throws Exception {
//        WxCpUtils.inform(user, content, new File(filePath));
//        return Result.success();
//    }
//
//    @ApiOperation(value = "铜单丝下单免检")
//    @PostMapping("/addRawCopperOrderExemptionOrder")
//    public Result<?> addRawCopperOrderExemptionOrder(String str) {
//        Map<String, Object> map = JSON.parseObject(str, Map.class);
//        JSONArray jsonArray = JSON.parseArray(map.get("list")+"");
//        List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class);
//        CopperInsOrderDto CopperInsOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), CopperInsOrderDto.class);
//        return Result.success(rawMaterialOrderService.addRawCopperOrderExemptionOrder(list, CopperInsOrder));
//    }
//
//    /**
//     * è®©æ­¥æ”¾è¡Œ
//     * @param ifsInventoryId
//     * @return
//     */
//    @ApiOperation(value = "让步放行")
//    @PostMapping("/concessionRelease")
//    public Result<?> concessionRelease(Integer ifsInventoryId){
//        return Result.success(rawMaterialOrderService.concessionRelease(ifsInventoryId));
//    }
//
//    /**
//     * åŽŸææ–™è¿›åŽ‚æ’¤é”€ä¸‹å•
//     * @param enterOrderId
//     * @return
//     */
//    @ApiOperation(value = "原材料进厂撤销下单")
//    @PostMapping("/repealEnterRawOrder")
//    public Result<?> repealEnterRawOrder(Integer enterOrderId){
//        return Result.success(rawMaterialOrderService.repealEnterRawOrder(enterOrderId));
//    }
//
//    /**
//     * åŽŸææ–™å­£åº¦æ’¤é”€ä¸‹å•
//     * @param quarterOrderId
//     * @return
//     */
//    @ApiOperation(value = "原材料季度撤销下单")
//    @PostMapping("/repealQuarterRawOrder")
//    public Result<?> repealQuarterRawOrder(Integer quarterOrderId){
//        return Result.success(rawMaterialOrderService.repealQuarterRawOrder(quarterOrderId));
//    }
//
//    @ApiOperation(value = "全部信息导出")
//    @PostMapping("/rawAllExport")
//    public void rawAllExport(@RequestBody Map<String, Object> data, HttpServletResponse response) throws Exception {
//        IfsInventoryQuantitySupplierDto dto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantitySupplierDto.class);
//        rawMaterialOrderService.rawAllExport(dto,response);
//    }
//
//    @ApiOperation(value = "原材料检验查询季度检验")
//    @GetMapping("/getIfsByQuarter")
//    public Result getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
//        return Result.success(rawMaterialOrderService.getIfsByQuarter(page, ifsInventoryQuantityDto));
//    }
//
//    /**
//     * æå‰å…¥åº“
//     * @param ifsInventoryId
//     * @return
//     */
//    @ApiOperation(value = "提前入库")
//    @PostMapping("/advancedGodown")
//    public Result<?> advancedGodown(Integer ifsInventoryId){
//        return Result.success(rawMaterialOrderService.advancedGodown(ifsInventoryId));
//    }
//
//}
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsOrderPlanDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
package com.ruoyi.inspect.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class InsOrderPlanDTO implements Serializable {
    @ApiModelProperty("检验任务主键id")
    private Long insSampleId;
    @ApiModelProperty("用户id")
    private Long userId;
    @ApiModelProperty("状态(检验处理)")
    private Integer state;
    @ApiModelProperty("子实验室")
    private String sonLaboratory;
    @ApiModelProperty("检验状态")
    private String insState;
    @ApiModelProperty("委托编号")
    private String entrustCode;
    @ApiModelProperty("检验类型")
    private Integer typeSource;
    @ApiModelProperty("是否复核")
    private Integer isCheck;
}
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.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * @Author zhuo
 * @Date 2024/11/29
 */
@Data
public class InsProductBindingDto {
    @ApiModelProperty("需要绑定的id")
    private Integer insProductId;
    @ApiModelProperty("需要绑定的检验项")
    private List<InsProduct> insProductBindingList;
}
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.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * @Author zhuo
 * @Date 2024/12/12
 */
@Data
public class OmitOrderProductDto {
    @ApiModelProperty("需要添加的样品Id")
    private Integer insSampleId;
    @ApiModelProperty("需要绑定的检验项")
    private List<InsProduct> insProductBindingList;
}
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.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ProductResultDto2 extends InsProduct {
    @ApiModelProperty("检验设备")
    private String equipValue;
    @ApiModelProperty("检验人")
    private String updateUserName;
    @ApiModelProperty("委托编号")
    private String entrustCode;
}
inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,42 @@
package com.ruoyi.inspect.dto;
import com.ruoyi.inspect.pojo.InsReport;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class ReportPageDto extends InsReport implements Serializable {
    @ApiModelProperty(value = "委托编号")
    private String entrustCode;
    @ApiModelProperty(value = "提交人")
    private String writeUserName;
    @ApiModelProperty(value = "批准人")
    private String ratifyUser;
    @ApiModelProperty(value = "审核人")
    private String examineUser;
    @ApiModelProperty(value = "下单类别")
    private Integer typeSource;
    @ApiModelProperty(value = "检验类别")
    private String orderType;
    @ApiModelProperty(value = "原材料id")
    private Integer ifsInventoryId;
    @ApiModelProperty(value = "是否复核通过")
    private String queryStatus;
    @ApiModelProperty(value = "是否是铜材, 0否, 1是")
    private Integer isCopper;
    @ApiModelProperty(value = "实验室")
    private String sonLaboratory;
}
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.annotations.ApiModelProperty;
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 {
    @ApiModelProperty("样品id")
    private Integer id;
    @ApiModelProperty("产品id")
    private Integer insProductId;
    @ApiModelProperty("样品编号")
    private String sampleCode;
    @ApiModelProperty("样品名称")
    private String sample;
    @ApiModelProperty("检验项分类")
    private String inspectionItemClass;
    private String inspectionItemClassEN;
    @ApiModelProperty("检验项")
    private String inspectionItem;
    private String inspectionItemEn;
    @ApiModelProperty("检验子项")
    private String inspectionItemSubclass;
    private String inspectionItemSubclassEn;
    @ApiModelProperty("单位")
    private String unit;
    @ApiModelProperty("样品型号")
    private String model;
    @ApiModelProperty("样品状态")
    private Integer insState;
    @ApiModelProperty("实验室")
    private String sonLaboratory;
    @ApiModelProperty("检验项类型")
    private String inspectionItemType;
    @ApiModelProperty("检验值类型")
    private String inspectionValueType;
    @ApiModelProperty("要求值")
    private String ask;
    @ApiModelProperty("试验要求")
    private String tell;
    @ApiModelProperty("检验结果")
    private String lastValue;
    @ApiModelProperty("结果判定")
    private Integer insResult;
    @ApiModelProperty("检验人")
    private String checkName;
    @ApiModelProperty("检验日期")
    private String checkTime;
    @ApiModelProperty("序号")
    private String index;
    @ApiModelProperty("名称")
    private String inspectionName;
    //条件
    private String radius;
    // æ£€éªŒç»“果列表
    private List<String> lastValueList;
    // æ£€éªŒç»“果列表
    private List<Integer> insResultList;
    //最终结果
    private String finalResult;
    //原材料id
    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;
    }
}
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductRawAnalysisDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
package com.ruoyi.inspect.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author zhuo
 * @Date 2024/10/17
 */
@Data
public class SampleProductRawAnalysisDto {
    @ApiModelProperty("样品id")
    private Integer insSampleId;
    @ApiModelProperty("检验项id")
    private Integer insProductId;
    @ApiModelProperty("样品编号")
    private String sampleCode;
    @ApiModelProperty("检验项名称")
    private String inspectionItem;
    @ApiModelProperty("检验结果")
    private String lastValue;
    @ApiModelProperty("合格判断, 1:合格, 0:不合格, 3:不判定")
    private Integer insResult;
    @ApiModelProperty("批次号")
    private String updateBatchNo;
    @ApiModelProperty("厂家名称")
    private String supplierName;
    @ApiModelProperty("样品名称")
    private String sample;
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,131 @@
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.pojo.StructureTestObject;
import com.ruoyi.inspect.dto.CostStatisticsDto;
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.InsOrderPrintingVo;
import com.ruoyi.inspect.vo.SampleDefectsFatherVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * @author gaoaoy
 * @description é’ˆå¯¹è¡¨ã€ins_order(检验下单)】的数据库操作Mapper
 * @createDate 2024-03-12 16:17:55
 * @Entity com.yuanchu.mom.pojo.InsOrder
 */
public interface InsOrderMapper extends BaseMapper<InsOrder> {
    //获取检验下单数据
    IPage<SampleOrderDto> selectInsOrderPage(IPage<InsOrder> page, QueryWrapper<SampleOrderDto> ew, String laboratory, String isOrderAll);
    String getLaboratoryCode(String name);
    IPage<SampleProductDto2> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, QueryWrapper<SampleProductDto2> ew, Integer id);
    IPage<CostStatisticsDto> selectCostStatistics(IPage<CostStatisticsDto> page, QueryWrapper<CostStatisticsDto> ew);
    List<CostStatisticsDto> selectCostStatistics2(@Param("ew") QueryWrapper<CostStatisticsDto> ew);
    List<Map<String, String>> selectDeviceList(Set<String> names);
    List<SampleDefectsFatherVo> selectSampleDefects(Page page, @Param("inspectionItems") String inspectionItems, @Param("orderNumber") String orderNumber);
    Long getCount(@Param("inspectionItems") String inspectionItems, @Param("orderNumber") String orderNumber);
    String getEnumLabelByValue(String value);
    String getStandardMethodCode(Integer id);
    int updateStatus( Integer id);
    String selLaboratoryCode(String laboratory);
    List<Map<Integer, Object>> selectReportModelByOrderId(@Param("id") Integer id, @Param("laboratory") String laboratory);
    String seldepLimsId(int depLimsId);
    /**
     * æŸ¥è¯¢æ£€éªŒç»“æžœ
     * @param ids
     * @return
     */
    List<SampleProductExportDto> selectSampleBySampleId(@Param("ids") List<Integer> ids);
    /**
     * èŽ·å–æ‰¹é‡æ£€éªŒçš„æ€»æ•°
     * @param id
     * @return
     */
    int selectSampleMax(Integer id);
    /**
     * èŽ·å–çº¿èŠ¯é¢œè‰²
     * @param id
     * @return
     */
    List<String> selectSampleCableTag(Integer id);
    /**
     *
     * @param orderId
     * @return
     */
    int selectSampleItemS(Integer orderId);
    /**
     * åªæŸ¥è¯¢é»˜è®¤ç¬¬ä¸€ä¸ªçš„产品
     * @param id
     * @return
     */
    List<SampleProductExportDto> selectSampleBySampleIdOne(Integer id);
    /**
     * æŸ¥è¯¢æ—¥åކ图
     * @param
     * @return
     */
    List<Map<String, Object>> selectCalendarWorkByWeek(int day);
    /**
     *
     * @param partNo
     * @return
     */
    StructureTestObject selectProductByPartNo(String partNo);
    /**
     *
     * @param partNo
     * @return
     */
    StructureTestObject selectByPartNo(String partNo);
    /**
     * æˆå“æ ‡ç­¾æ‰“印
     * @param ids
     * @return
     */
    List<InsOrderPrintingVo> labelOrderPrinting(List<Integer> ids);
    List<SampleOrderDto> rawAllInsOrderExport(QueryWrapper<SampleOrderDto> ew,  String laboratory, String isOrderAll);
    /**
     * æ ¹æ®è®¢å•查询试验室
     * @param insOrderId
     * @return
     */
    String selectLaboratoryByOrderId(Integer insOrderId);
    InsOrder selectFirstSubmit(Integer insSampleId);
}
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 é’ˆå¯¹è¡¨ã€ins_order_state】的数据库操作Mapper
* @createDate 2024-04-01 11:44:50
* @Entity com.yuanchu.mom.pojo.InsOrderState
*/
public interface InsOrderStateMapper extends BaseMapper<InsOrderState> {
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
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.ProductResultDto2;
import com.ruoyi.inspect.dto.SampleProductRawAnalysisDto;
import com.ruoyi.inspect.pojo.InsProduct;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€ins_product(检验项目)】的数据库操作Mapper
* @createDate 2024-03-08 09:45:03
* @Entity com.yuanchu.mom.pojo.InsProduct
*/
public interface InsProductMapper extends BaseMapper<InsProduct> {
    int selectOrderManDay(Integer orderId);
    Map<String, String> selectUserById(Integer userId);
    List<ProductResultDto2> getProductAndResult(Integer sampleId);
    int updateInspected(@Param("id") Integer id);
    List<InsProduct> selectFiberInsProduct(List<Integer> ids, String laboratory);
    IPage<InsProduct> selectNoProducts(Page page, Integer orderId, List<Integer> noIds);
    int selectInsProductCountByOrderId(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(Integer orderId);
    /**
     * æŸ¥è¯¢åˆ¤æ–­æ˜¯å¦æœ‰ä¸åˆ¤å®šé¡¹ç›®,和全都是判定项
     * @param orderId
     * @return
     */
    int selectNoJudge(Integer orderId);
}
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 é’ˆå¯¹è¡¨ã€ins_product_user(检验项目的人员检验记录)】的数据库操作Mapper
* @createDate 2024-04-17 13:42:44
* @Entity com.yuanchu.mom.pojo.InsProductUser
*/
public interface InsProductUserMapper extends BaseMapper<InsProductUser> {
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsReportMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
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.ReportPageDto;
import com.ruoyi.inspect.pojo.InsReport;
import org.apache.ibatis.annotations.Param;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€ins_report(检验报告)】的数据库操作Mapper
* @createDate 2024-03-17 22:10:02
* @Entity com.yuanchu.mom.pojo.InsReport
*/
public interface InsReportMapper extends BaseMapper<InsReport> {
    /**
     * æŸ¥è¯¢æ£€éªŒä»»åŠ¡
     * @param userId å½“前登录人id
     * @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(String name, String type);
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,130 @@
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 é’ˆå¯¹è¡¨ã€ins_sample(检验样品)】的数据库操作Mapper
* @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(Integer id);
    List<SampleProductDto> selectSampleProductListByOrderId2(Integer id);
    Map<String,Object> selectInsOrder(Integer id);
    List<SampleProductDto> getInsOrderAndSample(Integer id, String laboratory);
    String getSampleEn(String sample);
    /**
     * å¯èƒ½æ²¡æœ‰äº§å“ç›´æŽ¥å°±æ˜¯å¯¹è±¡
     * @param sample
     * @return
     */
    String getSampleEnByObject(String sample);
    /**
     * æ ·å“
     * @param id
     * @param laboratory
     * @return
     */
    List<InsProduct> getInsProduct1(Integer id, String laboratory, String cableTag, String repetitionTag, String isDisqualification);
    /**
     * åŽŸææ–™
     * @param id
     * @param laboratory
     * @param rawMaterialTag
     * @return
     */
    List<InsProduct> getInsProduct6(Integer id, String laboratory, String rawMaterialTag, String isDisqualification);
    SampleVo getDetailById(Integer sampleId);
    String selMethodById(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(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(List<Integer> itemIds);
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.inspect.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.inspect.pojo.InsSampleUser;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€ins_sample_user(样品负责人记录)】的数据库操作Mapper
* @createDate 2024-03-14 17:12:02
* @Entity com.yuanchu.mom.pojo.InsSampleUser
*/
public interface InsSampleUserMapper extends BaseMapper<InsSampleUser> {
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnqualifiedRetestProductMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
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 java.util.List;
/**
 * ä¸åˆæ ¼æ£€éªŒé¡¹ç›®å¤æµ‹
 * @author é·Ÿ
 * @since 2024-09-03
 */
@Mapper
public interface InsUnqualifiedRetestProductMapper extends BaseMapper<InsUnqualifiedRetestProduct> {
    /**
     * æŸ¥è¯¢ä¸åˆæ ¼å†…容
     * @param ids
     * @return
     */
    List<InsUnqualifiedRetestProduct> selectRetestProduct(List<Integer> ids);
    // æ ·å“
    List<InsProduct> getInsProductUnqualifiedRetest1(Integer id, String laboratory, String retestTag);
    // ç”µç¼†é…ç½®
    List<InsProduct> getInsProductUnqualifiedRetest5(Integer id, String laboratory, String cableTag, String retestTag);
    // åŽŸææ–™ä¸‹å•
    List<InsProduct> getInsProductUnqualifiedRetest6(Integer id, String laboratory, String rawMaterialTag, String retestTag);
}
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;
/**
 * å­£åº¦æŠ½æ ·è®¡åˆ’详情表
 *
 * @author zhuo
 * @since 2024-10-09
 */
@Mapper
public interface SpotCheckQuarterItemMapper extends BaseMapper<SpotCheckQuarterItem> {
}
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.annotations.ApiModelProperty;
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;
    @ApiModelProperty("设备id")
    private Integer deviceId;
    @ApiModelProperty("订单id")
    private Integer insOrderId;
    @ApiModelProperty("样品编号")
    private String sampleCode;
    @ApiModelProperty("温度")
    private String temperature;
    @ApiModelProperty("湿度")
    private String humidity;
    @ApiModelProperty("使用前0代表不正常1代表正常")
    private Integer useBefore;
    @ApiModelProperty("使用后0代表不正常1代表正常")
    private Integer useAfter;
    @ApiModelProperty("异常情况")
    private String abnormal;
    @ApiModelProperty("使用人id")
    private Integer usePersonId;
    @ApiModelProperty("使用人")
    private String usePerson;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("使用开始日期")
    private LocalDateTime useStartDate;
    @ApiModelProperty("使用结束日期")
    private LocalDateTime useEndDate;
}
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.annotations.ApiModelProperty;
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 {
    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Integer factoryVerifyId;
    @ApiModelProperty(value = "外键:  ins_order表 id")
    private Integer insOrderId;
    @ApiModelProperty(value = "委托编号")
    private String entrustCode;
    @ApiModelProperty("材料厂家")
    private String supplierName;
    @ApiModelProperty("到货日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime declareDate;
    @ApiModelProperty("样品名称")
    private String sample;
    @ApiModelProperty("规格型号")
    private String model;
    @ApiModelProperty("材料批号")
    private String updateBatchNo;
    @ApiModelProperty(value = "验证文件编号")
    private String verifyFileCode;
    @ApiModelProperty(value = "1材料名称")
    private String basicName;
    @ApiModelProperty(value = "2规格型号")
    private String basicModel;
    @ApiModelProperty(value = "3材料批号")
    private String basicBatchNo;
    @ApiModelProperty(value = "4执行标准")
    private String basicStandard;
    @ApiModelProperty(value = "5生产日期")
    private String basicDate;
    @ApiModelProperty(value = "6供货数量")
    private String basicNumber;
    @ApiModelProperty(value = "7材料颜色")
    private String basicColor;
    @ApiModelProperty(value = "8其他(名称)")
    private String basicOtherValue;
    @ApiModelProperty(value = "8其他")
    private String basicOther;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @TableField(exist = false,select = false)
    @ApiModelProperty(value = "验证项目集合")
    private List<InsOrderFactoryVerifyItem>  factoryVerifyItemList;
}
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.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
 * åŽŸææ–™åŽ‚å®¶è¿›è´§éªŒè¯æ£€éªŒé¡¹
 *
 * @author zhuo
 * @since 2024-09-26
 */
@Data
@TableName("ins_order_factory_verify_item")
public class InsOrderFactoryVerifyItem {
    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Integer factoryVerifyItemId;
    @ApiModelProperty(value = "外键: è¿›åŽ‚éªŒè¯è¡¨ id")
    private Integer factoryVerifyId;
    @ApiModelProperty(value = "验证项目")
    private String inspectionItem;
    @ApiModelProperty(value = "验证结果")
    private String result;
    @ApiModelProperty(value = "排序")
    @TableField(fill = FieldFill.INSERT)
    private Integer sort;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderFile.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package com.ruoyi.inspect.pojo;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
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")
@ApiModel(value = "InsOrderFile对象", description = "检验单下的附件列表")
public class InsOrderFile implements Serializable {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty("关联 æ£€éªŒå•外键id")
    private Integer insOrderId;
    @ApiModelProperty("类型")
    private Integer type;
    @ApiModelProperty("附件路径")
    private String fileUrl;
    @ApiModelProperty("附件名称")
    private String fileName;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("上传人")
    @TableField(exist = false, select = false)
    private String name;
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("上传时间")
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package com.ruoyi.inspect.pojo;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
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;
    @ApiModelProperty("模板id")
    private Integer templateId;
    @ApiModelProperty("订单id")
    private Integer insOrderId;
    @ApiModelProperty("模板名称")
    private String name;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("模板结构")
    private String thing;
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("创建人")
    private Integer createUser;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty("修改人")
    private Integer updateUser;
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("创建时间")
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty("修改时间")
    private Date updateTime;
    @ApiModelProperty("模板编号")
    private String number;
}
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.annotations.ApiModelProperty;
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;
    /**
     * å¤–键:ins_order表id
     */
    @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;
    @ApiModelProperty("检验时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime insTime;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @ApiModelProperty("复核人")
    private Integer verifyUser;
    @ApiModelProperty("复核理由")
    private String verifyTell;
}
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderTemplate.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
package com.ruoyi.inspect.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
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 {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * æ¨¡æ¿åç§°
     */
    @ApiModelProperty("模板名称")
    private String name;
    /**
     * æ¨¡æ¿å†…容
     */
    @ApiModelProperty("模板内容")
    private String thing;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
}
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.annotations.ApiModelProperty;
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;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    /**
     * å¤–键:ins_product表id
     */
    private Integer insProductId;
}
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsReport.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,125 @@
package com.ruoyi.inspect.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ£€éªŒæŠ¥å‘Š
 * @TableName ins_report
 */
@TableName(value ="ins_report")
@Data
public class InsReport implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty("报告编号")
    private String code;
    /**
     * å¤–键:检验单id
     */
    @ApiModelProperty("创建时间")
    private Integer insOrderId;
    /**
     * ç³»ç»Ÿç”ŸæˆæŠ¥å‘Šåœ°å€
     */
    @ApiModelProperty("创建时间")
    private String url;
    /**
     * æ‰‹åŠ¨ä¸Šä¼ æŠ¥å‘Šåœ°å€
     */
    @ApiModelProperty("创建时间")
    private String urlS;
    /**
     * ä¸´æ—¶æŠ¥å‘Šåœ°å€
     */
    @ApiModelProperty("创建时间")
    private String tempUrlPdf;
    /**
     * 1:批准 0:不批准
     */
    @ApiModelProperty("批准状态")
    private Integer isRatify;
    @ApiModelProperty("批准备注")
    private String ratifyTell;
    /**
     * 1:审核通过 0:审核不通过
     */
    @ApiModelProperty("审核状态")
    private Integer isExamine;
    @ApiModelProperty("审核备注")
    private String examineTell;
    /**
     * å¤–键:用户id(提交人)
     */
    @ApiModelProperty("创建时间")
    private Integer writeUserId;
    /**
     * å¤–键:用户id(批准人)
     */
    @ApiModelProperty("创建时间")
    private Integer ratifyUserId;
    /**
     * å¤–键:用户id(审核人)
     */
    @ApiModelProperty("创建时间")
    private Integer examineUserId;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    /**
     * 1:已提交 0:待提交
     */
    @ApiModelProperty("提交状态")
    private Integer state;
    @ApiModelProperty("提交时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime writeTime;
    @ApiModelProperty("审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime examineTime;
    @ApiModelProperty("批准时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime ratifyTime;
    @ApiModelProperty(value = "是否是通过的报告, 0:未通过, 1:通过")
    private Integer isPass;
}
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.annotations.ApiModelProperty;
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;
    /**
     * å¤–键:检验样品ins_sample表id
     */
    private Integer insSampleId;
    /**
     * å¤–键:用户id è´Ÿè´£äºº
     */
    private Integer userId;
    /**
     * 1:确认 0:未确认
     */
    //1是复核人 0是检验人
    private Integer state;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty("修改时间")
    @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;
    }
}
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnPass.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,83 @@
package com.ruoyi.inspect.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * @author æœ±ä½³å‰
 * @date 2024/5/8 14:11
 */
@Data
@TableName("ins_un_pass")
public class InsUnPass implements Serializable {
    /**
     * ä¸åˆæ ¼id
     */
    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * è§„格型号
     */
    @ApiModelProperty("规格型号")
    private String model;
    /**
     * æ ·å“åç§°
     */
    @ApiModelProperty("样品名称")
    private String sample;
    /**
     * æ£€æµ‹é¡¹
     */
    @ApiModelProperty("检测项")
    private String inspectionItem;
    /**
     * æ£€æµ‹å­é¡¹
     */
    @ApiModelProperty("检测子项")
    private String inspectionItemSubclass;
    /**
     * æ£€æµ‹ç»“æžœ
     */
    @ApiModelProperty("检测结果")
    @TableField("`last_value`")
    private String lastValue;
    /**
     * å¤„理意见
     */
    @ApiModelProperty("处理意见")
    private String handleSuggestion;
    /**
     * å§”托编号
     */
    @ApiModelProperty("委托编号")
    private String entrustCode;
    /**
     * ç”¨æˆ·å
     */
    @ApiModelProperty("检验人")
    private String name;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsUnqualifiedHandler.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,131 @@
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.annotations.ApiModelProperty;
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
     */
    @ApiModelProperty(value = "主键id")
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * ç¼–号
     */
    @ApiModelProperty(value = "编号")
    private String no;
    /**
     * æ ‡é¢˜
     */
    @ApiModelProperty(value = "标题")
    private String headline;
    /**
     * ç‰©æ–™åç§°
     */
    @ApiModelProperty(value = "物料名称")
    private String materialName;
    /**
     * ç”Ÿäº§æ‰¹æ¬¡
     */
    @ApiModelProperty(value = "生产批次")
    private String productionBatch;
    /**
     * åˆ°è´§æ•°é‡
     */
    @ApiModelProperty(value = "到货数量")
    private String cargoQuantity;
    /**
     * è§„格型号
     */
    @ApiModelProperty(value = "规格型号")
    private String specsModels;
    /**
     * æŠ¥æ£€æ—¥æœŸ
     */
    @ApiModelProperty(value = "报检日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate inspectTime;
    /**
     * åé¦ˆäºº
     */
    @ApiModelProperty(value = "反馈人")
    private String feedbackUser;
    /**
     * åé¦ˆæ—¥æœŸ
     */
    @ApiModelProperty(value = "反馈日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate feedbackTime;
    /**
     * åˆ†ç±»
     */
    @ApiModelProperty(value = "")
    private String classification;
    /**
     * ä¸åˆæ ¼å½’属
     */
    @ApiModelProperty(value = "不合格归属")
    private String offGradeAscription;
    /**
     * ä¸åˆæ ¼æè¿°
     */
    @ApiModelProperty(value = "不合格描述")
    private String unqualifiedDesc;
    /**
     * åŽŸææ–™æ£€éªŒid
     */
    @ApiModelProperty(value = "原材料检验id")
    private Integer inventoryQuantityId;
    /**
     * åŽŸææ–™æ£€éªŒid
     */
    @ApiModelProperty(value = "订单id")
    private Integer insOrderId;
    /**
     * oa工作流id
     */
    @ApiModelProperty(value = "oa工作流id")
    private Integer requestId;
    /**
     * oa审核状态(1:待审核 2:审核中 3:通过 4:驳回)
     */
    @ApiModelProperty(value = "oa审核状态")
    private Integer oaState;
    /**
     * oa附件url地址
     */
    @ApiModelProperty("oa附件url地址")
    private String fileUrl;
}
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.annotations.ApiModelProperty;
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
     */
    @ApiModelProperty(value = "主键id")
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * ä¸åˆæ ¼å¤„理id
     */
    @ApiModelProperty(value = "不合格处理id")
    private Long unqualifiedId;
    /**
     * æ–‡ä»¶ç±»åž‹(1:图片 2:文件)
     */
    @ApiModelProperty(value = "文件类型(1:图片 2:文件)")
    private Integer type;
    /**
     * æ–‡ä»¶ä¸Šä¼ è·¯å¾„
     */
    @ApiModelProperty(value = "文件上传路径")
    private String fileUrl;
    /**
     * æ–‡ä»¶åç§°
     */
    @ApiModelProperty(value = "文件名称")
    private String fileName;
    /**
     * åˆ›å»ºäºº
     */
    @ApiModelProperty(value = "创建人")
    @TableField(fill= FieldFill.INSERT)
    private Integer createUser;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill= FieldFill.INSERT)
    private LocalDateTime createTime;
    /**
     * æ›´æ–°äºº
     */
    @ApiModelProperty(value = "更新人")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    /**
     * æ›´æ–°æ—¶é—´
     */
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
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.annotations.ApiModelProperty;
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;
    //外键:不合格检验项目id
    private Integer retestProductId;
    //检验值
    private String insValue;
    //计算值
    private String comValue;
    //设备编码
    private String equipValue;
    //设备名称
    private String equipName;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
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.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * å­£åº¦æŠ½æ ·è®¡åˆ’
 *
 * @author zhuo
 * @since 2024-10-09
 */
@TableName(value = "spot_check_quarter")
@Data
public class SpotCheckQuarter implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer quarterId;
    @ApiModelProperty("编号")
    private String quarterNo;
    @ApiModelProperty("报告生成地址")
    private String fileUrl;
    @ApiModelProperty("季度完成状态")
    private Integer quarterStatus;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("编制人")
    private Integer writeUser;
    @ApiModelProperty("会签人")
    private String countersignUser;
    @ApiModelProperty("审核人")
    private Integer examineUser;
    @ApiModelProperty("批准人")
    private Integer ratifyUser;
    @ApiModelProperty(value = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
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.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
 * å­£åº¦æŠ½æ ·è®¡åˆ’详情表
 *
 * @author makejava
 * @since 2024-10-09
 */
@TableName(value ="spot_check_quarter_item")
@Data
public class SpotCheckQuarterItem {
    @TableId(type = IdType.AUTO)
    private Integer quarterItemId;
    @ApiModelProperty("主表id")
    private Integer quarterId;
    @ApiModelProperty("产品类型")
    private String productType;
    @ApiModelProperty("产品型号")
    private String productModel;
    @ApiModelProperty("责任人")
    private String dutyUser;
    @ApiModelProperty("抽样数量")
    private String spotCheckNumber;
    @ApiModelProperty("抽样时间")
    private String spotCheckTime;
    @ApiModelProperty("试样结论")
    private String result;
    @ApiModelProperty("取样人员")
    private String samplingUser;
    @ApiModelProperty("备注")
    private String itemRemark;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
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.annotations.ApiModelProperty;
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;
    @ApiModelProperty("名称")
    private String yearHead;
    @ApiModelProperty("报告生成地址")
    private String fileUrl;
    @ApiModelProperty("表格内备注")
    private String tableRemark;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("编制人")
    private Integer writeUser;
    @ApiModelProperty("会签人")
    private String countersignUser;
    @ApiModelProperty("批准人")
    private Integer examineUser;
    @ApiModelProperty("批准人")
    private Integer ratifyUser;
    @ApiModelProperty(value = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
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.annotations.ApiModelProperty;
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
    @ApiModelProperty("主表id")
    private Integer yearId;
    @ApiModelProperty("类别")
    private String yearType;
    @ApiModelProperty("一月")
    private String january;
    @ApiModelProperty("二月")
    private String february;
    @ApiModelProperty("三月")
    private String march;
    @ApiModelProperty("四月")
    private String april;
    @ApiModelProperty("五月")
    private String may;
    @ApiModelProperty("六月")
    private String june;
    @ApiModelProperty("七月")
    private String july;
    @ApiModelProperty("八月")
    private String august;
    @ApiModelProperty("九月")
    private String september;
    @ApiModelProperty("十月")
    private String october;
    @ApiModelProperty("十一月")
    private String november;
    @ApiModelProperty("十二月")
    private String december;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderService.java
@@ -3,9 +3,11 @@
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.pojo.StandardProductList;
import com.ruoyi.inspect.pojo.InsOrder;
import com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct;
import com.ruoyi.inspect.dto.*;
import com.ruoyi.inspect.vo.InsOrderPrintingVo;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
@@ -21,7 +23,7 @@
public interface InsOrderService extends IService<InsOrder> {
    //获取单位检验下单数据
    Map<String, Object> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto);
    IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto);
    //修改检验下单数据
@@ -35,9 +37,9 @@
    Map<String, Object> getInsOrderAndSample(Integer id, String laboratory);
    Map<String, Object> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, SampleProductDto2 sampleProductDto);
    IPage<SampleProductDto2> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, SampleProductDto2 sampleProductDto);
    Map<String, Object> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto);
    IPage<CostStatisticsDto> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto);
    Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto);
inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
package com.ruoyi.inspect.service;
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.pojo.InsOrder;
import com.ruoyi.inspect.pojo.InsProduct;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€ins_product(检验项目)】的数据库操作Service
* @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(InsOrder insOrder);
    Map<String,Object> 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);
}
inspect-server/src/main/java/com/ruoyi/inspect/service/InsReportService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
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 java.io.IOException;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€ins_report(检验报告)】的数据库操作Service
* @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);
    int upAll(MultipartFile file) throws IOException;
    void isRawMaterial(InsOrder insOrder);
    Long getUnqualifiedCount(InsOrder insOrder);
    /**
     * ç§»åº“操作
     * @param one
     * @return
     */
    String moveRawMaterial(IfsInventoryQuantity one);
    /**
     * é€€å›žåˆ°æ£€éªŒä»»åŠ¡
     * @param id
     * @return
     */
    boolean sendBackTask(Integer id);
}
inspect-server/src/main/java/com/ruoyi/inspect/service/InsSampleService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
package com.ruoyi.inspect.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.inspect.pojo.InsSample;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€ins_sample(检验样品)】的数据库操作Service
* @createDate 2024-03-14 17:14:57
*/
public interface InsSampleService extends IService<InsSample> {
}
inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderService.java
@@ -28,7 +28,7 @@
     * @param ifsInventoryQuantity
     * @return
     */
    Map<String,Object> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity);
    IPage<IfsInventoryQuantity> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity);
    /**
     * æŸ¥è¯¢æ£€éªŒå€¼
@@ -36,7 +36,7 @@
     * @param ifsInventoryQuantityDto
     * @return
     */
    Map<String,Object> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto);
    IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto);
    int inspectionReport(List<Integer> ids);
@@ -63,7 +63,7 @@
     */
    int addExemptionOrder(List<SampleProductDto> list, InsOrder insOrder);
    Map<String,Object> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, IfsInventoryQuantityCheckDto ifsInventoryQuantity);
    IPage<IfsInventoryQuantityCheckDto> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, IfsInventoryQuantityCheckDto ifsInventoryQuantity);
    /**
     * æŸ¥è¯¢å·²æ£€éªŒ
@@ -71,7 +71,7 @@
     * @param ifsInventoryQuantityDto
     * @return
     */
    Map<String,Object>  getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto);
    IPage<IfsInventoryQuantitySupplierDto>  getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto);
    int delIfsInventory(Integer id);
@@ -138,7 +138,7 @@
     * @param ifsInventoryQuantityDto
     * @return
     */
    Map<String,Object> getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto);
    IPage<IfsInventoryQuantitySupplierDto> getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto);
    /**
     * advancedGodown
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1050 @@
//package com.ruoyi.inspect.service.impl;
//
//import cn.hutool.core.collection.CollUtil;
//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.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
//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.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.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
//import com.ruoyi.basic.mapper.StandardProductListMapper;
//import com.ruoyi.basic.pojo.IfsInventoryQuantity;
//import com.ruoyi.basic.pojo.StandardProductList;
//import com.ruoyi.basic.pojo.StructureTestObject;
//import com.ruoyi.common.constant.InsOrderTypeConstants;
//import com.ruoyi.common.core.domain.entity.User;
//import com.ruoyi.common.numgen.NumberGenerator;
//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.InsOrderService;
//import com.ruoyi.inspect.service.InsProductService;
//import com.ruoyi.inspect.service.InsSampleService;
//import com.ruoyi.inspect.vo.InsOrderPrintingVo;
//import com.ruoyi.inspect.vo.SampleDefectsFatherVo;
//import com.ruoyi.system.mapper.CustomMapper;
//import com.ruoyi.system.mapper.UserMapper;
//import lombok.AllArgsConstructor;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.BeanUtils;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.math.BigDecimal;
//import java.net.URLEncoder;
//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 é’ˆå¯¹è¡¨ã€ins_order(检验下单)】的数据库操作Service实现
// * @createDate 2024-03-12 16:17:55
// */
//@Service
//@AllArgsConstructor
//public class InsOrderServiceImpl extends ServiceImpl<InsOrderMapper, InsOrder>
//        implements InsOrderService {
//
//    private InsOrderMapper insOrderMapper;
//    private InsSampleService insSampleService;
//    private InsSampleMapper insSampleMapper;
//    private InsProductService insProductService;
//    private InsProductMapper insProductMapper;
//    private InsProductUserMapper insProductUserMapper;
//    private InsSampleUserMapper insSampleUserMapper;
//    private InsOrderStateMapper insOrderStateMapper;
//    private UserMapper userMapper;
//    private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
//    private CustomMapper customMapper;
//    private final NumberGenerator<InsOrder> numberGenerator;
//    private InsReportMapper insReportMapper;
//    private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper;
//    private IfsApiUtils ifsApiUtils;
//    private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper;
//    private StandardProductListMapper standardProductListMapper;
//
//
//
//    //获取检验下单数据
//    @Override
//    public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) {
//        //todo: åªçœ‹æˆ‘判断全部,个人,组织的权限
//        String laboratory = null;
//        // åˆ¤æ–­æ˜¯å¦æ˜¯å…¨éƒ¨
//        String isOrderAll = null;
//        if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) {
//            isOrderAll = "1";
//            sampleOrderDto.setState(null);
//        }
//        IPage<SampleOrderDto> sampleOrderDtoIPage = insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll);
//        return insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll);
//    }
//
//
//    @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).select(InsSample::getId));
//        List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList());
//        List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
//                .in(InsProduct::getInsSampleId, ids)
//                .eq(InsProduct::getState, 1)
//                .select(InsProduct::getSonLaboratory).groupBy(InsProduct::getSonLaboratory));
//        for (InsProduct insProduct : insProducts) {
//            InsOrderState insOrderState = new InsOrderState();
//            insOrderState.setInsOrderId(orderId);
//            try {
//                insOrderState.setLaboratory(insProduct.getSonLaboratory());
//            } catch (NullPointerException e) {
//                throw new ErrorException("该检验单有未维护实验室的检验项目");
//            }
//            insOrderState.setInsState(0);
//            insOrderStateMapper.insert(insOrderState);
//        }
//        if (userId != null) {
//            InsSampleUser insSampleUser = new InsSampleUser();
//            insSampleUser.setState(0);
//            insSampleUser.setUserId(userId);
//            insSampleUser.setInsSampleId(orderId);
//            insSampleUser.setSonLaboratory(sonLaboratory);
//            insSampleUserMapper.insert(insSampleUser);
//        }
//
//        // åˆ¤æ–­è®¢å•有没有绑定抽样计划
//        InsOrder order = insOrderMapper.selectById(orderId);
//        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;
//    }
//
//    @Override
//    @Transactional(rollbackFor = Exception.class)
//    public int addInsOrder(List<SampleProductDto> list, InsOrder insOrder, List<List<Integer>> pairing) {
//        // 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());
//                        }
//                    }
//                }
//            }
//        });
//        //是否为原材料下单
//        if (insOrder.getTypeSource() != null && insOrder.getTypeSource().equals(1)) {
//            // åŽŸææ–™ä¸‹å•: å§”托人就是报检人, ç”Ÿäº§å•位就是供应商单位
//            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);
//            upInsOrder(insOrder.getId(), null, appointed != null ? appointed.toString() : null, SecurityUtils.getUserId().intValue(), "原材料");
//
//
//            // æ ¹æ®é›¶ä»¶å·åˆ¤æ–­æ˜¯å¦æ˜¯è¾…材
//            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) {
//                // èŽ·å–å½“å‰å­£åº¦çš„å¼€å§‹æ—¶é—´å’Œç»“æŸæ—¶é—´
//                LocalDateTime now = LocalDateTime.now();
//                // èŽ·å–å½“å‰æœˆä»½
//                int month = now.getMonthValue();
//                // ç¡®å®šå½“前季度的开始月份
//                int startMonth = (month - 1) / 3 * 3 + 1;
//                // æž„造季度的开始时间
//                LocalDateTime startOfQuarter = LocalDateTime.of(now.getYear(), Month.of(startMonth), 1, 0, 0);
//                // è®¡ç®—下一个季度的开始时间
//                LocalDateTime startOfNextQuarter = startOfQuarter.plusMonths(3);
//                // è®¡ç®—当前季度的结束时间
//                LocalDateTime endOfQuarter = startOfNextQuarter.minusSeconds(1);
//
//                // æ ¹æ®ä¸‹å•的规格型号判断是否为季度首次出现
//                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();
//    }
//
//    /**
//     * æ·»åŠ æ£€éªŒé¡¹
//     * @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("有检验项的要求值或要求描述为空, è¯·å…ˆåŽ»æ ‡å‡†åº“é…ç½®è¦æ±‚å€¼æˆ–è¦æ±‚æè¿°");
//                }
//                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);
//        map.put("insOrder", insOrder);
//        map.put("sampleProduct", list);
//        map.put("insOrderTemplate", map1);
//        return map;
//    }
//
//    @Override
//    public int upInsOrderOfState(InsOrder insOrder) {
//        insOrder.setExamineTime(LocalDateTime.now());
//        if (insOrder.getState() == 1) {
//            //审核通过才会生成委托编号
//            // todo: æ£€éªŒç±»åž‹ç¼–号
//            InsOrder order = this.getById(insOrder.getId());
//            String code = "";
//            switch (order.getOrderType()) {
//                case InsOrderTypeConstants.SPOT_CHECK:
//                    code = "C";
//                    break;
//                case InsOrderTypeConstants.CUSTOMER_ORDERED:
//                    code = "W";
//                    break;
//                case InsOrderTypeConstants.ENTER_THE_FACTORY:
//                case InsOrderTypeConstants.QUARTERLY_TEST:
//                    code = "Y";
//                    break;
//            }
//            // ç”Ÿæˆç¼–号
//            String no = numberGenerator.generateNumberWithPrefix(3,
//                    "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
//                    InsOrder::getEntrustCode);
//            // åˆ¤æ–­æ˜¯å¦æ˜¯å­£åº¦æ£€éªŒ, æ˜¯å­£åº¦æ£€éªŒå–消原材料季度检验下单
//            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();
//                }
//            }
//
//            int count = 1;
//            // æŸ¥è¯¢æ ·å“è¡¨
//            List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery()
//                    .eq(InsSample::getInsOrderId, insOrder.getId()));
//            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);
//        }
//        return insOrderMapper.updateById(insOrder);
//    }
//
//    @Override
//    public Map<String, Object> getInsOrderAndSample(Integer id, String laboratory) {
//        Map<String, Object> map = new HashMap<>();
//        InsOrder insOrder = insOrderMapper.selectById(id);
//        List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory);
//        for (SampleProductDto sampleProductDto : list) {
//            List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList());
//            List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery()
//                    .in(InsProductUser::getInsProductId, ids));
//            if (CollectionUtils.isNotEmpty(insProductUsers)) {
//                List<Integer> userIds = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList());
//                String collect = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(","));
//                sampleProductDto.setCheckName(collect);
//            }
//        }
//        map.put("insOrder", insOrder);
//        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 IPage<CostStatisticsDto> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto) {
//        String dates = costStatisticsDto.getDates();
//        String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(",");
//        costStatisticsDto.setDates(null);
//
//        //todo:仅看自己
//
//        IPage<CostStatisticsDto> dtoIPage = insOrderMapper.selectCostStatistics(page, QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59"));
//        List<CostStatisticsDto> collect = dtoIPage.getRecords().stream().map(dto -> {
//            Set<String> uniqueTags = new HashSet<>();
//            if (dto.getInspectionItem().contains(",")) {
//                for (String s : dto.getInspectionItem().split(",")) {
//                    uniqueTags.add(s.split("@")[0]);
//                }
//            } else {
//                uniqueTags.add(dto.getInspectionItem().split("@")[0]);
//            }
//            dto.setInspectionItem(uniqueTags.toString());
//            return dto;
//        }).collect(Collectors.toList());
//        dtoIPage.setRecords(collect);
//        return dtoIPage;
//    }
//
//    @Override
//    public Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto) {
//        Map<String, Object> map = new HashMap<>();
//        String dates = costStatisticsDto.getDates();
//        String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(",");
//        costStatisticsDto.setDates(null);
//        List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59"));
//        double totalPrice = costStatisticsDtos.stream()
//                .filter(dto -> dto.getPrice() != null) // è¿‡æ»¤æŽ‰ä»·æ ¼ä¸º null çš„对象
//                .mapToDouble(value -> value.getPrice().doubleValue() * value.getNum())
//                .sum();
//        map.put("total", totalPrice);
//        return map;
//    }
//
//    @Override
//    public Map<String, Object> selectSampleDefects(Page page, String inspectionItems, String orderNumber) {
//        List<SampleDefectsFatherVo> sampleDefectsFatherVos = insOrderMapper.selectSampleDefects(page, inspectionItems, orderNumber);
//        Map<String, Object> map = new HashMap<>();
//        map.put("records", sampleDefectsFatherVos);
//        Long aLong = insOrderMapper.getCount(inspectionItems, orderNumber);
//        map.put("total", aLong);
//        return map;
//    }
//
//    @Override
//    public int updateStatus(Integer id) {
//        return insOrderMapper.updateStatus(id);
//    }
//
//
//    @Override
//    public void export(CostStatisticsDto costStatisticsDto, HttpServletResponse response) throws IOException {
//        //查询导出的费用统计数据
//        String dates = costStatisticsDto.getDates();
//        String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(",");
//        costStatisticsDto.setDates(null);
//        List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59"));
//        costStatisticsDtos = costStatisticsDtos.stream().map(dto -> {
//            Set<String> uniqueTags = new HashSet<>();
//            if (dto.getInspectionItem().contains(",")) {
//                for (String s : dto.getInspectionItem().split(",")) {
//                    uniqueTags.add(s.split("@")[0]);
//                }
//            } else {
//                uniqueTags.add(dto.getInspectionItem().split("@")[0]);
//            }
//            dto.setInspectionItem(uniqueTags.toString());
//            return dto;
//        }).collect(Collectors.toList());
//
//        response.setContentType("application/vnd.ms-excel");
//        response.setCharacterEncoding("UTF-8");
//        // è¿™é‡ŒURLEncoder.encode可以防止中文乱码 å½“ç„¶å’Œeasyexcel没有关系
//        String fileName = URLEncoder.encode("样品费用统计导出", "UTF-8");
//        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
//        Map<String, List<CostStatisticsDto>> groupByCompany =
//                costStatisticsDtos.stream().filter(e -> StrUtil.isNotEmpty(e.getCompany()))
//                        .collect(Collectors.groupingBy(CostStatisticsDto::getCompany));
//        try {
//            // æ–°å»ºExcelWriter
//            // æ–°å»ºExcelWriter
//            ExcelWriter excelWriter =
//                    EasyExcel.write(response.getOutputStream())
//                            .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25))
//                            .build();
//            for (Map.Entry<String, List<CostStatisticsDto>> companyDataEntry : groupByCompany.entrySet()) {
//                String sheetName = companyDataEntry.getKey();
//                List<CostStatisticsDto> dataList = companyDataEntry.getValue();
//                WriteSheet mainSheet = EasyExcel.writerSheet(sheetName)
//                        .head(CostStatisticsDto.class)
//                        .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25))
//                        .build();
//                excelWriter.write(dataList, mainSheet);
//            }
//            // å…³é—­æµ
//            excelWriter.finish();
//        } catch (IOException e) {
//            throw new RuntimeException("导出失败");
//        }
//    }
//
//    /**
//     * èŽ·å–ifs库存信息
//     * @param
//     * @return
//     */
//    @Override
//    public void getIfsOrder() {
//        HashMap<String, Object> map = new HashMap<>();
//        map.put("LOCATION_NO","1302");
//        map.put("STATE_DB","To be Inspected");
//        List<Map<String, Object>> inventory = ifsApiUtils.getInventory(JSONUtil.toJsonStr(map));
//        if(inventory.size() == 0) {
//            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()); // ä¾›åº”商ID
//            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);
//
//            IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(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(Objects.isNull(one)) {
//
//                ifsInventoryQuantity.setIsFirst(0);
//                // æŸ¥è¯¢äº§ä¸šé“¾æ£€æµ‹æ•°æ®
//                String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(),
//                        ifsInventoryQuantity.getLineNo(),
//                        ifsInventoryQuantity.getReleaseNo());
//                ifsInventoryQuantity.setIndustryChain(industryChainAttrFields);
//
//                ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
//            }
//        }
//    }
//
//    /**
//     * id是原材料的id
//     *
//     * ä¿®æ”¹è®¢å•单号
//     * @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(Integer 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.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);
//        upInsOrder(insOrder.getId(), null, appointed != null ? appointed.toString() : null, SecurityUtils.getUserId().intValue(), "原材料");
//
//        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) {
//        // ä¿®æ”¹è®¢å•
//        insOrderUpdateDto.getInsOrder().setState(0);
//        insOrderUpdateDto.getInsOrder().setTell("");
//        insOrderMapper.updateById(insOrderUpdateDto.getInsOrder());
//
//        // ä¿®æ”¹æ£€éªŒé¡¹
//        for (SampleProductDto sampleProductDto : insOrderUpdateDto.getSampleProduct()) {
//            insProductService.updateBatchById(sampleProductDto.getInsProduct());
//        }
//
//        return true;
//    }
//
//    /**
//     * æˆå“æ ‡ç­¾æ‰“印
//     * @param ids
//     * @return
//     */
//    @Override
//    public List<InsOrderPrintingVo> labelOrderPrinting(List<Integer> ids) {
//        return insOrderMapper.labelOrderPrinting(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 = 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));
//        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.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) {
//        //判断全部,个人,组织的权限
//        //todo:仅看我获取当前人所属实验室id
//        String laboratory = null;
//        // åˆ¤æ–­æ˜¯å¦æ˜¯å…¨éƒ¨
//        String isOrderAll = null;
//        if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) {
//            isOrderAll = "1";
//            sampleOrderDto.setState(null);
//        }
//        List<SampleOrderDto> 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可以防止中文乱码 å½“ç„¶å’Œeasyexcel没有关系
//            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();
//
//            //向sheet0写入数据 ä¼ å…¥ç©ºlist这样只导出表头
//            excelWriter.write(sampleOrderDtoList, mainSheet);
//            //关闭流
//            excelWriter.finish();
//        } catch (IOException e) {
//            throw new RuntimeException("导出失败");
//        }
//    }
//
//}
//
//
//
//
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1174 @@
//package com.ruoyi.inspect.service.impl;
//
//import cn.hutool.core.util.StrUtil;
//import cn.hutool.json.JSONUtil;
//import com.aspose.words.*;
//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.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.yuanchu.mom.common.GetLook;
//import com.yuanchu.mom.common.InsOrderTypeConstants;
//import com.yuanchu.mom.common.PrintChina;
//import com.yuanchu.mom.dto.ReportPageDto;
//import com.yuanchu.mom.exception.ErrorException;
//import com.yuanchu.mom.mapper.*;
//import com.yuanchu.mom.pojo.*;
//import com.yuanchu.mom.properties.WechatProperty;
//import com.yuanchu.mom.service.InformationNotificationService;
//import com.yuanchu.mom.service.InsOrderService;
//import com.yuanchu.mom.service.InsReportService;
//import com.yuanchu.mom.utils.DateImageUtil;
//import com.yuanchu.mom.utils.IfsApiUtils;
//import com.yuanchu.mom.utils.QueryWrappers;
//import com.yuanchu.mom.utils.WxCpUtils;
//import com.yuanchu.mom.vo.Result;
//import org.apache.poi.xwpf.usermodel.*;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.annotation.Resource;
//import javax.imageio.ImageIO;
//import java.awt.image.BufferedImage;
//import java.io.*;
//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 é’ˆå¯¹è¡¨ã€ins_report(检验报告)】的数据库操作Service实现
// * @createDate 2024-03-17 22:10:02
// */
//@Service
//public class InsReportServiceImpl extends ServiceImpl<InsReportMapper, InsReport>
//        implements InsReportService {
//
//    @Resource
//    private GetLook getLook;
//    @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;
//    @Value("${file.licenseUrl}")
//    private String licenseUrl;
//    @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;
//
//
//    @Override
//    public Map<String, Object> pageInsReport(Page page, ReportPageDto reportPageDto) {
//        Map<String, Object> map = new HashMap<>();
//        map.put("head", PrintChina.printChina(ReportPageDto.class));
//        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("pageInsReport");
//        User user = userMapper.selectById(map1.get("userId"));//当前登录的人
//        //获取当前人所属实验室id
//        String departLimsId = user.getDepartLimsId();
//        String laboratory = null;
////        if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) {
////            String[] split = departLimsId.split(",");
////            //查询对应架构名称(通信实验室,电力实验室,检测办)
////            String departLims = insOrderMapper.seldepLimsId(Integer.parseInt(split[split.length - 1]));
////            if (departLims.contains("实验室")) {
////                laboratory = departLims;
////            }
////        }
//
//        Integer createOrderUser = null;
//        if (map1.get("look") == 1) {
//            //个人
//            createOrderUser = map1.get("userId");
//        }
//        String queryStatus = reportPageDto.getQueryStatus();
//        reportPageDto.setQueryStatus(null);
//
//        map.put("body", insReportMapper.pageInsReport(page,
//                QueryWrappers.queryWrappers(reportPageDto),
//                laboratory,
//                map1.get("userId"),
//                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 ? getLook.selectPowerByMethodAndUserId(null).get("userId") : 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("b1-report-preparation");
//        informationNotificationService.addInformationNotification(info);
//        //系统生成报告地址
//        String url = insReport.getUrl();
//        //手动上传报告地址
//        String urlS = insReport.getUrlS();
//
//        // åˆ¤æ–­æ˜¯å¦æ˜¯åŽŸææ–™  éœ€è¦æ›¿æ¢****成供应商
//        IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>()
//                .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()));
//        if (one != null) {
//            if (isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) {
//                changeText(new HashMap<String, String>() {{
//                    put("**********", one.getSupplierName());
//                }}, (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl));
//            }
//        }
//
//        wordInsertUrl(new HashMap<String, Object>() {{
//            put("writeUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
//            put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
//            put("insUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
//        }}, (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl));
//
//        // ä¿®æ”¹ä¸´æ—¶pdf
//        String tempUrlPdf = wordToPdfTemp((StrUtil.isBlank(urlS) ? url : urlS).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 = getLook.selectPowerByMethodAndUserId(null).get("userId");
//        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("缺少批准人");
//            }
//        }
//        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");
//
//        //发送消息
//        //当前用户
//        Integer currentUser = getLook.selectPowerByMethodAndUserId(null).get("userId");
//        InformationNotification info = new InformationNotification();
//        info.setCreateUser(insProductMapper.selectUserById(userId).get("name"));
//        info.setMessageType("3");
//        info.setTheme("批准通知");
//        info.setContent("您有一条报告编制待批准消息, ç¼–号:" + insReport.getCode());
//        info.setSenderId(currentUser);    //发送人
//        info.setConsigneeId(userId);     //收件人
//        info.setViewStatus(false);
//        info.setJumpPath("b1-report-preparation");
//        informationNotificationService.addInformationNotification(info);
//        //系统生成报告地址
//        String url = insReport.getUrl();
//        //手动上传报告地址
//        String urlS = insReport.getUrlS();
//        wordInsertUrl(new HashMap<String, Object>() {{
//            put("examineUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
//            put("examineDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
//        }}, (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl));
//
//        // ä¿®æ”¹ä¸´æ—¶pdf
//        String tempUrlPdf = wordToPdfTemp((StrUtil.isBlank(urlS) ? url : urlS).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);
//        insReport.setIsRatify(isRatify);
//        if (ObjectUtils.isNotEmpty(ratifyTell)) {
//            insReport.setRatifyTell(ratifyTell);
//        }
//        insReport.setRatifyTime(LocalDateTime.now());//批准时间
//        if (isRatify == 0) {
//
//            // æ‰¹å‡†äºº
//            Integer ratifyUserId = getLook.selectPowerByMethodAndUserId(null).get("userId");
//            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 url = insReport.getUrl();
//        //手动上传报告地址
//        String urlS = insReport.getUrlS();
//        String finalUrl = (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl);
//
//        wordInsertUrl(new HashMap<String, Object>() {{
//            put("ratifyUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
//            put("ratifyDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
//            put("seal1", Pictures.ofLocal(imgUrl + "/" + sealUrl).create());
//            put("seal2", Pictures.ofLocal(imgUrl + "/" + sealUrl).create());
//        }}, finalUrl);
//
//        // ä¿®æ”¹ä¸´æ—¶pdf
//        insReport.setTempUrlPdf((StrUtil.isBlank(urlS) ? url : urlS).replace(".docx", ".pdf"));
//
//        InsOrder insOrder = new InsOrder();
//        insOrder.setId(insOrderId);
//        insOrder.setState(4);
//        insOrderMapper.updateById(insOrder);
//
//        wordToPdf(finalUrl, 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) {
//        XWPFTemplate template = XWPFTemplate.compile(url).render(map);
//        try {
//            template.writeAndClose(Files.newOutputStream(Paths.get(url)));
//        } catch (IOException e) {
//            throw new RuntimeException(e);
//        }
//        return 1;
//    }
//
//
//    //报告批量下载
//    @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";
//            zipDirectory(tempFolderPath, zipFilePath);
//
//            // æ¸…理临时文件夹
//            deleteDirectory(tempFolder);
//
//            System.out.println("ZIP文件创建完成!");
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        return "/word/zip/output.zip";
//    }
//
//    //批量上传
//    @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);
//            // å¤„理解压后的文件
//            File[] files = unzipDir.listFiles();
//            if (files != null) {
//                for (File f : files) {
//                    // æ ¹æ®æ–‡ä»¶åæŸ¥è¯¢id
//                    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();
//            }
//            // é€’归删除解压目录及其中的文件
//            if (unzipDir.exists()) {
//                deleteDirectory(unzipDir); // åˆ é™¤æ—§çš„临时文件夹
//            }
//        }
//        return 0;
//    }
//
//
//    //解压文件夹
//    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 = this.getClass().getResourceAsStream("/lib/license.xml");
////            InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("license.xml");
//            InputStream is = Files.newInputStream(new File(licenseUrl).toPath());
//            License license = new License();
//            license.setLicense(is);
//            if (!license.getIsLicensed()) {
//                System.out.println("License验证不通过...");
//                return null;
//            }
//            //生成一个空的PDF文件
//            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 {//前n-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  åŽŸPDF路径
//     * @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();
//    }
//
//    @Transactional(rollbackFor = Exception.class)
//    public void isRawMaterial(InsOrder insOrder) {
//        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)) {
//            // åŽŸææ–™ç§»åº“
//            toLocation = this.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();
//                // å‘送企业inspectStatus信通知
//                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;
//    }
//
//    /**
//     * ifs移库操作
//     * @param one
//     * @return
//     */
//    @Override
//    public String moveRawMaterial(IfsInventoryQuantity one) {
//        String toLocation;
//        // ç™»è®°é‡‡è´­æ£€éªŒç»“æžœSTD
//        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.getMessage());
//            }
//        }
//        insOrderService.updateIfsInventoryQuantity(one.getId());
//        /**
//         * TODO åŽç»­éœ€è¦è°ƒç”¨IFS的接口 ç§»å…¥çš„库位号 toLocation
//         */
//        // æ£€éªŒåŽç§»åº“
//        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.getQtyArrived());
//        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.getMessage();
//            if (message.contains("必须为零件") && message.contains("指定批号")) {
//                updaeBatch(one, toLocation);
//            } else {
//                throw new ErrorException("IFS检验后移库失败: " + result1.getMessage());
//            }
//        }
//        return toLocation;
//    }
//
//    /**
//     * é€€å›žåˆ°æ£€éªŒä»»åŠ¡
//     * @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 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.getMessage());
//            }
//            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.getMessage());
//        }
//
//    }
//
//    /**
//     * æ›¿æ¢æ®µè½æ–‡æœ¬
//     * @param filePath docx解析对象
//     * @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 = Files.newInputStream(new File(licenseUrl).toPath());
//            License license = new License();
//            license.setLicense(is);
//            if (!license.getIsLicensed()) {
//                System.out.println("License验证不通过...");
//                return null;
//            }
//            //生成一个空的PDF文件
//            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;
//    }
//}
//
//
//
//
//
//
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsSampleServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
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;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€ins_sample(检验样品)】的数据库操作Service实现
* @createDate 2024-03-14 17:14:57
*/
@Service
public class InsSampleServiceImpl extends ServiceImpl<InsSampleMapper, InsSample>
    implements InsSampleService {
}
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -1,861 +1,847 @@
package com.ruoyi.inspect.service.impl;
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.StrUtil;
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.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.FactoryDto;
import com.ruoyi.basic.dto.LaboratoryDto;
import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto;
import com.ruoyi.basic.dto.SampleTypeDto;
import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
import com.ruoyi.basic.mapper.StandardTreeMapper;
import com.ruoyi.inspect.pojo.InsOrder;
import com.ruoyi.inspect.service.InsOrderService;
import com.ruoyi.inspect.service.RawMaterialOrderService;
import com.ruoyi.common.numgen.NumberGenerator;
import com.ruoyi.framework.exception.ErrorException;
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.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
 * @Author zhuo
 * @Date 2024/7/31
 */
@Service
@AllArgsConstructor
public class RawMaterialOrderServiceImpl implements RawMaterialOrderService {
    private StandardTreeMapper standardTreeMapper;
    private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
    private GetLook getLook;
    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;
    @Override
    public RawMaterialStandardTreeDto selectStandardTreeListByPartNo(String partNo) {
        if (StringUtils.isBlank(partNo)) {
            throw new ErrorException("零件号丢失");
        }
        List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeListByPartNo(partNo);
        if (CollectionUtil.isEmpty(factoryDtos)) {
            throw new ErrorException("零件号为" + partNo + "的原材料没有对应的标准库配置");
        }
        RawMaterialStandardTreeDto rawMaterialStandardTreeDto = new RawMaterialStandardTreeDto();
        for (FactoryDto factoryDto : factoryDtos) {
            for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
                for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
                    if (sampleTypeDto.getChildren().size() == 0) {
                        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 rawMaterialStandardTreeDto;
    }
    @Override
    public Map<String, Object> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) {
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(IfsInventoryQuantity.class));
        map.put("body", standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity)));
        return map;
    }
    @Override
    public Map<String, Object> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) {
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("getIfsByStateOne");
        if (map1.get("look") == 1) {
            //个人
            ifsInventoryQuantityDto.setCreateUser(map1.get("userId"));
        }
        Map<String, Object> map = new HashMap<>();
//        ifsInventoryQuantityDto.setOrderState(null);
        map.put("head", PrintChina.printChina(IfsInventoryQuantityDto.class));
        map.put("body", standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto)));
        return map;
    }
    /**
     * æŠ¥æ£€
     * @param ids
     * @return
     */
    @Override
    public int inspectionReport(List<Integer> ids) {
        Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
        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::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(Integer 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);
    }
    /**
     * æŠ¥æ£€
     * @param ifsInventoryQuantity
     * @return
     */
    @Override
    public int inspectionReportOne(IfsInventoryQuantity ifsInventoryQuantity) {
        Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
        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())
        );
        threadPoolTaskExecutor.execute(() -> {
            IfsInventoryQuantity inventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryQuantity.getId());
            // ä¼ä¸šå¾®ä¿¡é€šçŸ¥
            String message = "";
            message += "新增报检通知";
            message += "\n批次号: " + inventoryQuantity.getUpdateBatchNo();
            message += "\n零件描述: " + inventoryQuantity.getPartDesc();
            message += "\n抵达数量: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
            WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
        });
        return 1;
    }
    /**
     * èŽ·å–é“œäº§ä¸šé“¾æ£€æµ‹æ•°æ®
     * @param id
     * @return
     */
    @Override
    public String getIndustryChain(Integer id) {
        return ifsInventoryQuantityMapper.selectById(id).getIndustryChain();
    }
    /**
     * åŽŸææ–™æ’¤é”€æŽ¥å£
     * @param ifsInventoryId
     * @return
     */
    @Override
    public boolean repealRawOrder(Integer 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);
        return insOrder.getId();
    }
    /**
     * æŸ¥è¯¢å¾…下单
     * @param page
     * @param ifsInventoryQuantity
     * @return
     */
    @Override
    public Map<String, Object> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, IfsInventoryQuantityCheckDto ifsInventoryQuantity) {
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(IfsInventoryQuantityCheckDto.class));
        map.put("body", standardTreeMapper.selectIfsInventoryQuantity(page, QueryWrappers.queryWrappers(ifsInventoryQuantity)));
        return map;
    }
    /**
     * æŸ¥è¯¢å·²æ£€éªŒ
     * @param page
     * @param ifsInventoryQuantityDto
     * @return
     */
    @Override
    public Map<String, Object> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("getIfsByStateOne");
        if (map1.get("look") == 1) {
            //个人
            ifsInventoryQuantityDto.setCreateUser(map1.get("userId"));
        }
        String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
        String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
        ifsInventoryQuantityDto.setBeginDeclareDate(null);
        ifsInventoryQuantityDto.setEndDeclareDate(null);
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(IfsInventoryQuantitySupplierDto.class));
        map.put("body", standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate));
        return map;
    }
    /**
     * åˆ é™¤åŽŸææ–™æŠ¥æ£€ä¿¡æ¯
     * @param id
     * @return
     */
    @Override
    public int delIfsInventory(Integer id) {
        return ifsInventoryQuantityMapper.deleteById(id);
    }
    /**
     * åŽŸææ–™æ”¾è¡Œå…æ£€
     * @param ifsInventoryId
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean rawOrderRelease(Integer 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);
        return true;
    }
    /**
     * 0, æ— æç¤º, 1提示  å½“前批次的样品已检验过, å¯ä»¥å…æ£€, 2 æç¤º å½“前批次的样品已超20吨, éœ€è¦å¤šçº§å¤šæ¬¡æ£€éªŒ
     *
     * åŽŸææ–™ä¸‹å•é€šçŸ¥å…æ£€æˆ–è€…å¤šæ¬¡æ£€éªŒ
     * @param ifsInventoryId
     * @return
     */
    @Override
    public int notificationRawOrder(Integer 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) {
            // åˆ¤æ–­å•位是kg或者t
            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);
        ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
    }
    @Override
    public void shiftingParking(List<Integer> ids) {
        for (Integer id : ids) {
            InsOrder order = insOrderService.getById(id);
            // todo: ifs直接移库
            insReportService.isRawMaterial(order);
        }
    }
    /**
     * é“œå•丝下单免检
     * @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());
        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(Integer ifsInventoryId) {
        // æŸ¥è¯¢åŽŸææ–™ä¿¡æ¯
        IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
        if (!ifsInventoryQuantity.getInspectStatus().equals(2)) {
            throw new ErrorException("不合格的原材料才能让步放行");
        }
        // todo:需要判断oa流程是否是让步放行
        String toLocation = insReportService.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 {
        //查询导出的费用统计数据
        String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
        String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
        ifsInventoryQuantityDto.setBeginDeclareDate(null);
        ifsInventoryQuantityDto.setEndDeclareDate(null);
        List<IfsInventoryQuantitySupplierDto> 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可以防止中文乱码 å½“ç„¶å’Œeasyexcel没有关系
        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();
            //向sheet0写入数据 ä¼ å…¥ç©ºlist这样只导出表头
            excelWriter.write(ifsByOverList, mainSheet);
            //关闭流
            excelWriter.finish();
        } catch (IOException e) {
            throw new RuntimeException("导出失败");
        }
    }
    /**
     * åŽŸææ–™æŸ¥è¯¢å¯ä»¥å­£åº¦æ£€éªŒçš„å†…å®¹
     * @param page
     * @param ifsInventoryQuantityDto
     * @return
     */
    @Override
    public Map<String, Object> getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("getIfsByStateOne");
        if (map1.get("look") == 1) {
            //个人
            ifsInventoryQuantityDto.setCreateUser(map1.get("userId"));
        }
        String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
        String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
        ifsInventoryQuantityDto.setBeginDeclareDate(null);
        ifsInventoryQuantityDto.setEndDeclareDate(null);
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(IfsInventoryQuantitySupplierDto.class));
        map.put("body", standardTreeMapper.getIfsByQuarter(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate));
        return map;
    }
    /**
     * æå‰å…¥åº“
     * @param ifsInventoryId
     * @return
     */
    @Override
    public boolean advancedGodown(Integer ifsInventoryId) {
        // æŸ¥è¯¢åŽŸææ–™ä¿¡æ¯
        IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
        if (!ifsInventoryQuantity.getInspectStatus().equals(0)
                && !ifsInventoryQuantity.getInspectStatus().equals(3)) {
            throw new ErrorException("未检测完成数据才能提前入库");
        }
        // todo:需要判断oa流程是否是让步放行
        String toLocation = insReportService.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;
    }
    /**
     * æ·»åŠ å·¥æ—¶
     * @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(getLook.selectPowerByMethodAndUserId(null).get("userId"));//检测人
        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 "未知";
        }
    }
}
//package com.ruoyi.inspect.service.impl;
//
//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.StrUtil;
//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.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.pojo.IfsInventoryQuantity;
//import com.ruoyi.common.constant.InsOrderTypeConstants;
//import com.ruoyi.common.core.domain.entity.User;
//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.framework.properties.WechatProperty;
//import com.ruoyi.inspect.dto.CopperInsOrderDto;
//import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto;
//import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
//import com.ruoyi.basic.mapper.StandardTreeMapper;
//import com.ruoyi.inspect.dto.SampleProductDto;
//import com.ruoyi.inspect.mapper.InsOrderMapper;
//import com.ruoyi.inspect.mapper.InsProductMapper;
//import com.ruoyi.inspect.mapper.InsSampleMapper;
//import com.ruoyi.inspect.pojo.InsOrder;
//import com.ruoyi.inspect.pojo.InsReport;
//import com.ruoyi.inspect.service.InsOrderService;
//import com.ruoyi.inspect.service.InsReportService;
//import com.ruoyi.inspect.service.RawMaterialOrderService;
//import com.ruoyi.common.numgen.NumberGenerator;
//import com.ruoyi.framework.exception.ErrorException;
//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.Transactional;
//
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.io.UnsupportedEncodingException;
//import java.math.BigDecimal;
//import java.net.URLEncoder;
//import java.text.SimpleDateFormat;
//import java.time.LocalDateTime;
//import java.time.format.DateTimeFormatter;
//import java.util.*;
//import java.util.concurrent.atomic.AtomicInteger;
//
///**
// * @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;
//
//
//    @Override
//    public RawMaterialStandardTreeDto selectStandardTreeListByPartNo(String partNo) {
//        if (StringUtils.isBlank(partNo)) {
//            throw new ErrorException("零件号丢失");
//        }
//        List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeListByPartNo(partNo);
//        if (CollectionUtil.isEmpty(factoryDtos)) {
//            throw new ErrorException("零件号为" + partNo + "的原材料没有对应的标准库配置");
//        }
//        RawMaterialStandardTreeDto rawMaterialStandardTreeDto = new RawMaterialStandardTreeDto();
//        for (FactoryDto factoryDto : factoryDtos) {
//            for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
//                for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
//                    if (sampleTypeDto.getChildren().size() == 0) {
//                        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 rawMaterialStandardTreeDto;
//    }
//
//    @Override
//    public IPage<IfsInventoryQuantity> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) {
//        return standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
//    }
//
//    @Override
//    public IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) {
//        return standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto));
//    }
//
//
//    /**
//     * æŠ¥æ£€
//     * @param ids
//     * @return
//     */
//    @Override
//    public int inspectionReport(List<Integer> ids) {
//        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::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(Integer 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);
//    }
//
//    /**
//     * æŠ¥æ£€
//     * @param ifsInventoryQuantity
//     * @return
//     */
//    @Override
//    public int inspectionReportOne(IfsInventoryQuantity ifsInventoryQuantity) {
//        Integer userId = SecurityUtils.getUserId().intValue();
//        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())
//        );
//
//        threadPoolTaskExecutor.execute(() -> {
//            IfsInventoryQuantity inventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryQuantity.getId());
//            // ä¼ä¸šå¾®ä¿¡é€šçŸ¥
//            String message = "";
//            message += "新增报检通知";
//            message += "\n批次号: " + inventoryQuantity.getUpdateBatchNo();
//            message += "\n零件描述: " + inventoryQuantity.getPartDesc();
//            message += "\n抵达数量: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
//            WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
//        });
//        return 1;
//    }
//
//    /**
//     * èŽ·å–é“œäº§ä¸šé“¾æ£€æµ‹æ•°æ®
//     * @param id
//     * @return
//     */
//    @Override
//    public String getIndustryChain(Integer id) {
//        return ifsInventoryQuantityMapper.selectById(id).getIndustryChain();
//    }
//
//    /**
//     * åŽŸææ–™æ’¤é”€æŽ¥å£
//     * @param ifsInventoryId
//     * @return
//     */
//    @Override
//    public boolean repealRawOrder(Integer 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);
//
//        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);
//
//        return standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
//    }
//
//    /**
//     * åˆ é™¤åŽŸææ–™æŠ¥æ£€ä¿¡æ¯
//     * @param id
//     * @return
//     */
//    @Override
//    public int delIfsInventory(Integer id) {
//        return ifsInventoryQuantityMapper.deleteById(id);
//    }
//
//    /**
//     * åŽŸææ–™æ”¾è¡Œå…æ£€
//     * @param ifsInventoryId
//     * @return
//     */
//    @Override
//    @Transactional(rollbackFor = Exception.class)
//    public boolean rawOrderRelease(Integer 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);
//        return true;
//    }
//
//    /**
//     * 0, æ— æç¤º, 1提示  å½“前批次的样品已检验过, å¯ä»¥å…æ£€, 2 æç¤º å½“前批次的样品已超20吨, éœ€è¦å¤šçº§å¤šæ¬¡æ£€éªŒ
//     *
//     * åŽŸææ–™ä¸‹å•é€šçŸ¥å…æ£€æˆ–è€…å¤šæ¬¡æ£€éªŒ
//     * @param ifsInventoryId
//     * @return
//     */
//    @Override
//    public int notificationRawOrder(Integer 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) {
//            // åˆ¤æ–­å•位是kg或者t
//            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);
//        ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
//    }
//
//    @Override
//    public void shiftingParking(List<Integer> ids) {
//        for (Integer id : ids) {
//            InsOrder order = insOrderService.getById(id);
//            // todo: ifs直接移库
//            insReportService.isRawMaterial(order);
//        }
//    }
//
//    /**
//     * é“œå•丝下单免检
//     * @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());
//
//        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(Integer ifsInventoryId) {
//        // æŸ¥è¯¢åŽŸææ–™ä¿¡æ¯
//        IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
//        if (!ifsInventoryQuantity.getInspectStatus().equals(2)) {
//            throw new ErrorException("不合格的原材料才能让步放行");
//        }
//
//        // todo:需要判断oa流程是否是让步放行
//        String toLocation = insReportService.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 {
//        //查询导出的费用统计数据
//        String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
//        String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
//        ifsInventoryQuantityDto.setBeginDeclareDate(null);
//        ifsInventoryQuantityDto.setEndDeclareDate(null);
//        List<IfsInventoryQuantitySupplierDto> 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可以防止中文乱码 å½“ç„¶å’Œeasyexcel没有关系
//        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();
//
//            //向sheet0写入数据 ä¼ å…¥ç©ºlist这样只导出表头
//            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);
//
//        return standardTreeMapper.getIfsByQuarter(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
//    }
//
//    /**
//     * æå‰å…¥åº“
//     * @param ifsInventoryId
//     * @return
//     */
//    @Override
//    public boolean advancedGodown(Integer ifsInventoryId) {
//        // æŸ¥è¯¢åŽŸææ–™ä¿¡æ¯
//        IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
//        if (!ifsInventoryQuantity.getInspectStatus().equals(0)
//                && !ifsInventoryQuantity.getInspectStatus().equals(3)) {
//            throw new ErrorException("未检测完成数据才能提前入库");
//        }
//
//        // todo:需要判断oa流程是否是让步放行
//        String toLocation = insReportService.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;
//    }
//
//
//    /**
//     * æ·»åŠ å·¥æ—¶
//     * @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 "未知";
//        }
//    }
//}
inspect-server/src/main/java/com/ruoyi/inspect/vo/DeviationAnalyzeVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,58 @@
package com.ruoyi.inspect.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * åå·®åˆ†æžå¯¹è±¡
 *
 * @Author zhuo
 * @Date 2024/10/25
 */
@Data
public class DeviationAnalyzeVo {
    @ApiModelProperty("厂家检测数据")
    private List<Object> supplierData;
    @ApiModelProperty("本地检测数据")
    private List<Object> localData;
    @ApiModelProperty("绝对偏差")
    private List<Object> absoluteDeviation;
    @ApiModelProperty("平均值")
    private List<Object> average;
    /**
     * åނ家
     */
    @ApiModelProperty("UCL")
    private List<Object> supplierULC;
    @ApiModelProperty("LCL")
    private List<Object> supplierLCL;
    @ApiModelProperty("平均值")
    private List<Object> supplierAverage;
    @ApiModelProperty("极差")
    private List<Object> supplierRange;
    /**
     * æœ¬åœ°
     */
    @ApiModelProperty("UCL")
    private List<Object> localULC;
    @ApiModelProperty("LCL")
    private List<Object> localLCL;
    @ApiModelProperty("平均值")
    private List<Object> localAverage;
    @ApiModelProperty("极差")
    private List<Object> localRange;
}
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanTaskSwitchVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
package com.ruoyi.inspect.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class InsOrderPlanTaskSwitchVo{
    private String id;
    private String entrustCode;
    private String sampleType;
    @ApiModelProperty("紧急程度")
    private String type;
    @ApiModelProperty("状态")
    private String insState;
    @ApiModelProperty("约定时间")
    private String appointed;
    @ApiModelProperty("下发时间")
    private String sendTime;
    private Integer userId;
    private String sonLaboratory;
    private String laboratory;
    private Integer orderUserId;
    private Integer verifyUser;
}
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,78 @@
package com.ruoyi.inspect.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class InsOrderPlanVO{
    private String id;
    @ApiModelProperty("委托编号")
    private String entrustCode;
    @ApiModelProperty("样品名称")
    private String sample;
    @ApiModelProperty("样品型号")
    private String sampleModel;
    @ApiModelProperty("紧急程度")
    private String type;
    @ApiModelProperty("检验类型")
    private String orderType;
    @ApiModelProperty("状态")
    private String insState;
    @ApiModelProperty("检验人")
    private String userName;
    @ApiModelProperty("复核人")
    private String checkName;
    private Integer userId;
    @ApiModelProperty("检验开始时间")
    private String insTime;
    @ApiModelProperty("约定时间")
    private String appointed;
    @ApiModelProperty("下发时间")
    private String sendTime;
    @ApiModelProperty("理由")
    private String verifyTell;
    private String sonLaboratory;
    private Integer orderUserId;
    private Integer verifyUser;
    @ApiModelProperty("下单类别")
    private Integer typeSource;
    @ApiModelProperty("原材料id")
    private Integer ifsInventoryId;
    @ApiModelProperty("报告地址")
    private String url;
    @ApiModelProperty("新地址")
    private String urlS;
    @ApiModelProperty("是否是铜单丝")
    private Integer isCopper;
    @ApiModelProperty("查看临时报告地址")
    private String tempUrlPdf;
    @ApiModelProperty("报告id")
    private String insReportId;
}
inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPrintingVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
package com.ruoyi.inspect.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
 * @Author zhuo
 * @Date 2024/12/3
 */
@Data
public class InsOrderPrintingVo {
    @ApiModelProperty("订单编号")
    private Integer insOrderId;
    @ApiModelProperty("样品名称")
    private String sampleView;
    @ApiModelProperty("生产单位")
    private String production;
    @ApiModelProperty("规格型号")
    private String sampleModel;
    @ApiModelProperty("委托日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime sendTime;
    @ApiModelProperty("委托人")
    private String prepareUser;
    @ApiModelProperty("检测编号")
    private String entrustCode;
    @ApiModelProperty("样品数量")
    private String testQuantity;
    @ApiModelProperty("条形码")
    private String labelBarCode;
    @ApiModelProperty("订单状态")
    private Integer insState;
}
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;
}
inspect-server/src/main/java/com/ruoyi/inspect/vo/RawMaterialSupplierVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.ruoyi.inspect.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author zhuo
 * @Date 2024/10/24
 */
@Data
public class RawMaterialSupplierVo {
    @ApiModelProperty("订单id")
    private Integer OrderId;
    @ApiModelProperty("供应商名称")
    private String supplierName;
    @ApiModelProperty("检测编号")
    private String entrustCode;
    @ApiModelProperty("样品名称")
    private String sample;
    @ApiModelProperty("型号")
    private String model;
    @ApiModelProperty("检测值")
    private String lastValue;
}
inspect-server/src/main/java/com/ruoyi/inspect/vo/RawProductAnalysisVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.ruoyi.inspect.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
 * é¡¹æ£€åˆ†æžè¿”回对象
 *
 * @Author zhuo
 * @Date 2024/10/17
 */
@Data
public class RawProductAnalysisVo {
    @ApiModelProperty("检验项名称")
    private List<String> itemNames;
    @ApiModelProperty("检验项内容")
    private List<Map<String, Object>> productList;
}
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;//检验日期
}
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;//子类
}
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;
}
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.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class UnqualifiedHandlerVO extends InsUnqualifiedHandler {
    @ApiModelProperty("不合格处理主键id")
    private Long handlerId;
    @ApiModelProperty("域")
    private String contract;
    @ApiModelProperty("订单号")
    private String orderNo;
    @ApiModelProperty("行号")
    private String lineNo;
    @ApiModelProperty("下达号")
    private String releaseNo;
    @ApiModelProperty("接收号")
    private Integer receiptNo;
    @ApiModelProperty("零件号")
    private String partNo;
    @ApiModelProperty("零件描述")
    private String partDesc;
    @ApiModelProperty("状态描述")
    private String status;
    @ApiModelProperty("状态")
    private String statusDB;
    @ApiModelProperty("抵达的采购数量")
    private BigDecimal qtyArrived;
    @ApiModelProperty("已检验的购买数量")
    private BigDecimal qtyInspected;
    @ApiModelProperty("要检验的采购数量")
    private BigDecimal qtyToInspect;
    @ApiModelProperty("供应商编号")
    private String supplierId;
    @ApiModelProperty("供应商名称")
    private String supplierName;
    @ApiModelProperty("抵达的库存数量")
    private BigDecimal invQtyInStore;
    @ApiModelProperty("抵达的采购数量")
    private BigDecimal purQtyInStore;
    @ApiModelProperty("配置标识")
    private String configurationId;
    @ApiModelProperty("批号")
    private String lotBatchNo;
    @ApiModelProperty("wdr号")
    private String waivDevRejNo;
    @ApiModelProperty("活动序列")
    private String activitySeq;
    @ApiModelProperty("序列号")
    private String serialNo;
    @ApiModelProperty("库位号")
    private String locationNo;
    @ApiModelProperty("版本号")
    private String engChgLevel;
    @ApiModelProperty("接收人")
    private String receiver;
    @ApiModelProperty("接收人姓名")
    private String receiverName;
    @ApiModelProperty("采购员")
    private String buyerCode;
    @ApiModelProperty("采购员姓名")
    private String buyerName;
    @ApiModelProperty("实际到货日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime arriveDate;
    @ApiModelProperty("实际交货日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime deliveryDate;
    @ApiModelProperty("生产日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime productDate;
    @ApiModelProperty("失效日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime invalidDate;
    @ApiModelProperty("审批日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime approvedDate;
    @ApiModelProperty("采购申请创建人")
    private String reqCeater;
    @ApiModelProperty("采购申请创建人姓名")
    private String reqCeaterName;
    @ApiModelProperty("采购订单行备注")
    private String lineRemarks;
    @ApiModelProperty("采购单位")
    private String buyUnitMeas;
    /**
     * æ˜¯å¦ä¸ºifs拉取 1:是 0:否
     */
    @ApiModelProperty("是否为ifs拉取 1:是 0:否")
    private Integer isSource;
    /**
     * æ‹†åˆ†æ•°é‡
     */
    @ApiModelProperty("拆分数量")
    private Integer number;
    /**
     * æ£€éªŒçŠ¶æ€
     */
    @ApiModelProperty("检验状态")
    private Integer state;
    @ApiModelProperty("接收时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime receiverDate;
}
inspect-server/src/main/resources/static/factory_verify.docx
Binary files differ
inspect-server/src/main/resources/static/report-template.docx
Binary files differ
inspect-server/src/main/resources/static/small-report-template.docx
Binary files differ
inspect-server/src/main/resources/static/spot_check_quarter.docx
Binary files differ
inspect-server/src/main/resources/static/spot_check_year.docx
Binary files differ
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryCorrectionHoursController.java
@@ -35,7 +35,7 @@
    AuxiliaryCorrectionHoursService auxiliaryCorrectionHoursService;
    @ApiOperation(value = "查询修正工时")
    @PostMapping("/selectAuxiliaryCorrectionHours")
    @GetMapping("/selectAuxiliaryCorrectionHours")
    public Result selectAuxiliaryCorrectionHours(Page page,AuxiliaryCorrectionHoursDto entity) throws Exception {
        return Result.success(auxiliaryCorrectionHoursService.selectAuxiliaryCorrectionHours(page, entity));
    }
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOriginalHoursController.java
@@ -25,20 +25,20 @@
    AuxiliaryOriginalHoursService auxiliaryOriginalHoursService;
    @ApiOperation(value = "查询原始工时")
    @PostMapping("/selectAuxiliaryOriginalHours")
    @GetMapping("/selectAuxiliaryOriginalHours")
    public Result selectAuxiliaryOriginalHours(Page page, AuxiliaryOriginalHoursLookDto entity) throws Exception {
        return Result.success(auxiliaryOriginalHoursService.selectAuxiliaryOriginalHours(page, entity));
    }
    @ApiOperation(value = "导出原始工时")
    @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);
    }
    @ApiOperation(value = "查询月份全部工时")
    @PostMapping("/selectAuxiliaryAllByMonth")
    public Result selectAuxiliaryAllByMonth(@RequestBody AuxiliaryOriginalHoursLookDto dto){
    @GetMapping("/selectAuxiliaryAllByMonth")
    public Result selectAuxiliaryAllByMonth(AuxiliaryOriginalHoursLookDto dto){
        return Result.success(auxiliaryOriginalHoursService.selectAuxiliaryAllByMonth(dto));
    }
}
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryOutputWorkingHoursController.java
@@ -33,15 +33,14 @@
    private AuxiliaryOutputWorkingHoursService auxiliaryOutputWorkingHoursService;
    @ApiOperation(value = "查询产量工时")
    @PostMapping("/selectAuxiliaryOutputWorkingHours")
    @GetMapping("/selectAuxiliaryOutputWorkingHours")
    public Result selectAuxiliaryOutputWorkingHours(Page page,AuxiliaryOutputWorkingHoursDto entity) throws Exception {
        return Result.success(auxiliaryOutputWorkingHoursService.selectAuxiliaryOutputWorkingHours(page, entity));
    }
    @ApiOperation(value = "统计产量工时汇总和辅助工时汇总")
    @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
     */
    @ApiOperation(value = "导出产量工时")
    @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);
    }
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursController.java
@@ -8,10 +8,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 javax.annotation.Resource;
import java.util.Map;
@@ -33,13 +30,13 @@
    private AuxiliaryWorkingHoursService auxiliaryWorkingHoursService;
    @ApiOperation(value="查询辅助工时")
    @PostMapping("/selectAuxiliaryWorkingHours")
    @GetMapping("/selectAuxiliaryWorkingHours")
    public Result selectAuxiliaryWorkingHours(Page page,AuxiliaryWorkingHours entity) throws Exception {
        return Result.success(auxiliaryWorkingHoursService.selectAuxiliaryWorkingHours(page,entity));
    }
    @ApiOperation(value="删除辅助工时")
    @PostMapping("/deleteAuxiliaryWorkingHours")
    @DeleteMapping("/deleteAuxiliaryWorkingHours")
    public Result deleteAuxiliaryWorkingHours(Integer id){
        return Result.success(auxiliaryWorkingHoursService.deleteAuxiliaryWorkingHours(id));
    }
performance-server/src/main/java/com/ruoyi/performance/controller/AuxiliaryWorkingHoursDayController.java
@@ -10,10 +10,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@@ -39,19 +36,19 @@
    private AuxiliaryWorkingHoursDayService auxiliaryWorkingHoursDayService;
    @ApiOperation(value = "查询工时统计的辅助工时")
    @PostMapping("/selectAuxiliaryWorkingHoursDay")
    @GetMapping("/selectAuxiliaryWorkingHoursDay")
    public Result selectAuxiliaryWorkingHoursDay(Page page,AuxiliaryWorkingHoursDayDto entity) throws Exception {
        return Result.success(auxiliaryWorkingHoursDayService.selectAuxiliaryWorkingHoursDay(page, entity));
    }
    @ApiOperation(value = "根据编号查询辅助工时配置信息")
    @PostMapping("/selectAuxiliaryWorkingHoursByNumber")
    @GetMapping("/selectAuxiliaryWorkingHoursByNumber")
    public Result selectAuxiliaryWorkingHoursByNumber(String number) {
        return Result.success(auxiliaryWorkingHoursDayService.selectAuxiliaryWorkingHoursByNumber(number));
    }
    @ApiOperation(value = "根据编号当前用户信息查询所在班次")
    @PostMapping("/selectshiftByUser")
    @GetMapping("/selectshiftByUser")
    public Result selectshiftByUser(LocalDateTime dateTime) {
        return Result.success(auxiliaryWorkingHoursDayService.selectshiftByUser(dateTime));
    }
@@ -81,7 +78,7 @@
    }
    @ApiOperation(value = "删除工时统计的辅助工时")
    @PostMapping("/deleteAuxiliaryWorkingHoursDay")
    @DeleteMapping("/deleteAuxiliaryWorkingHoursDay")
    public Result deleteAuxiliaryWorkingHoursDay(Integer id) {
        return Result.success(auxiliaryWorkingHoursDayService.deleteAuxiliaryWorkingHoursDay(id));
    }
@@ -92,9 +89,8 @@
     * @throws IOException
     */
    @ApiOperation(value = "导出辅助工时")
    @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);
    }
performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
@@ -63,19 +63,19 @@
    }
    @ApiOperation(value = "月份分页查询")
    @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));
    }
    @ApiOperation(value = "年份分页查询")
    @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));
    }
    @ApiOperation(value = "班次状态修改")
    @PutMapping("update")
    @PostMapping("update")
    public Result<?> performanceShiftUpdate(@RequestBody PerformanceShift performanceShift) {
        performanceShiftService.performanceShiftUpdate(performanceShift);
        return Result.success();
performance-server/src/main/java/com/ruoyi/performance/controller/ShiftTimeController.java
@@ -6,10 +6,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 @@
    }
    @ApiOperation(value = "排班时间配置查询")
    @PostMapping("list")
    @GetMapping("list")
    public Result<?> shiftTimeList() {
        return Result.success(shiftTimeService.shiftTimeList());
    }
    @ApiOperation(value = "排班时间配置删除")
    @PostMapping("remove")
    @DeleteMapping("remove")
    public Result<?> shiftTimeRemove(Long id) {
        return Result.success(shiftTimeService.removeById(id));
    }
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,5 @@
 * @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);
}
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);
}
ruoyi-common/src/main/java/com/ruoyi/common/constant/InsOrderTypeConstants.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package com.ruoyi.common.constant;
/**
 * æ£€éªŒç±»åž‹
 *
 * @Author zhuo
 * @Date 2024/8/11
 */
public class InsOrderTypeConstants {
    // æ£€éªŒç±»åž‹
    public static final String SPOT_CHECK = "抽检";
    // å§”托检验
    public static final String CUSTOMER_ORDERED = "Customer-ordered test";
    // è¿›åŽ‚æ£€éªŒ
    public static final String ENTER_THE_FACTORY = "进厂检验";
    // å­£åº¦æ£€éªŒ
    public static final String QUARTERLY_TEST = "Quarterly inspection";
}
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java
@@ -18,10 +18,10 @@
    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Long id;
    private Integer id;
    @ApiModelProperty(value = "部门ID")
    private Long deptId;
    private Integer deptId;
    @ApiModelProperty(value = "用户账号")
    private String account;
ruoyi-common/src/main/java/com/ruoyi/common/properties/IfsProperties.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
package com.ruoyi.common.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
 * @Author zhuo
 * @Date 2024/9/29
 */
@Configuration
@ConfigurationProperties(prefix = "ifs")
@Data
public class IfsProperties {
    /**
     * åŸŸ
     */
    private String contract;
    /**
     * ç§˜é’¥-get
     */
    private String contractKeyGet;
    /**
     * ç§˜é’¥-post
     */
    private String contractKeyPost;
    /**
     * 80
     */
    private String custorder;
    /**
     * 8008
     */
    private String custorderPort;
    /**
     * 8081
     */
    private String erpServices;
}
ruoyi-common/src/main/java/com/ruoyi/common/properties/WechatProperty.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
package com.ruoyi.common.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
 * @author ZTT
 */
@Configuration
@ConfigurationProperties(prefix = "wechat")
@Data
public class WechatProperty {
    /**
     * è£…备电缆:报检通知url
     */
    private String examiningUrl;
}
ruoyi-common/src/main/java/com/ruoyi/common/utils/Base64.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package com.ruoyi.common.utils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import javax.xml.bind.DatatypeConverter;
import java.nio.charset.StandardCharsets;
public class Base64 {
    /**
     * base64 ç¼–码(方法一)
     * @explain DatatypeConverter.java实现
     * @param str å¾…编码字符串
     * @return ç¼–码字符串
     */
    public static String encode(String str) {
        // base64字符串
        String base64Str = "";
        // éžå­—符串才进行编码
        if (StringUtils.isNotBlank(str)) {
            // String è½¬ byte[]
            byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
            // ç¼–码
            base64Str = DatatypeConverter.printBase64Binary(bytes);
        }
        return base64Str;
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/utils/IfsApiUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,180 @@
package com.ruoyi.common.utils;
import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.properties.IfsProperties;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
 * @Author zhuo
 * @Date 2024/9/29
 */
@Slf4j
@AllArgsConstructor
@Component
public class IfsApiUtils {
    private IfsProperties ifsProperties;
    /**
     * æŸ¥è¯¢é‡‡è´­è®¢å•未检验
     */
    private String getStock(String inAttr) {
        return ifsProperties.getCustorderPort() + "contract=" + ifsProperties.getContract() + "&contractKey=" + ifsProperties.getContractKeyGet() + "&procedureName=QUERY_POL_RECEIPT_STD&userId=lims_user&inAttr=" + inAttr;
    }
    public List<Map<String, Object>> getInventory(String inAttr) {
        String body = HttpRequest.get(getStock(inAttr)).execute().body();
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            Map map = objectMapper.readValue(body, Map.class);
            List<Map<String, Object>> maps = objectMapper.readValue(JSONUtil.toJsonStr(map.get("LIST_INFO")), new TypeReference<List<Map<String, Object>>>() {
            });
            log.info("获取采购订单-->>" + maps);
            return maps;
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
    /**
     * ç™»è®°é‡‡è´­æ£€éªŒç»“æžœSTD
     */
    private String ProcurementResultsURL(String inAttr) {
        return ifsProperties.getCustorder() + "contract=" + ifsProperties.getContract() + "&contractKey=" + ifsProperties.getContractKeyGet() + "&procedureName=REGIST_INSPECTION_RESULTS_STD&userId=lims_user&inAttr=" + inAttr;
    }
    public Result getProcurementResults(String inAttr) {
        String body = HttpRequest.get(ProcurementResultsURL(inAttr)).execute().body();
        log.info("登记采购检验结果-->" + body);
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            Map map = objectMapper.readValue(body, Map.class);
            String successFlag = map.get("SuccessFlag").toString();
            if (Integer.valueOf(successFlag) == 1) {
                return Result.success(map);
            } else {
                return Result.fail(map.get("ErrorMsg").toString());
            }
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return Result.fail(e.getMessage());
        }
    }
    /**
     * æ£€éªŒåŽç§»åº“
     */
    private String getMoveReceiptApi(String inAttr) {
        return ifsProperties.getCustorder() + "contract=" + ifsProperties.getContract() + "&contractKey=" + ifsProperties.getContractKeyGet() + "&procedureName=MOVE_RECEIPT_STD&userId=lims_user&inAttr=" + inAttr;
    }
    /**
     * åŽŸææ–™æ£€éªŒ-检验后移库
     *
     * @param inAttr
     * @return
     */
    public Result moveReceipt(String inAttr) {
        String body = HttpRequest.get(getMoveReceiptApi(inAttr)).execute().body();
        log.info("检验后移库-->" + body);
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            Map map = objectMapper.readValue(body, Map.class);
            String successFlag = map.get("SuccessFlag").toString();
            if (Integer.valueOf(successFlag) == 1) {
                return Result.success(map);
            } else {
                return Result.fail(map.get("ErrorMsg").toString());
            }
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return Result.fail(e.getMessage());
        }
    }
    /**
     * é‡‡è´­æŽ¥æ”¶æ›´æ”¹æ‰¹å·
     */
    private String getMoveReceiptLotApi(String inAttr) {
        return ifsProperties.getCustorder() + "contract=" + ifsProperties.getContract() + "&contractKey=" + ifsProperties.getContractKeyGet() + "&procedureName=MODIFY_PURCH_RECEIPT_LOT_STD&userId=lims_user&inAttr=" + inAttr;
    }
    /**
     * åŽŸææ–™æ£€éªŒ-检验后移库
     *
     * @param inAttr
     * @return
     */
    public Result updateMoveReceiptLot(String inAttr) {
        String body = HttpRequest.get(getMoveReceiptLotApi(inAttr)).execute().body();
        log.info("修改采购订单批次号-->" + body);
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            Map map = objectMapper.readValue(body, Map.class);
            String successFlag = map.get("SuccessFlag").toString();
            if (Integer.valueOf(successFlag) == 1) {
                return Result.success(map);
            } else {
                return Result.fail(map.get("ErrorMsg").toString());
            }
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return Result.fail(e.getMessage());
        }
    }
    /**
     * æŸ¥è¯¢åº“存数据
     */
    private String getIfsStockApi(String inAttr) {
        return ifsProperties.getCustorderPort() + "contract=" + ifsProperties.getContract() + "&contractKey=" + ifsProperties.getContractKeyGet() + "&procedureName=QUERY_INVENTORY_INFO_STD&userId=lims_user&inAttr=" + inAttr;
    }
    /**
     * æŸ¥è¯¢åº“存数据
     *
     * @param inAttr
     * @return
     */
    public Result getIfsStock(String inAttr) {
        JSONObject stockMap = new JSONObject();
        stockMap.put("procedureName", "QUERY_INVENTORY_INFO_STD");
        stockMap.put("contract", ifsProperties.getContract());
        stockMap.put("contractKey", ifsProperties.getContractKeyPost());
        stockMap.put("userId", "userId");
        stockMap.put("inAttr", inAttr);
        String body = HttpRequest.post(ifsProperties.getCustorderPort()).form(stockMap).execute().body();
        log.info("查询库存信息-->" + body);
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            Map map = objectMapper.readValue(body, Map.class);
            String successFlag = map.get("SuccessFlag").toString();
            if (Integer.valueOf(successFlag) == 1) {
                return Result.success(map);
            } else {
                return Result.fail(map.get("ErrorMsg").toString());
            }
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return Result.fail(e.getMessage());
        }
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/utils/IndustryChainUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,93 @@
package com.ruoyi.common.utils;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class IndustryChainUtils {
    private static final String CLOUD_LOGIN = "https://gym.ztt.cn:1443/openApi/v1/user/login";
    private static final String CLOUD_REQUEST = "https://gym.ztt.cn:1443/openApi/codeGenerate/getCodeDetailByOrder";
    //请求表单账号
    private static final String USERNAME = "ZTKJ-N002096";
    //请求表单密码
    private static final String PASSWORD = "Abc12345@";
    //Base64格式编码
    private static final String PWDBASE64 = Base64.encode(PASSWORD);
    //获取token
    public static String getToken() {
        HttpRequest request = HttpRequest.post(CLOUD_LOGIN)
                .header("Content-Type", "application/x-www-form-urlencoded")
                .form("username", USERNAME)
                .form("password", PWDBASE64);
        HttpResponse response = request.execute();
        ObjectMapper objectMapper = new ObjectMapper();
        JsonNode jsonNode;
        try {
            jsonNode = objectMapper.readTree(response.body());
            //通过返回数据获取token
            String accessToken = jsonNode.get("data").get("token").asText();
            return accessToken;
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }
    //输出所有数据
    public static String getIndustryChainAll(String orderNo, String lineNum, String releaseNum) {
        String token = getToken();
        HttpRequest request = HttpRequest.get(CLOUD_REQUEST)
                .header("Authorization", "Bearer " + token)
                .form("orderNo", orderNo)
                .form("lineNum", lineNum)
                .form("releaseNum", releaseNum);
        HttpResponse response = request.execute();
        ObjectMapper objectMapper = new ObjectMapper();
        JsonNode jsonNode;
        try {
            jsonNode = objectMapper.readTree(response.body());
            return jsonNode.toString();
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }
    /**
     *
     * @param orderNo  è®¢å•号
     * @param lineNum  è¡Œå·
     * @param releaseNum  ä¸‹è¾¾å·
     * @return
     */
    public static String getIndustryChainAttrFields(String orderNo, String lineNum, String releaseNum) {
        String token = getToken();
        HttpRequest request = HttpRequest.get(CLOUD_REQUEST)
                .header("Authorization", "Bearer " + token)
                .form("orderNo", orderNo)
                .form("lineNum", lineNum)
                .form("releaseNum", releaseNum);
        HttpResponse response = request.execute();
        ObjectMapper objectMapper = new ObjectMapper();
        JsonNode jsonNode;
        try {
            jsonNode = objectMapper.readTree(response.body());
            // åˆ¤æ–­æ˜¯å¦é€šè¿‡
            if (jsonNode.get("code").asInt() != 200) {
                return null;
            }
            JsonNode data = jsonNode.get("data");
            for (JsonNode dataNode : data) {
                //获取attrFields数据
                String attrFields = dataNode.get("attrFields").toPrettyString();
                return attrFields;
            }
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
        return null;
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/utils/LimsDateUtil.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
package com.ruoyi.common.utils;
import cn.hutool.core.date.DateUtil;
import java.time.LocalDateTime;
/**
 * @Author zhuo
 * @Date 2024/9/28
 */
public class LimsDateUtil {
    /**
     * æ—¥æœŸæ ¼å¼åˆ°26号月份加一
     * @param localDateTime
     * @return
     */
    public static String resetDate(LocalDateTime localDateTime) {
        // èŽ·å–å½“å‰æ—¥
        int dayOfMonth = localDateTime.getDayOfMonth();
        // åˆ¤æ–­æ˜¯å¦æ˜¯26日及以上
        if (dayOfMonth >= 26) {
            // æœˆä»½åŠ 1
            localDateTime = localDateTime.plusMonths(1);
        }
        // æ ¼å¼åŒ–为"yyMM"格式
        String formattedDate = DateUtil.format(localDateTime, "yyMM");
        return formattedDate;
    }
}