huang
2025-05-20 2c2413760b6467bf62402dba7338bd3bbcbd7341
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
package com.mes.md.service.impl;
 
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.mes.md.entity.Machine;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.service.MachineService;
import org.springframework.stereotype.Service;
 
import java.util.Objects;
 
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wu
 * @since 2024-08-28
 */
@Service
public class MachineServiceImpl extends MPJBaseServiceImpl<MachineMapper, Machine> implements MachineService {
 
    /**
     * @param machine 修改当前设备状态:【开工/暂停】
     * @return
     */
    @Override
    public int openOrCloseMachine(Machine machine){
        Machine oldmachine=baseMapper.selectById(machine);
        if(!Objects.isNull(oldmachine)){
            oldmachine.setState(machine.getState());
            return baseMapper.updateById(oldmachine);
        }
        return 0;
    }
    /**
     * @param machine 添加手动上片任务
     * @return
     */
    @Override
    public int manualOperationTask(Machine machine){
        Machine oldmachine=baseMapper.selectById(machine);
        if(!Objects.isNull(oldmachine)){
            oldmachine.setTaskCount(machine.getTaskCount());
            oldmachine.setFinshCount(machine.getFinshCount());
            return baseMapper.updateById(oldmachine);
        }
        return 0;
    }
    /**
     * @param machine 切换设备模式:(上片:【1定制/2标准/3手动】,翻片:【1定制/2标准】 旋转:【1定制/2标准】),其他设备暂时没有模式
     * @return
     */
    @Override
    public int toggleModeMachine(Machine machine){
        Machine oldmachine=baseMapper.selectById(machine);
        if(!Objects.isNull(oldmachine)){
            oldmachine.setMode(machine.getMode());
            return baseMapper.updateById(oldmachine);
        }
        return 0;
    }
 
    /**
     * @param machine 切换旋转模式:(旋转:【1旋转/2不旋转】)
     * @return
     */
    @Override
    public int toggleModeRotate(Machine machine){
        Machine oldmachine=baseMapper.selectById(machine);
        if(!Objects.isNull(oldmachine)){
            oldmachine.setRotateMode(machine.getRotateMode());
            return baseMapper.updateById(oldmachine);
        }
        return 0;
    }
 
 
}