Fancy
2024-07-16 e9af4d03a4f64dec62ab180640de9d26d0f2b8d7
pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
@@ -155,17 +155,9 @@
                deviceList.add(deviceNo);
            } else {
                //判断是不是是本厂物料,如果是,则添加物料到ex表中
                PltProduct product = null;
                if (StringUtils.isNotEmpty(deviceNo) && deviceNo.length() == 22) {
                    product = productList.stream().filter(p -> deviceNo.startsWith(QrCodeConstant.TypeProduct + p.getCode())).findFirst().orElse(null);
                }
                if(product != null){
                    Map<String, String> map = new HashMap<>();
                    map.put("deviceNo", deviceNo);
                    map.put("proName", product.getName());
                    BigInteger proId = BigInteger.valueOf(product.getId());
                    map.put("proId", proId.toString());
                    materialList.add(map);
                Map<String, String> result = queryByDeviceNo(deviceNo, productList);
                if (StringUtils.isNotBlank(result.get("proName"))) {
                    materialList.add(result);
                }
            }
        });
@@ -334,11 +326,14 @@
        if (workLast == null) {
            throw new RuntimeException("系统中没有该条登录信息");
        }
        StaDeviceLast deviceLast = buildDeviceLast(vo, workLast, vo.deviceNo[0]);
        int count = deviceLast.id == null ? deviceLastDao.insertSelective(deviceLast) :
                deviceLastDao.updateByPrimaryKeySelective(deviceLast);
        saveDeviceProductionLog(deviceLast);
        PrProductionNode node = nodeDao.selectByPrimaryKey(workLast.nodeId);
        if (node.isRecord) {
            saveDeviceLife(deviceLast);
        }
        return count;
    }
@@ -451,20 +446,27 @@
        return fileRestVo.fileWebUrl + file.filePath;
    }
    public Map<String, String> queryByDeviceNo(String deviceNo) {
    public Map<String, String> queryByDeviceNo(String deviceNo,List<PltProduct> productList) {
        Map<String, String> map = new HashMap<>();
        map.put("deviceNo", deviceNo);
        map.put("proName", "");
        map.put("proType", "");
        PltProduct product = productDao.selectByCode(deviceNo.substring(3, 6));
        map.put("proId", "");
        //判断是不是是本厂物料
        if(CollectionUtils.isEmpty(productList)){
            productList = productDao.selectAll(null);
        }
        PltProduct product = null;
        if (StringUtils.isNotEmpty(deviceNo) && deviceNo.length() == 22) {
            product = productList.stream().filter(p -> deviceNo.startsWith(QrCodeConstant.TypeProduct + p.getCode())).findFirst().orElse(null);
        }
        if (product != null) {
            map.put("deviceNo", deviceNo);
            map.put("proName", product.getName());
            map.put("proType", product.getType());
            BigInteger proId = BigInteger.valueOf(product.getId());
            map.put("proId", proId.toString());
        }
        /*else{
            throw new RuntimeException("该编码("+deviceNo +")不是主要物料(系统中管控的其他设备)");
        }*/
        return map;
    }