严智鑫
2025-03-11 67cbfd8f7c2ed9598eef92470313f3cf31028ea1
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
package com.mes.md.controller;
 
 
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.service.MachineService;
import com.mes.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yanzhixin
 * @since 2024-09-13
 */
@RestController
@RequestMapping("/machine")
public class MachineController {
 
    @Autowired
    MachineService machineService;
    @Autowired
    MachineMapper machineMapper;
 
    @ApiOperation("查询当前设备 数据")
    @PostMapping("/findMachine")
    @ResponseBody
    public Result findMachine(@RequestBody Machine findMachine) {
        Machine machine =machineMapper.selectById(findMachine);
        return Result.build(200,"成功",machine);
    }
 
    @ApiOperation("修改当前设备 【开工/暂停】")
    @PostMapping("/updateMachineState")
    @ResponseBody
    public Result updateMachineState(@RequestBody Machine machine) {
        int count =machineService.openOrCloseMachine(machine);
        return Result.build(200,"修改成功:"+count,count);
    }
 
    @ApiOperation("当前设备切换模式 【定制/标准】")
    @PostMapping("/toggleModeMachine")
    @ResponseBody
    public Result toggleModeMachine(@RequestBody Machine machine) {
        int count =machineService.toggleModeMachine(machine);
        return Result.build(200,"修改成功:"+count,count);
    }
 
    @ApiOperation("当前旋转模式 【1旋转/2不旋转】")
    @PostMapping("/toggleModeRotate")
    @ResponseBody
    public Result toggleModeRotate(@RequestBody Machine machine) {
        int count =machineService.toggleModeRotate(machine);
        return Result.build(200,"修改成功:"+count,count);
    }
 
    @ApiOperation("[手动上片模式]  修改数量")
    @PostMapping("/manualOperationTask")
    @ResponseBody
    public Result manualOperationTask(@RequestBody Machine machine) {
        int count =machineService.manualOperationTask(machine);
        return Result.build(200,"修改成功:"+count,count);
    }
}