提交 | 用户 | 时间
|
d9cf6b
|
1 |
package com.jcdm.main.bs.orderScheduling.controller; |
J |
2 |
|
c74dcb
|
3 |
import cn.hutool.core.collection.CollUtil; |
59e228
|
4 |
import cn.hutool.core.util.StrUtil; |
c74dcb
|
5 |
import com.alibaba.excel.EasyExcel; |
W |
6 |
import com.alibaba.excel.ExcelWriter; |
|
7 |
import com.alibaba.excel.write.metadata.WriteSheet; |
|
8 |
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
c6aaad
|
9 |
import com.jcdm.common.annotation.Log; |
W |
10 |
import com.jcdm.common.core.controller.BaseController; |
|
11 |
import com.jcdm.common.core.domain.AjaxResult; |
c6e069
|
12 |
import com.jcdm.common.core.domain.R; |
c74dcb
|
13 |
import com.jcdm.common.core.domain.entity.SysDictData; |
c6aaad
|
14 |
import com.jcdm.common.core.page.TableDataInfo; |
W |
15 |
import com.jcdm.common.enums.BusinessType; |
766c03
|
16 |
import com.jcdm.common.utils.StringUtils; |
c6aaad
|
17 |
import com.jcdm.common.utils.poi.ExcelUtil; |
d4f437
|
18 |
import com.jcdm.main.bs.orderScheduling.common.Constants; |
c6aaad
|
19 |
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
W |
20 |
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
c74dcb
|
21 |
import com.jcdm.main.bs.orderScheduling.vo.FollowReportVO; |
c6e069
|
22 |
import com.jcdm.main.bs.orderScheduling.vo.LineChartVO; |
d4f437
|
23 |
import com.jcdm.main.bs.orderScheduling.vo.SumDataVO; |
c74dcb
|
24 |
import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
d4f437
|
25 |
import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; |
c74dcb
|
26 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
59e228
|
27 |
import com.jcdm.main.da.passingStationCollection.domain.ProductNewPassStation; |
1e3074
|
28 |
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
59e228
|
29 |
import com.jcdm.main.da.passingStationCollection.service.ProductNewPassStationService; |
dd4482
|
30 |
import com.jcdm.main.da.tileMatchCollection.domain.DaTileMatchCollection; |
Y |
31 |
import com.jcdm.main.da.tileMatchCollection.service.IDaTileMatchCollectionService; |
d4f437
|
32 |
import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo; |
Y |
33 |
import com.jcdm.main.om.productionOrde.service.impl.OmProductionOrdeInfoServiceImpl; |
c6aaad
|
34 |
import com.jcdm.main.plcserver.conf.OPCElement; |
d4f437
|
35 |
import com.jcdm.main.plcserver.sub.OPCUaSubscription; |
c74dcb
|
36 |
import com.jcdm.system.service.ISysDictDataService; |
c6aaad
|
37 |
import com.kangaroohy.milo.model.ReadWriteEntity; |
W |
38 |
import com.kangaroohy.milo.service.MiloService; |
d9cf6b
|
39 |
import org.springframework.beans.factory.annotation.Autowired; |
5a05af
|
40 |
import org.springframework.beans.factory.annotation.Value; |
c6aaad
|
41 |
import org.springframework.security.access.prepost.PreAuthorize; |
d4f437
|
42 |
import org.springframework.transaction.annotation.Transactional; |
c6aaad
|
43 |
import org.springframework.web.bind.annotation.*; |
W |
44 |
|
|
45 |
import javax.annotation.Resource; |
|
46 |
import javax.servlet.http.HttpServletResponse; |
|
47 |
import java.io.IOException; |
|
48 |
import java.util.ArrayList; |
59e228
|
49 |
import java.util.Date; |
c6aaad
|
50 |
import java.util.List; |
59e228
|
51 |
import java.util.UUID; |
c6aaad
|
52 |
import java.util.stream.Collectors; |
d9cf6b
|
53 |
|
J |
54 |
/** |
|
55 |
* 订单排产Controller |
|
56 |
* |
|
57 |
* @author jiang |
2aea64
|
58 |
* @date 2024-01-13 |
d9cf6b
|
59 |
*/ |
J |
60 |
@RestController |
|
61 |
@RequestMapping("/bs/orderScheduling") |
|
62 |
public class BsOrderSchedulingController extends BaseController |
|
63 |
{ |
|
64 |
@Autowired |
|
65 |
private IBsOrderSchedulingService bsOrderSchedulingService; |
|
66 |
|
c74dcb
|
67 |
|
W |
68 |
@Resource |
|
69 |
private ISysDictDataService iSysDictDataService; |
|
70 |
|
d4f437
|
71 |
@Resource |
Y |
72 |
private OmProductionOrdeInfoServiceImpl productionOrdeInfoService; |
|
73 |
@Resource |
|
74 |
private DaParamCollectionMapper daParamCollectionService; |
dd4482
|
75 |
@Resource |
Y |
76 |
private IDaTileMatchCollectionService daTileMatchCollectionService; |
59e228
|
77 |
@Resource |
W |
78 |
private ProductNewPassStationService productNewPassStationService; |
1e3074
|
79 |
|
W |
80 |
@Resource |
|
81 |
private IDaPassingStationCollectionService daPassingStationCollectionService; |
c6aaad
|
82 |
|
W |
83 |
@Autowired |
|
84 |
MiloService miloService; |
|
85 |
|
5a05af
|
86 |
@Value("${websocketUrl}") |
W |
87 |
private String websocketUrl; |
|
88 |
|
c6aaad
|
89 |
@GetMapping("/forceUpload") |
W |
90 |
public void forceUpload() throws Exception { |
|
91 |
ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP121_ZZ_CODE_CHECK, 1); |
|
92 |
miloService.writeToOpcByte(entity); |
|
93 |
} |
5a05af
|
94 |
|
W |
95 |
@GetMapping("/websocketUrl") |
|
96 |
public String websocketName() { |
|
97 |
return websocketUrl; |
|
98 |
} |
|
99 |
|
|
100 |
|
d9cf6b
|
101 |
/** |
J |
102 |
* 查询订单排产列表 |
|
103 |
*/ |
|
104 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')") |
|
105 |
@GetMapping("/list") |
|
106 |
public TableDataInfo list(BsOrderScheduling bsOrderScheduling) |
|
107 |
{ |
29d394
|
108 |
startPage(); |
d9cf6b
|
109 |
List<BsOrderScheduling> list = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling); |
J |
110 |
return getDataTable(list); |
|
111 |
} |
|
112 |
|
c6e069
|
113 |
/** |
8aafc5
|
114 |
* 查询追溯列表 |
c74dcb
|
115 |
*/ |
W |
116 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')") |
|
117 |
@GetMapping("/getFollowReportList") |
|
118 |
public R getFollowReportList(BsOrderScheduling bsOrderScheduling) |
|
119 |
{ |
|
120 |
FollowReportVO followReportList = bsOrderSchedulingService.getFollowReportList(bsOrderScheduling); |
|
121 |
return R.ok(followReportList); |
|
122 |
} |
|
123 |
|
|
124 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:export')") |
|
125 |
@Log(title = "追溯报表导出", businessType = BusinessType.EXPORT) |
|
126 |
@PostMapping("/exportFollow") |
|
127 |
public void exportFollow(HttpServletResponse response, BsOrderScheduling bsOrderScheduling) |
|
128 |
{ |
|
129 |
FollowReportVO followReportList = bsOrderSchedulingService.getFollowReportList(bsOrderScheduling); |
|
130 |
List<SysDictData> allDict = iSysDictDataService.selectDictDataList(null); |
|
131 |
if (CollUtil.isNotEmpty(followReportList.getMainList())){ |
|
132 |
List<SysDictData> dict1 = allDict.stream().filter(x -> "material_type".equals(x.getDictType())).collect(Collectors.toList()); |
|
133 |
List<SysDictData> dict2 = allDict.stream().filter(x -> "order_scheduling_produce_status".equals(x.getDictType())).collect(Collectors.toList()); |
|
134 |
for (BsOrderScheduling orderScheduling : followReportList.getMainList()) { |
|
135 |
if (CollUtil.isNotEmpty(dict1)){ |
|
136 |
List<SysDictData> collect = dict1.stream().filter(x -> x.getDictValue().equals(orderScheduling.getProductType())).collect(Collectors.toList()); |
|
137 |
if (CollUtil.isNotEmpty(collect)){ |
|
138 |
SysDictData sysDictData1 = collect.get(0); |
|
139 |
orderScheduling.setProductTypeString(sysDictData1.getDictLabel()); |
|
140 |
} |
|
141 |
} |
|
142 |
if (CollUtil.isNotEmpty(dict2)){ |
|
143 |
List<SysDictData> collect = dict2.stream().filter(x -> x.getDictValue().equals(orderScheduling.getProductionStatus())).collect(Collectors.toList()); |
|
144 |
if (CollUtil.isNotEmpty(collect)){ |
|
145 |
SysDictData sysDictData1 = collect.get(0); |
|
146 |
orderScheduling.setProductionStatusString(sysDictData1.getDictLabel()); |
|
147 |
} |
|
148 |
} |
|
149 |
} |
|
150 |
} |
|
151 |
String fileName = "追溯报表"; |
|
152 |
try { |
|
153 |
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); |
|
154 |
WriteSheet mainSheet = EasyExcel.writerSheet(0, "订单排产") |
|
155 |
.head(BsOrderScheduling.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
156 |
.build(); |
|
157 |
WriteSheet sheet1 = EasyExcel.writerSheet(1, "拧紧数据") |
|
158 |
.head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
159 |
.build(); |
|
160 |
WriteSheet sheet2 = EasyExcel.writerSheet(2, "相机检测") |
|
161 |
.head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
162 |
.build(); |
|
163 |
WriteSheet sheet3 = EasyExcel.writerSheet(3, "外漏检测") |
|
164 |
.head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
165 |
.build(); |
|
166 |
WriteSheet sheet4 = EasyExcel.writerSheet(4, "机油加注") |
|
167 |
.head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
168 |
.build(); |
|
169 |
WriteSheet sheet5 = EasyExcel.writerSheet(5, "工位结果") |
|
170 |
.head(DaPassingStationCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
171 |
.build(); |
|
172 |
excelWriter.write(followReportList.getMainList(),mainSheet); |
|
173 |
excelWriter.write(followReportList.getList1(),sheet1); |
|
174 |
excelWriter.write(followReportList.getList2(),sheet2); |
|
175 |
excelWriter.write(followReportList.getList3(),sheet3); |
|
176 |
excelWriter.write(followReportList.getList4(),sheet4); |
|
177 |
excelWriter.write(followReportList.getList5(),sheet5); |
|
178 |
response.setContentType("application/vnd.ms-excel;charset=utf-8"); |
|
179 |
response.setCharacterEncoding("UTF-8"); |
|
180 |
response.setHeader("Content-Disposition","attachment;filename="+fileName+".xlsx"); |
|
181 |
excelWriter.finish(); |
|
182 |
} catch (IOException e) { |
|
183 |
throw new RuntimeException(e); |
|
184 |
} |
|
185 |
} |
|
186 |
|
|
187 |
/** |
c6e069
|
188 |
* 查询下线数量 |
W |
189 |
*/ |
|
190 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')") |
|
191 |
@GetMapping("/getOffLineNum") |
|
192 |
public TableDataInfo getOffLineNum(BsOrderScheduling bsOrderScheduling) |
|
193 |
{ |
|
194 |
|
|
195 |
List<LineChartVO> vo = bsOrderSchedulingService.getOffLineNum(); |
|
196 |
return getDataTable(vo); |
|
197 |
} |
|
198 |
|
6eaf05
|
199 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')") |
W |
200 |
@GetMapping("/list2") |
|
201 |
public TableDataInfo list2(BsOrderScheduling bsOrderScheduling) |
|
202 |
{ |
b849f1
|
203 |
// startPage(); |
766c03
|
204 |
List<BsOrderScheduling> list = new ArrayList<>(); |
C |
205 |
if (StringUtils.isNotEmpty(bsOrderScheduling.getOrderNo())){ |
|
206 |
list = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling); |
|
207 |
} |
d9cf6b
|
208 |
return getDataTable(list); |
J |
209 |
} |
|
210 |
|
d4f437
|
211 |
@GetMapping("/list3") |
Y |
212 |
public TableDataInfo list3(BsOrderScheduling bsOrderScheduling) |
|
213 |
{ |
|
214 |
startPage(); |
|
215 |
List<BsOrderScheduling> list = new ArrayList<>(); |
|
216 |
if (StringUtils.isNotEmpty(bsOrderScheduling.getOrderNo())){ |
|
217 |
list = bsOrderSchedulingService.selectBsOrderSchedulingPage(bsOrderScheduling); |
|
218 |
} |
|
219 |
List<BsOrderScheduling> collect = list.stream().filter(x -> Constants.UN_QUALIFIED.equals(x.getQualityStatus())).collect(Collectors.toList()); |
|
220 |
if (CollUtil.isNotEmpty(collect)){ |
|
221 |
String.valueOf(collect.size()); |
|
222 |
} |
|
223 |
return getDataTable(list); |
|
224 |
} |
|
225 |
|
d9cf6b
|
226 |
/** |
J |
227 |
* 导出订单排产列表 |
|
228 |
*/ |
|
229 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:export')") |
|
230 |
@Log(title = "订单排产", businessType = BusinessType.EXPORT) |
|
231 |
@PostMapping("/export") |
|
232 |
public void export(HttpServletResponse response, BsOrderScheduling bsOrderScheduling) |
|
233 |
{ |
|
234 |
List<BsOrderScheduling> list = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling); |
|
235 |
ExcelUtil<BsOrderScheduling> util = new ExcelUtil<BsOrderScheduling>(BsOrderScheduling.class); |
|
236 |
util.exportExcel(response, list, "订单排产数据"); |
|
237 |
} |
|
238 |
|
|
239 |
/** |
|
240 |
* 获取订单排产详细信息 |
|
241 |
*/ |
|
242 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:query')") |
2aea64
|
243 |
@GetMapping(value = "/{id}") |
J |
244 |
public AjaxResult getInfo(@PathVariable("id") Long id) |
d9cf6b
|
245 |
{ |
2aea64
|
246 |
return success(bsOrderSchedulingService.selectBsOrderSchedulingById(id)); |
d9cf6b
|
247 |
} |
J |
248 |
|
|
249 |
/** |
|
250 |
* 新增订单排产 |
|
251 |
*/ |
|
252 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:add')") |
|
253 |
@Log(title = "订单排产", businessType = BusinessType.INSERT) |
|
254 |
@PostMapping |
|
255 |
public AjaxResult add(@RequestBody BsOrderScheduling bsOrderScheduling) |
|
256 |
{ |
|
257 |
return toAjax(bsOrderSchedulingService.insertBsOrderScheduling(bsOrderScheduling)); |
|
258 |
} |
|
259 |
|
|
260 |
/** |
|
261 |
* 修改订单排产 |
|
262 |
*/ |
|
263 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:edit')") |
|
264 |
@Log(title = "订单排产", businessType = BusinessType.UPDATE) |
|
265 |
@PutMapping |
|
266 |
public AjaxResult edit(@RequestBody BsOrderScheduling bsOrderScheduling) |
|
267 |
{ |
|
268 |
return toAjax(bsOrderSchedulingService.updateBsOrderScheduling(bsOrderScheduling)); |
|
269 |
} |
|
270 |
|
|
271 |
/** |
|
272 |
* 删除订单排产 |
|
273 |
*/ |
|
274 |
@PreAuthorize("@ss.hasPermi('bs:orderScheduling:remove')") |
|
275 |
@Log(title = "订单排产", businessType = BusinessType.DELETE) |
2aea64
|
276 |
@DeleteMapping("/{ids}") |
J |
277 |
public AjaxResult remove(@PathVariable Long[] ids) |
d9cf6b
|
278 |
{ |
2aea64
|
279 |
return toAjax(bsOrderSchedulingService.deleteBsOrderSchedulingByIds(ids)); |
d9cf6b
|
280 |
} |
d4f437
|
281 |
@GetMapping("/getSumData") |
Y |
282 |
public R getSumData(BsOrderScheduling bsOrderScheduling){ |
|
283 |
List<BsOrderScheduling> list = new ArrayList<>(); |
|
284 |
int onlineNum = 0; |
|
285 |
int finishNum = 0; |
|
286 |
if (StringUtils.isNotEmpty(bsOrderScheduling.getOrderNo())){ |
|
287 |
|
|
288 |
list = bsOrderSchedulingService.selectBsOrderSchedulingPage(bsOrderScheduling); |
|
289 |
List<BsOrderScheduling> onlineNumList = list.stream().filter(x -> Constants.ORDER_STATUS_ING.equals(x.getProductionStatus())).collect(Collectors.toList()); |
|
290 |
if (CollUtil.isNotEmpty(onlineNumList)){ |
|
291 |
onlineNum = onlineNumList.size(); |
|
292 |
} |
|
293 |
List<BsOrderScheduling> finishNumList = list.stream().filter(x -> Constants.FINISH_PRODUCTION.equals(x.getProductionStatus())).collect(Collectors.toList()); |
|
294 |
if (CollUtil.isNotEmpty(finishNumList)){ |
|
295 |
finishNum = finishNumList.size(); |
|
296 |
} |
|
297 |
} |
|
298 |
List<BsOrderScheduling> collect = list.stream().filter(x -> Constants.UN_QUALIFIED.equals(x.getQualityStatus())).collect(Collectors.toList()); |
|
299 |
String unqualified = "0"; |
|
300 |
if (CollUtil.isNotEmpty(collect)){ |
|
301 |
unqualified = String.valueOf(collect.size()); |
|
302 |
} |
|
303 |
SumDataVO vo = new SumDataVO(); |
|
304 |
vo.setFinishNum(finishNum); |
|
305 |
vo.setOnlineNum(onlineNum); |
|
306 |
vo.setUnqualified(unqualified); |
|
307 |
return R.ok(vo); |
|
308 |
} |
|
309 |
|
|
310 |
/** |
|
311 |
* 校验发动机号是否和机型匹配、是否重复扫描、是否超出计划数量 |
|
312 |
* @param engineNo 箱体码 |
|
313 |
* @param model 机型 |
|
314 |
* @return boolean |
|
315 |
*/ |
|
316 |
@Transactional(rollbackFor = Exception.class) |
|
317 |
@GetMapping("/engineNoIsInModel") |
|
318 |
public R engineNoIsInModel(String engineNo,String model,String orderNo) throws Exception { |
|
319 |
|
|
320 |
if (StringUtils.isEmpty(engineNo)){ |
1e3074
|
321 |
return R.fail(500,"箱体码为空或已存在,请重试"); |
d4f437
|
322 |
} |
1e3074
|
323 |
ProductNewPassStation checkStation = new ProductNewPassStation(); |
W |
324 |
checkStation.setBoxCode(engineNo); |
|
325 |
List<ProductNewPassStation> checkList = productNewPassStationService.getProductPassStationList(checkStation); |
d4f437
|
326 |
BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
Y |
327 |
bsOrderScheduling.setOrderNo(orderNo); |
|
328 |
List<BsOrderScheduling> allList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling); |
|
329 |
List<BsOrderScheduling> dlist = allList.stream().filter(x->x.getProductionStatus().equals(Constants.WAIT_PRODUCTION)).collect(Collectors.toList()); |
|
330 |
List<BsOrderScheduling> collect = allList.stream().filter(x -> x.getProductionStatus().equals(Constants.ORDER_STATUS_ING) |
1e3074
|
331 |
||x.getProductionStatus().equals(Constants.FINISH_PRODUCTION)).collect(Collectors.toList()); |
d4f437
|
332 |
|
1e3074
|
333 |
if (CollUtil.isNotEmpty(checkList)){ |
W |
334 |
//重复扫码 |
|
335 |
ProductNewPassStation productNewPassStation = checkList.get(0); |
|
336 |
String sfcCode = productNewPassStation.getSfcCode(); |
|
337 |
DaPassingStationCollection passingStationCollection = new DaPassingStationCollection(); |
|
338 |
passingStationCollection.setSfcCode(sfcCode); |
|
339 |
List<DaPassingStationCollection> daPassingStationCollections = daPassingStationCollectionService.selectDaPassingStationCollectionList(passingStationCollection); |
|
340 |
if (CollUtil.isNotEmpty(daPassingStationCollections)){ |
|
341 |
//过站后重新上线 |
|
342 |
//OPC操作 |
|
343 |
logger.info("过站后重新上线,{}",sfcCode); |
|
344 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP010.Code", sfcCode); |
|
345 |
OPCUaSubscription.miloService.writeToOpcUa(entity);//写SN |
|
346 |
return R.ok(); |
|
347 |
} else { |
|
348 |
//OPC操作 |
|
349 |
logger.info("当前站重新扫码,{}",sfcCode); |
|
350 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP010.Code", sfcCode); |
|
351 |
OPCUaSubscription.miloService.writeToOpcUa(entity);//写SN |
|
352 |
return R.ok(); |
d4f437
|
353 |
} |
1e3074
|
354 |
}else { |
d4f437
|
355 |
|
1e3074
|
356 |
if (CollUtil.isNotEmpty(dlist)){ |
W |
357 |
BsOrderScheduling OrderScheduling=dlist.get(0); |
dd4482
|
358 |
|
1e3074
|
359 |
OmProductionOrdeInfo info = new OmProductionOrdeInfo(); |
W |
360 |
info.setWorkOrderNo(orderNo); |
|
361 |
List<OmProductionOrdeInfo> omProductionOrdeInfos = productionOrdeInfoService.selectOmProductionOrdeInfoList(info); |
|
362 |
if (CollUtil.isNotEmpty(omProductionOrdeInfos)){ |
|
363 |
OmProductionOrdeInfo omProductionOrdeInfo = omProductionOrdeInfos.get(0); |
|
364 |
Long planQty = omProductionOrdeInfo.getPlanQty(); |
|
365 |
if (planQty<collect.size()){ |
|
366 |
return R.ok(500,"超出计划数量,请检查后重试"); |
|
367 |
} |
59e228
|
368 |
} |
1e3074
|
369 |
//插入数据 |
W |
370 |
DaParamCollection saveData = new DaParamCollection(); |
|
371 |
saveData.setSfcCode(OrderScheduling.getEngineNo()); |
|
372 |
saveData.setParamValue(engineNo); |
|
373 |
saveData.setLocationCode("OP010"); |
|
374 |
saveData.setParamCode("XTM"); |
|
375 |
saveData.setParamName("箱体"); |
|
376 |
daParamCollectionService.insertDaParamCollection(saveData); |
|
377 |
|
|
378 |
DaTileMatchCollection MatchCollection = new DaTileMatchCollection(); |
|
379 |
MatchCollection.setSfcCode(OrderScheduling.getEngineNo()); |
|
380 |
MatchCollection.setParamValue(engineNo); |
|
381 |
MatchCollection.setLocationCode("OP010"); |
|
382 |
MatchCollection.setParamCode("XTM"); |
|
383 |
MatchCollection.setParamName("箱体"); |
|
384 |
daTileMatchCollectionService.insertDaTileMatchCollection(MatchCollection); |
|
385 |
|
|
386 |
if (StrUtil.isNotBlank(OrderScheduling.getEngineNo())){ |
|
387 |
String snCode = OrderScheduling.getEngineNo(); |
|
388 |
if (snCode.startsWith("280") || snCode.startsWith("380")){ |
|
389 |
ProductNewPassStation productNewPassStation = new ProductNewPassStation(); |
|
390 |
UUID uuid = UUID.randomUUID(); |
|
391 |
productNewPassStation.setId(uuid.getMostSignificantBits()); |
|
392 |
productNewPassStation.setFinishFlag("0"); |
|
393 |
productNewPassStation.setSfcCode(OrderScheduling.getEngineNo()); |
|
394 |
productNewPassStation.setCreateTime(new Date()); |
|
395 |
productNewPassStation.setBoxCode(engineNo); |
|
396 |
if (snCode.startsWith("280")){ |
|
397 |
productNewPassStation.setProductType("280"); |
|
398 |
} else { |
|
399 |
productNewPassStation.setProductType("380"); |
|
400 |
} |
|
401 |
productNewPassStationService.insertPassStation(productNewPassStation); |
|
402 |
} |
|
403 |
} |
|
404 |
|
|
405 |
//更新上线数量 |
|
406 |
int onlineNum = 0; |
|
407 |
List<BsOrderScheduling> onlineNumList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling) |
|
408 |
.stream().filter(x -> Constants.ORDER_STATUS_ING.equals(x.getProductionStatus())||x.getProductionStatus().equals(Constants.FINISH_PRODUCTION)).collect(Collectors.toList()); |
|
409 |
if (CollUtil.isNotEmpty(onlineNumList)){ |
|
410 |
onlineNum = onlineNumList.size(); |
|
411 |
} |
|
412 |
OmProductionOrdeInfo omProductionOrdeInfo = new OmProductionOrdeInfo(); |
|
413 |
omProductionOrdeInfo.setWorkOrderNo(orderNo); |
|
414 |
List<OmProductionOrdeInfo> omList = productionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo); |
|
415 |
if (CollUtil.isNotEmpty(omList)){ |
|
416 |
OmProductionOrdeInfo omInfo = omList.get(0); |
|
417 |
String s = String.valueOf(onlineNum); |
|
418 |
long l = Long.parseLong(s); |
|
419 |
omInfo.setActualOnlineQty(l); |
|
420 |
productionOrdeInfoService.updateOmProductionOrdeInfo(omInfo); |
|
421 |
} |
|
422 |
|
|
423 |
//OPC操作 |
|
424 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP010.Code", OrderScheduling.getEngineNo()); |
|
425 |
OPCUaSubscription.miloService.writeToOpcUa(entity);//写SN |
|
426 |
|
|
427 |
|
|
428 |
OrderScheduling.setProductionStatus("2"); |
|
429 |
bsOrderSchedulingService.updateBsOrderScheduling(OrderScheduling); |
|
430 |
return R.ok(); |
59e228
|
431 |
} |
1e3074
|
432 |
|
59e228
|
433 |
} |
W |
434 |
|
d4f437
|
435 |
return R.ok(); |
Y |
436 |
} |
d9cf6b
|
437 |
} |