提交 | 用户 | 时间
|
71e81e
|
1 |
package cn.stylefeng.guns.modular.dq.materialTraceability.controller; |
懒 |
2 |
|
|
3 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; |
|
4 |
import cn.stylefeng.guns.modular.cm.paramCollection.model.params.ParamCollectionParam; |
|
5 |
import cn.stylefeng.guns.modular.cm.paramCollection.model.result.ParamCollectionResult; |
|
6 |
import cn.stylefeng.guns.modular.dq.materialTraceability.entity.MaterialTraceability; |
|
7 |
import cn.stylefeng.guns.modular.dq.materialTraceability.model.params.MaterialTraceabilityParam; |
|
8 |
import cn.stylefeng.guns.modular.dq.materialTraceability.model.result.MaterialTraceabilityResult; |
|
9 |
import cn.stylefeng.guns.modular.dq.materialTraceability.service.MaterialTraceabilityService; |
|
10 |
import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.model.params.ProductionOrderBatchInfoParam; |
|
11 |
import cn.stylefeng.guns.plcserver.opc.GlobalVariable; |
|
12 |
import cn.stylefeng.roses.core.base.controller.BaseController; |
|
13 |
import cn.stylefeng.roses.kernel.model.response.ResponseData; |
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
|
15 |
import org.springframework.stereotype.Controller; |
|
16 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
17 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
18 |
|
|
19 |
import java.lang.reflect.Field; |
|
20 |
import java.lang.reflect.Modifier; |
|
21 |
import java.util.List; |
|
22 |
import java.util.stream.Stream; |
|
23 |
|
|
24 |
|
|
25 |
/** |
|
26 |
* 物料追溯控制器 |
|
27 |
* |
|
28 |
* @author cl |
|
29 |
* @Date 2022-10-29 09:35:37 |
|
30 |
*/ |
|
31 |
@Controller |
|
32 |
@RequestMapping("/materialTraceability") |
|
33 |
public class MaterialTraceabilityController extends BaseController { |
|
34 |
|
|
35 |
private String PREFIX = "modular/dq/materialTraceability"; |
|
36 |
|
|
37 |
@Autowired |
|
38 |
private MaterialTraceabilityService materialTraceabilityService; |
|
39 |
|
|
40 |
/** |
|
41 |
* 跳转到主页面 |
|
42 |
* |
|
43 |
* @author cl |
|
44 |
* @Date 2022-10-29 |
|
45 |
*/ |
|
46 |
@RequestMapping("") |
|
47 |
public String index() { |
|
48 |
return PREFIX + "/materialTraceability.html"; |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* 新增页面 |
|
53 |
* |
|
54 |
* @author cl |
|
55 |
* @Date 2022-10-29 |
|
56 |
*/ |
|
57 |
@RequestMapping("/add") |
|
58 |
public String add() { |
|
59 |
return PREFIX + "/materialTraceability_add.html"; |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* 编辑页面 |
|
64 |
* |
|
65 |
* @author cl |
|
66 |
* @Date 2022-10-29 |
|
67 |
*/ |
|
68 |
@RequestMapping("/edit") |
|
69 |
public String edit() { |
|
70 |
return PREFIX + "/materialTraceability_edit.html"; |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* 新增接口 |
|
75 |
* |
|
76 |
* @author cl |
|
77 |
* @Date 2022-10-29 |
|
78 |
*/ |
|
79 |
@RequestMapping("/addItem") |
|
80 |
@ResponseBody |
|
81 |
public ResponseData addItem(MaterialTraceabilityParam materialTraceabilityParam) { |
|
82 |
this.materialTraceabilityService.add(materialTraceabilityParam); |
|
83 |
return ResponseData.success(); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* 产线上料新增接口 |
|
88 |
* |
|
89 |
* @author cl |
|
90 |
* @Date 2022-10-29 |
|
91 |
*/ |
|
92 |
@RequestMapping("/lineFeedingAddItem") |
|
93 |
@ResponseBody |
|
94 |
public ResponseData lineFeedingAddItem(MaterialTraceabilityParam materialTraceabilityParam) { |
|
95 |
this.materialTraceabilityService.lineFeedingAddItem(materialTraceabilityParam); |
|
96 |
return ResponseData.success(); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* 编辑接口 |
|
101 |
* |
|
102 |
* @author cl |
|
103 |
* @Date 2022-10-29 |
|
104 |
*/ |
|
105 |
@RequestMapping("/editItem") |
|
106 |
@ResponseBody |
|
107 |
public ResponseData editItem(MaterialTraceabilityParam materialTraceabilityParam) { |
|
108 |
this.materialTraceabilityService.update(materialTraceabilityParam); |
|
109 |
return ResponseData.success(); |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* 删除接口 |
|
114 |
* |
|
115 |
* @author cl |
|
116 |
* @Date 2022-10-29 |
|
117 |
*/ |
|
118 |
@RequestMapping("/delete") |
|
119 |
@ResponseBody |
|
120 |
public ResponseData delete(MaterialTraceabilityParam materialTraceabilityParam) { |
|
121 |
this.materialTraceabilityService.delete(materialTraceabilityParam); |
|
122 |
return ResponseData.success(); |
|
123 |
} |
|
124 |
|
|
125 |
/** |
|
126 |
* 查看详情接口 |
|
127 |
* |
|
128 |
* @author cl |
|
129 |
* @Date 2022-10-29 |
|
130 |
*/ |
|
131 |
@RequestMapping("/detail") |
|
132 |
@ResponseBody |
|
133 |
public ResponseData detail(MaterialTraceabilityParam materialTraceabilityParam) { |
|
134 |
MaterialTraceability detail = this.materialTraceabilityService.getById(materialTraceabilityParam.getId()); |
|
135 |
return ResponseData.success(detail); |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* 查询列表 |
|
140 |
* |
|
141 |
* @author cl |
|
142 |
* @Date 2022-10-29 |
|
143 |
*/ |
|
144 |
@ResponseBody |
|
145 |
@RequestMapping("/list") |
|
146 |
public LayuiPageInfo list(MaterialTraceabilityParam materialTraceabilityParam) { |
|
147 |
return this.materialTraceabilityService.findPageBySpec(materialTraceabilityParam); |
|
148 |
} |
|
149 |
|
|
150 |
@ResponseBody |
|
151 |
@RequestMapping("/barCodeCheck") |
|
152 |
public ResponseData barCodeCheck(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) { |
|
153 |
int i = materialTraceabilityService.barCodeCheck(productionOrderBatchInfoParam); |
|
154 |
return ResponseData.success(i); |
|
155 |
} |
|
156 |
|
|
157 |
/** |
|
158 |
* 导出excel |
|
159 |
* |
|
160 |
* @author cl |
|
161 |
* @Date 2022-10-28 |
|
162 |
*/ |
|
163 |
@RequestMapping("/exportTable") |
|
164 |
@ResponseBody |
|
165 |
public ResponseData exportTable(MaterialTraceabilityParam materialTraceabilityParam) { |
|
166 |
List<MaterialTraceabilityResult> list = materialTraceabilityService.exportTable(materialTraceabilityParam); |
|
167 |
return ResponseData.success(list); |
|
168 |
} |
|
169 |
|
|
170 |
public static void main(String[] args) { |
|
171 |
String str = "SLEEP_TIME"; |
|
172 |
String str1 = ""; |
|
173 |
try { |
|
174 |
Class<?> clazz = Class.forName("cn.stylefeng.guns.plcserver.opc.GlobalVariable"); |
|
175 |
Field[] fields = clazz.getFields(); |
|
176 |
for (Field field : fields) { |
|
177 |
int modifiers = field.getModifiers(); |
|
178 |
String name = field.getName(); |
|
179 |
if (name.equals(str)) { |
|
180 |
Object value = null; |
|
181 |
try { |
|
182 |
// field.get(null) 表示获取这个静态变量的值 |
|
183 |
value = field.get(null); |
|
184 |
System.out.println("----------------value" + value); // 打印 小红 |
|
185 |
str1 = String.valueOf(value); |
|
186 |
System.out.println(str1); |
|
187 |
} catch (IllegalAccessException e) { |
|
188 |
e.printStackTrace(); |
|
189 |
} |
|
190 |
} |
|
191 |
} |
|
192 |
} catch (ClassNotFoundException e) { |
|
193 |
e.printStackTrace(); |
|
194 |
} |
|
195 |
} |
|
196 |
|
|
197 |
} |
|
198 |
|
|
199 |
|