yangys
2024-10-30 25db770e621f1259b8d5b7fd514207f7481c2d0f
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.qianwen.smartman.modules.cps.controller;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.validation.Valid;
import com.qianwen.core.scanner.modular.annotation.GetResource;
import com.qianwen.core.scanner.modular.annotation.PostResource;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.secure.annotation.PreAuth;
import com.qianwen.core.tenant.annotation.NonDS;
import com.qianwen.core.tool.api.R;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.modules.cps.service.IWorkstationWorkbenchService;
import com.qianwen.smartman.modules.cps.vo.MachineInformationVO;
import com.qianwen.smartman.modules.cps.vo.WorkstationOfWorkbenchVO;
import com.qianwen.smartman.modules.cps.vo.WorkstationWorkbenchVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@Api(value = "工位工作台管理", tags = {"工位工作台管理"})
@RestController
@ApiResource({"smis/workstation-workbench"})
@NonDS
@Validated
public class WorkstationWorkbenchController {
    private final IWorkstationWorkbenchService workbenchService;
 
    public WorkstationWorkbenchController(final IWorkstationWorkbenchService workbenchService) {
        this.workbenchService = workbenchService;
    }
 
    @PreAuth
    @PostResource({"/saveWorkbench"})
    @ApiOperation("增加工位工作台信息")
    public R<Boolean> saveWorkbench(@Valid @RequestBody WorkstationWorkbenchVO vo) {
        return R.data(this.workbenchService.saveWorkstationWorkbench(vo));
    }
 
    @GetMapping({"/listWorkbench"})
    @ApiOperation("遍历工位工作台")
    public R<MachineInformationVO> listWorkbench(Long workstationId) {
        return R.data(this.workbenchService.listWorkstationWorkbench(workstationId));
    }
 
    @PreAuth
    @PostResource({"/deleteWorkbench"})
    @ApiOperation("删除工位工作台信息")
    public R<Boolean> deleteWorkbench(@Valid @RequestBody WorkstationWorkbenchVO vo) {
        return R.data(this.workbenchService.deleteWorkstationWorkbench(vo));
    }
 
    @PreAuth
    @PostResource({"/updateWorkbench"})
    @ApiOperation("修改工位工作台信息")
    public R<Boolean> updateWorkbench(@Valid @RequestBody WorkstationWorkbenchVO vo) {
        return R.data(this.workbenchService.updateWorkstationWorkbench(vo));
    }
 
    @PreAuth
    @GetResource({"/listByGroupId"})
    @ApiOperation("根据工位组查询工位和工作台集合")
    public R<List<WorkstationOfWorkbenchVO>> listByGroupId(@RequestParam(required = false) String groupId, @RequestParam(required = false) String settingsId, @RequestParam(required = false) String keyWord) {
        return R.data(this.workbenchService.listByGroupId(Func.isNotEmpty(groupId) ? Long.valueOf(groupId) : null, Func.isNotEmpty(settingsId) ? Long.valueOf(settingsId) : null, keyWord));
    }
}