yangys
2024-03-27 e48aa2ac8dea1be5db11c63edf0b912c4ad5ce65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.qianwen.smartman.modules.cps.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.lang.invoke.SerializedLambda;
import java.util.List;
import com.qianwen.smartman.common.enums.WorkstationParamTypeEnum;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.modules.cps.convert.DmpVariablesConvert;
import com.qianwen.smartman.modules.cps.entity.DmpVariables;
import com.qianwen.smartman.modules.cps.entity.Machine;
import com.qianwen.smartman.modules.cps.entity.WorkstationOfMachine;
import com.qianwen.smartman.modules.cps.mapper.DmpVariablesMapper;
import com.qianwen.smartman.modules.cps.service.IDmpVariablesService;
import com.qianwen.smartman.modules.cps.service.IMachineService;
import com.qianwen.smartman.modules.cps.service.IWorkstationOfMachineService;
import com.qianwen.smartman.modules.cps.vo.DmpStatusVariableVO;
import com.qianwen.smartman.modules.cps.vo.DmpVariablesVO;
import com.qianwen.smartman.modules.cps.vo.MachineDmpVariablesVO;
import org.springframework.stereotype.Service;
 
@Service
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/DmpVariablesServiceImpl.class */
public class DmpVariablesServiceImpl extends ServiceImpl<DmpVariablesMapper, DmpVariables> implements IDmpVariablesService {
    private final IWorkstationOfMachineService workstationOfMachineService;
    private final IMachineService machineService;
 
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -1453405940:
                if (implMethodName.equals("getMachineId")) {
                    z = false;
                    break;
                }
                break;
        }
        switch (z) {
            case false:
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/DmpVariables") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getMachineId();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
 
    public DmpVariablesServiceImpl(final IWorkstationOfMachineService workstationOfMachineService, final IMachineService machineService) {
        this.workstationOfMachineService = workstationOfMachineService;
        this.machineService = machineService;
    }
 
    @Override // org.springblade.modules.cps.service.IDmpVariablesService
    public List<DmpVariablesVO> listByMachineId(Long machineId) {
        List<DmpVariables> list = list((Wrapper) Wrappers.lambdaQuery().eq((v0) -> {
            return v0.getMachineId();
        }, machineId));
        return DmpVariablesConvert.INSTANCE.convert(list);
    }
 
    @Override // org.springblade.modules.cps.service.IDmpVariablesService
    public MachineDmpVariablesVO listByWorkstationId(Long workstationId) {
        WorkstationOfMachine workstationOfMachine = this.workstationOfMachineService.getWorkstationOfMachineByWorkstationId(workstationId);
        if (Func.isNotEmpty(workstationOfMachine)) {
            Machine machine = (Machine) this.machineService.getById(workstationOfMachine.getMachineId());
            if (Func.isNotEmpty(machine)) {
                MachineDmpVariablesVO machineDmpVariablesVO = new MachineDmpVariablesVO();
                machineDmpVariablesVO.setMachineCode(machine.getMachineCode());
                machineDmpVariablesVO.setMachineName(machine.getMachineName());
                machineDmpVariablesVO.setMachineBrand(machine.getBrand());
                machineDmpVariablesVO.setTypeName(machine.getTypeName());
                List<DmpVariablesVO> dmpVariablesVOList = ((DmpVariablesMapper) this.baseMapper).getVariablesAndWcs(machine.getId(), workstationId);
                dmpVariablesVOList.forEach(dmpVariablesVO -> {
                    if (Func.isEmpty(dmpVariablesVO.getDataItem())) {
                        dmpVariablesVO.setDataItem(dmpVariablesVO.getDescription());
                        dmpVariablesVO.setWcsDataType(WorkstationParamTypeEnum.OTHER.getType());
                    }
                    dmpVariablesVO.setSort(dmpVariablesVO.getIdx());
                });
                machineDmpVariablesVO.setDmpVariablesVOList(dmpVariablesVOList);
                return machineDmpVariablesVO;
            }
        }
        return new MachineDmpVariablesVO();
    }
 
    @Override // org.springblade.modules.cps.service.IDmpVariablesService
    public List<DmpVariablesVO> getDmpVariablesByWorkstationId(Long workstationId) {
        return ((DmpVariablesMapper) this.baseMapper).getDmpVariablesByWorkstationId(workstationId);
    }
 
    @Override // org.springblade.modules.cps.service.IDmpVariablesService
    public List<DmpStatusVariableVO> getDmpVariablesByWorkstationIdList(List<Long> workstationIdList) {
        return ((DmpVariablesMapper) this.baseMapper).getDmpVariablesByWorkstationIdList(workstationIdList);
    }
 
    @Override // org.springblade.modules.cps.service.IDmpVariablesService
    public List<DmpVariablesVO> getDmpVariablesByWorkstationIds(List<Long> workstationIds) {
        return ((DmpVariablesMapper) this.baseMapper).getDmpVariablesByWorkstationIds(workstationIds);
    }
}