value
2024-06-19 6af8995b319a569586c90e1d29ab0b6504179073
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -10,6 +10,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
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;
@@ -33,7 +34,6 @@
import com.yuanchu.mom.utils.QueryWrappers;
import com.yuanchu.mom.vo.InsOrderPlanTaskSwitchVo;
import com.yuanchu.mom.vo.InsOrderPlanVO;
import com.yuanchu.mom.vo.Result;
import org.apache.commons.io.IOUtils;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Value;
@@ -363,7 +363,7 @@
                        .eq(AuxiliaryOutputWorkingHours::getCheck, userId)
                        .eq(AuxiliaryOutputWorkingHours::getInspectProject, insProduct.getInspectionItemSubclass() + insProduct.getInspectionItem())
                        .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode()));
                if (count == 0) {
                if (count == 0 && ObjectUtils.isNotEmpty(insProduct.getManHour())) {
                    //添加每个人的产量工时
                    AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
                    auxiliaryOutputWorkingHours.setInspectProject(insProduct.getInspectionItemSubclass() + insProduct.getInspectionItem());//检测项目
@@ -453,6 +453,7 @@
                for (InsProduct insProduct : insProducts) {
                    if (insProduct.getInsResult() == 0) {
                        InsUnPass insUnPass = new InsUnPass();
                        insUnPass.setId(null);
                        insUnPass.setModel(insSample.getModel());
                        insUnPass.setSample(insSample.getSample());
                        insUnPass.setInspectionItem(insProduct.getInspectionItem());
@@ -465,16 +466,14 @@
                        insUnPasses.add(insUnPass);
                    }
                }
                insUnPassService.saveBatch(insUnPasses);
            }
            insUnPassService.saveBatch(insUnPasses);
            InsOrder insOrder = insOrderMapper.selectById(orderId);
            Map<String, String> user = insProductMapper.selectUserById(insOrder.getUserId());
            List<SampleProductDto> samples = insSampleMapper.selectSampleProductListByOrderId(orderId);
            InsReport insReport = new InsReport();
            insReport.setCode(insOrder.getEntrustCode());
            insReport.setInsOrderId(orderId);
            Set<Integer> set = new HashSet<>();
            Map<Integer, String> map2 = new HashMap<>();
            List<Map<String, Object>> tables = new ArrayList<>();
            Set<String> standardMethod = new HashSet<>();
            Set<String> deviceSet = new HashSet<>();
@@ -484,6 +483,8 @@
            AtomicReference<String> resultCh = new AtomicReference<>("");
            AtomicReference<String> resultEn = new AtomicReference<>("");
            samples.forEach(a -> {
                Set<Integer> set = new HashSet<>();
                Map<Integer, String> map2 = new HashMap<>();
                Long productCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsSampleId, a.getId()));
                productSize.set(productSize.get() + Integer.parseInt(productCount + ""));
                models.add(a.getModel());
@@ -545,7 +546,6 @@
                    Map<String, InsProduct> pMap = new HashMap<>();
                    Set<String> delRSet = new HashSet<>();
                    delRSet.add("0");
                    delRSet.add("1");
                    for (JSONObject jo1 : temp) {
                        JSONObject v = JSON.parseObject(JSON.toJSONString(jo1.get("v")));
                        if (Integer.parseInt(jo1.get("c") + "") > 9) {
@@ -704,10 +704,10 @@
                    tableRenderData.setRows(rows);
                    int countSize = tableRenderData.getRows().get(0).getCells().size();
                    for (RowRenderData row : tableRenderData.getRows()) {
                        for (CellRenderData cell : row.getCells()) {
                        /*for (CellRenderData cell : row.getCells()) {
                            System.out.print(cell.getParagraphs().get(0).getContents());
                        }
                        System.out.println("");
                        System.out.println("");*/
                        if (row.getCells().size() != countSize) {
                            throw new ErrorException("每行单元格不相等");
                        }
@@ -778,7 +778,7 @@
            ConfigureBuilder builder = Configure.builder();
            builder.useSpringEL(true);
            List<Map<String, String>> finalDeviceList = deviceList;
            Integer userId = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getCreateTime).last("limit 1")).getUserId();
            Integer userId = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).last("limit 1")).getUserId();
            String signatureUrl;
            try {
                signatureUrl = userMapper.selectById(userId).getSignatureUrl();
@@ -945,10 +945,10 @@
                    tableRenderData.setRows(rows);
                    int countSize = tableRenderData.getRows().get(0).getCells().size();
                    for (RowRenderData row : tableRenderData.getRows()) {
                        for (CellRenderData cell : row.getCells()) {
                        /*for (CellRenderData cell : row.getCells()) {
                            System.out.print(cell.getParagraphs().get(0).getContents());
                        }
                        System.out.println("");
                        System.out.println("");*/
                        if (row.getCells().size() != countSize) {
                            throw new ErrorException("每行单元格不相等");
                        }
@@ -973,7 +973,6 @@
                    tables2.add(table);
                });
            }
            XWPFTemplate template = XWPFTemplate.compile(url, builder.build()).render(
                    new HashMap<String, Object>() {{
@@ -1113,7 +1112,7 @@
        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::getSonLaboratory, laboratory).eq(InsProduct::getState, 1).isNull(InsProduct::getInsResult).isNull(InsProduct::getInsFiberId).isNull(InsProduct::getInsFibersId));
        insProducts.addAll(insProductMapper.selectFiberInsProduct(ids));
        insProducts.addAll(insProductMapper.selectFiberInsProduct(ids, laboratory));
        if (insProducts.size() > 0) {
            String str = "";
            int count = 0;