提交 | 用户 | 时间
|
2df134
|
1 |
package com.jcdm.main.da.tileMatchRules.controller; |
J |
2 |
|
|
3 |
import java.util.List; |
5030f3
|
4 |
import java.util.stream.Collectors; |
2df134
|
5 |
import javax.servlet.http.HttpServletResponse; |
5030f3
|
6 |
|
Y |
7 |
import cn.hutool.core.collection.CollUtil; |
|
8 |
import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
|
9 |
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; |
|
10 |
import com.jcdm.main.da.tileMatchMiddleware.domain.DaTileMatchMiddleware; |
2df134
|
11 |
import org.springframework.security.access.prepost.PreAuthorize; |
J |
12 |
import org.springframework.beans.factory.annotation.Autowired; |
|
13 |
import org.springframework.web.bind.annotation.GetMapping; |
|
14 |
import org.springframework.web.bind.annotation.PostMapping; |
|
15 |
import org.springframework.web.bind.annotation.PutMapping; |
|
16 |
import org.springframework.web.bind.annotation.DeleteMapping; |
|
17 |
import org.springframework.web.bind.annotation.PathVariable; |
|
18 |
import org.springframework.web.bind.annotation.RequestBody; |
|
19 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
20 |
import org.springframework.web.bind.annotation.RestController; |
|
21 |
import com.jcdm.common.annotation.Log; |
|
22 |
import com.jcdm.common.core.controller.BaseController; |
|
23 |
import com.jcdm.common.core.domain.AjaxResult; |
|
24 |
import com.jcdm.common.enums.BusinessType; |
|
25 |
import com.jcdm.main.da.tileMatchRules.domain.DaTileMatchRules; |
|
26 |
import com.jcdm.main.da.tileMatchRules.service.IDaTileMatchRulesService; |
|
27 |
import com.jcdm.common.utils.poi.ExcelUtil; |
|
28 |
import com.jcdm.common.core.page.TableDataInfo; |
|
29 |
|
5030f3
|
30 |
import static com.jcdm.main.plcserver.sub.OPCUaSubscription.miloService; |
Y |
31 |
|
2df134
|
32 |
/** |
J |
33 |
* 配瓦规则Controller |
|
34 |
* |
|
35 |
* @author jiang |
|
36 |
* @date 2024-01-24 |
|
37 |
*/ |
|
38 |
@RestController |
|
39 |
@RequestMapping("/da/tileMatchRules") |
|
40 |
public class DaTileMatchRulesController extends BaseController |
|
41 |
{ |
|
42 |
@Autowired |
|
43 |
private IDaTileMatchRulesService daTileMatchRulesService; |
5030f3
|
44 |
|
Y |
45 |
@Autowired |
|
46 |
public IDaParamCollectionService daParamCollectionService; |
2df134
|
47 |
|
J |
48 |
/** |
1c7036
|
49 |
* 查询配瓦规则列表() |
2df134
|
50 |
*/ |
J |
51 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:list')") |
|
52 |
@GetMapping("/list") |
|
53 |
public TableDataInfo list(DaTileMatchRules daTileMatchRules) |
|
54 |
{ |
|
55 |
startPage(); |
|
56 |
List<DaTileMatchRules> list = daTileMatchRulesService.selectDaTileMatchRulesList(daTileMatchRules); |
|
57 |
return getDataTable(list); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
1c7036
|
61 |
* 曲轴配瓦 |
Y |
62 |
*/ |
|
63 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:list')") |
|
64 |
@GetMapping("/list2") |
|
65 |
public TableDataInfo list2(DaTileMatchRules daTileMatchRules) |
|
66 |
{ |
|
67 |
startPage(); |
|
68 |
List<DaTileMatchRules> list = daTileMatchRulesService.selectDaTileMatchRulesList(daTileMatchRules); |
|
69 |
return getDataTable(list); |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* 连杆配瓦 |
|
74 |
*/ |
|
75 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:list')") |
|
76 |
@GetMapping("/list4") |
|
77 |
public TableDataInfo list4(DaTileMatchRules daTileMatchRules) |
|
78 |
{ |
|
79 |
startPage(); |
|
80 |
List<DaTileMatchRules> list = daTileMatchRulesService.selectDaTileMatchRulesList(daTileMatchRules); |
|
81 |
return getDataTable(list); |
|
82 |
} |
|
83 |
|
|
84 |
/** |
|
85 |
* 平衡轴配瓦 |
|
86 |
*/ |
|
87 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:list')") |
|
88 |
@GetMapping("/list3") |
|
89 |
public TableDataInfo list3(DaTileMatchRules daTileMatchRules) |
|
90 |
{ |
|
91 |
startPage(); |
|
92 |
List<DaTileMatchRules> list = daTileMatchRulesService.selectDaTileMatchRulesList(daTileMatchRules); |
|
93 |
return getDataTable(list); |
|
94 |
} |
|
95 |
|
|
96 |
/** |
2df134
|
97 |
* 导出配瓦规则列表 |
J |
98 |
*/ |
|
99 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:export')") |
|
100 |
@Log(title = "配瓦规则", businessType = BusinessType.EXPORT) |
|
101 |
@PostMapping("/export") |
|
102 |
public void export(HttpServletResponse response, DaTileMatchRules daTileMatchRules) |
|
103 |
{ |
|
104 |
List<DaTileMatchRules> list = daTileMatchRulesService.selectDaTileMatchRulesList(daTileMatchRules); |
|
105 |
ExcelUtil<DaTileMatchRules> util = new ExcelUtil<DaTileMatchRules>(DaTileMatchRules.class); |
|
106 |
util.exportExcel(response, list, "配瓦规则数据"); |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* 获取配瓦规则详细信息 |
|
111 |
*/ |
|
112 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:query')") |
|
113 |
@GetMapping(value = "/{id}") |
|
114 |
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
115 |
{ |
|
116 |
return success(daTileMatchRulesService.selectDaTileMatchRulesById(id)); |
|
117 |
} |
|
118 |
|
|
119 |
/** |
|
120 |
* 新增配瓦规则 |
|
121 |
*/ |
|
122 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:add')") |
|
123 |
@Log(title = "配瓦规则", businessType = BusinessType.INSERT) |
|
124 |
@PostMapping |
|
125 |
public AjaxResult add(@RequestBody DaTileMatchRules daTileMatchRules) |
|
126 |
{ |
|
127 |
return toAjax(daTileMatchRulesService.insertDaTileMatchRules(daTileMatchRules)); |
|
128 |
} |
|
129 |
|
|
130 |
/** |
|
131 |
* 修改配瓦规则 |
|
132 |
*/ |
|
133 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:edit')") |
|
134 |
@Log(title = "配瓦规则", businessType = BusinessType.UPDATE) |
|
135 |
@PutMapping |
|
136 |
public AjaxResult edit(@RequestBody DaTileMatchRules daTileMatchRules) |
|
137 |
{ |
|
138 |
return toAjax(daTileMatchRulesService.updateDaTileMatchRules(daTileMatchRules)); |
|
139 |
} |
|
140 |
|
|
141 |
/** |
|
142 |
* 删除配瓦规则 |
|
143 |
*/ |
|
144 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:remove')") |
|
145 |
@Log(title = "配瓦规则", businessType = BusinessType.DELETE) |
|
146 |
@DeleteMapping("/{ids}") |
|
147 |
public AjaxResult remove(@PathVariable Long[] ids) |
|
148 |
{ |
|
149 |
return toAjax(daTileMatchRulesService.deleteDaTileMatchRulesByIds(ids)); |
|
150 |
} |
5030f3
|
151 |
|
Y |
152 |
@PreAuthorize("@ss.hasPermi('da:tileMatchRules:query')") |
|
153 |
@GetMapping(value = "/barcode") |
|
154 |
public String setBarcode(String barcode,String locationCode) { |
|
155 |
String XT=""; |
|
156 |
try { |
|
157 |
//Object SNCodeObject = miloService.readFromOpcUa("CFL4HX."+locationCode+".Code1").getValue(); |
|
158 |
Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.HOP040.Code1").getValue(); |
|
159 |
if (null == SNCodeObject){ |
|
160 |
//SNCodeObject = miloService.readFromOpcUa("CFL4HX."+locationCode+ ".Code").getValue(); |
|
161 |
SNCodeObject = miloService.readFromOpcUa("CFL4HX.HOP040.Code").getValue(); |
|
162 |
} |
|
163 |
if (null != SNCodeObject){ |
|
164 |
String SNCode = SNCodeObject.toString(); |
|
165 |
|
|
166 |
//插入数据 |
|
167 |
DaParamCollection saveData = new DaParamCollection(); |
|
168 |
saveData.setSfcCode(SNCode); |
|
169 |
saveData.setParamValue(barcode); |
|
170 |
saveData.setLocationCode(locationCode); |
|
171 |
saveData.setParamCode("CZM"); |
|
172 |
saveData.setParamName("曲轴"); |
|
173 |
daParamCollectionService.insertDaParamCollection(saveData); |
|
174 |
|
|
175 |
DaParamCollection ParamCollection = new DaParamCollection(); |
|
176 |
ParamCollection.setSfcCode(SNCode); |
|
177 |
List<DaParamCollection> DaParamCollectionlist=daParamCollectionService.selectDaParamCollectionList(ParamCollection); |
|
178 |
List<DaParamCollection> XTParamCollection = DaParamCollectionlist.stream().filter(x -> "箱体".equals(x.getParamName())).collect(Collectors.toList()); |
|
179 |
if (CollUtil.isNotEmpty(XTParamCollection)){ |
|
180 |
DaParamCollection lastOne = XTParamCollection.get(0); |
|
181 |
XT = lastOne.getParamValue(); |
|
182 |
} |
|
183 |
} |
|
184 |
} catch (Exception e) { |
|
185 |
throw new RuntimeException(e); |
|
186 |
} |
|
187 |
return XT; |
|
188 |
} |
2df134
|
189 |
} |