春风项目四线(合箱线、总装线)
yyt
2024-02-19 0b14225915932f0f5c88bc3e44302bf1c309de1a
提交 | 用户 | 时间
e4c3b0 1 package com.jcdm.main.da.opcuaconfig.controller;
Y 2
054abe 3 import java.util.List;
Y 4 import javax.servlet.http.HttpServletResponse;
5
0b1422 6 import com.jcdm.main.da.opcuaconfig.client.ClientHandler;
054abe 7 import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
0b1422 8 import com.jcdm.main.da.opcuaconfig.domain.NodeEntity;
054abe 9 import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
Y 10 import org.springframework.security.access.prepost.PreAuthorize;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.GetMapping;
13 import org.springframework.web.bind.annotation.PostMapping;
14 import org.springframework.web.bind.annotation.PutMapping;
15 import org.springframework.web.bind.annotation.DeleteMapping;
16 import org.springframework.web.bind.annotation.PathVariable;
17 import org.springframework.web.bind.annotation.RequestBody;
18 import org.springframework.web.bind.annotation.RequestMapping;
19 import org.springframework.web.bind.annotation.RestController;
e4c3b0 20 import com.jcdm.common.annotation.Log;
Y 21 import com.jcdm.common.core.controller.BaseController;
22 import com.jcdm.common.core.domain.AjaxResult;
23 import com.jcdm.common.enums.BusinessType;
24 import com.jcdm.common.utils.poi.ExcelUtil;
054abe 25 import com.jcdm.common.core.page.TableDataInfo;
e4c3b0 26
Y 27 /**
054abe 28  * 交互信号配置Controller
e4c3b0 29  * 
Y 30  * @author yyt
28cd73 31  * @date 2024-01-23
e4c3b0 32  */
Y 33 @RestController
34 @RequestMapping("/da/opcuaconfig")
35 public class DaOpcuaConfigController extends BaseController
36 {
37     @Autowired
38     private IDaOpcuaConfigService daOpcuaConfigService;
39
40     /**
054abe 41      * 查询交互信号配置列表
e4c3b0 42      */
Y 43     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:list')")
44     @GetMapping("/list")
45     public TableDataInfo list(DaOpcuaConfig daOpcuaConfig)
46     {
47         startPage();
48         List<DaOpcuaConfig> list = daOpcuaConfigService.selectDaOpcuaConfigList(daOpcuaConfig);
49         return getDataTable(list);
50     }
51
52     /**
054abe 53      * 导出交互信号配置列表
e4c3b0 54      */
Y 55     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:export')")
054abe 56     @Log(title = "交互信号配置", businessType = BusinessType.EXPORT)
e4c3b0 57     @PostMapping("/export")
Y 58     public void export(HttpServletResponse response, DaOpcuaConfig daOpcuaConfig)
59     {
60         List<DaOpcuaConfig> list = daOpcuaConfigService.selectDaOpcuaConfigList(daOpcuaConfig);
61         ExcelUtil<DaOpcuaConfig> util = new ExcelUtil<DaOpcuaConfig>(DaOpcuaConfig.class);
054abe 62         util.exportExcel(response, list, "交互信号配置数据");
e4c3b0 63     }
Y 64
65     /**
054abe 66      * 获取交互信号配置详细信息
e4c3b0 67      */
Y 68     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:query')")
69     @GetMapping(value = "/{id}")
70     public AjaxResult getInfo(@PathVariable("id") Long id)
71     {
72         return success(daOpcuaConfigService.selectDaOpcuaConfigById(id));
73     }
74
75     /**
054abe 76      * 新增交互信号配置
e4c3b0 77      */
Y 78     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:add')")
054abe 79     @Log(title = "交互信号配置", businessType = BusinessType.INSERT)
e4c3b0 80     @PostMapping
Y 81     public AjaxResult add(@RequestBody DaOpcuaConfig daOpcuaConfig)
82     {
83         return toAjax(daOpcuaConfigService.insertDaOpcuaConfig(daOpcuaConfig));
84     }
85
86     /**
054abe 87      * 修改交互信号配置
e4c3b0 88      */
Y 89     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:edit')")
054abe 90     @Log(title = "交互信号配置", businessType = BusinessType.UPDATE)
e4c3b0 91     @PutMapping
Y 92     public AjaxResult edit(@RequestBody DaOpcuaConfig daOpcuaConfig)
93     {
94         return toAjax(daOpcuaConfigService.updateDaOpcuaConfig(daOpcuaConfig));
95     }
96
97     /**
054abe 98      * 删除交互信号配置
e4c3b0 99      */
Y 100     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:remove')")
054abe 101     @Log(title = "交互信号配置", businessType = BusinessType.DELETE)
e4c3b0 102     @DeleteMapping("/{ids}")
Y 103     public AjaxResult remove(@PathVariable Long[] ids)
104     {
105         return toAjax(daOpcuaConfigService.deleteDaOpcuaConfigByIds(ids));
106     }
0b1422 107
Y 108     /**
109      * 获取交互信号配置详细信息
110      */
111     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:query')")
112     @GetMapping(value = "/SNCode/{SNCode}/{locationCode}")
113     public AjaxResult setSNCode(@PathVariable("SNCode") String SNCode,@PathVariable("locationCode") String locationCode) {
114         NodeEntity node= NodeEntity.builder().index(2).identifier("CFL4CVT"+"."+locationCode+".SNCode").value(SNCode).type("string").build();
115         Boolean out= null;
116         try {
117             out = ClientHandler.write(node);
118         } catch (Exception e) {
119             throw new RuntimeException(e);
120         }
121
122         return toAjax(out);
123     }
e4c3b0 124 }