Fancy
2024-07-22 72219adeceb06a060978e876880750f804df5772
pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
@@ -191,8 +191,8 @@
        }
        BaUser userInfo = getUserInfo(result.getUserId().toString());
        PltStation stationInfo = getStationInfo(result.getStationId().toString());
        //如果是维修work_type 没有 planId processId nodeId
        if (WORK_TYPE_REPAIR.equals(result.getWorkType())) {
        //如果是无任务计划 如维修work_type 没有 planId processId nodeId
        if (result.getPlanId() != null) {
            //校验planId processId nodeId
            PrAssemblyPlan assyPlan = assemblyDao.selectByPrimaryKey(result.getPlanId());
            boolean hasNodeId = assyPlan.getProcess().getNodes().stream()
@@ -266,8 +266,16 @@
    public StaAssemblyWorkLast save(QueryVo vo) {
        //先check
        StaAssemblyWorkLast checkResult = checkUserAndStationUsed(vo);
        //数据逐个封装返回
        vo.setLineId(checkResult.getLineId());
        StaAssemblyWorkLast staLast = new StaAssemblyWorkLast();
        BeanUtils.copyProperties(vo, staLast);
        staLast.setUserId(checkResult.getUserId());
        staLast.setStationId(checkResult.getStationId());
        //校验planId processId nodeId
        PrAssemblyPlan assyPlan = assemblyDao.selectByPrimaryKey(vo.getPlanId());
        PrAssemblyPlan assyPlan = new PrAssemblyPlan();
        if (vo.getPlanId() != null) {
            assyPlan = assemblyDao.selectByPrimaryKey(vo.getPlanId());
        if (assyPlan == null) {
            throw new RuntimeException("组装任务已经在系统中删除请检查,刷新并重新选择任务");
        }
@@ -276,13 +284,8 @@
        if (!hasNodeId) {
            throw new RuntimeException("节点信息有误或被其他人员修改,请重新选择节点信息");
        }
        }
        //数据逐个封装返回
        vo.setLineId(checkResult.getLineId());
        StaAssemblyWorkLast staLast = new StaAssemblyWorkLast();
        BeanUtils.copyProperties(vo, staLast);
        staLast.setUserId(checkResult.getUserId());
        staLast.setStationId(checkResult.getStationId());
        int count = 0;
        if (checkResult.getId() == null) {
            BeanUtils.copyProperties(vo, staLast);//vo拷贝到staLast
@@ -294,9 +297,12 @@
        } else {
            //保存一条history?
            BeanUtils.copyProperties(checkResult, staLast);
            if (vo.getPlanId() != null) {
            staLast.setPlanId(assyPlan.getId());
            staLast.setProcessId(assyPlan.getProcess().getId());
            staLast.setNodeId(vo.getNodeId());
            }
            staLast.setWorkType(vo.getWorkType());
            staLast.setStatus(STATUS_NORMAL);
            staLast.setStartTime(new Date());
            count = assemblyWorkLastDao.updateByPrimaryKeySelective(staLast);
@@ -305,6 +311,7 @@
            throw new RuntimeException("数据库存储失败");
        }
        StaAssemblyWorkLast result = assemblyWorkLastDao.selectByPrimaryKey(staLast.getId());
        if (assyPlan != null) {
        List<PrProductionNode> nodeInfo = assyPlan.getProcess().getNodes().stream()
                .filter(node -> node.id.equals(vo.getNodeId())).collect(Collectors.toList());
        result.setPlanName(assyPlan.getName());
@@ -319,6 +326,7 @@
        result.setProName(product.getName());
        String devicePrefix = QrCodeConstant.TypeProduct + product.getCode() + assyPlan.getBatchNo();
        result.setDevicePrefix(devicePrefix);
        }
        return result;
    }