春风项目四线(合箱线、总装线)
wujian
2024-09-10 51b05b093fa15dd477981372f67ae7b3b2747733
提交 | 用户 | 时间
59e228 1 package com.jcdm.main.da.passingStationCollection.service.impl;
W 2
3 import cn.hutool.core.collection.CollUtil;
4 import com.jcdm.common.utils.StringUtils;
5 import com.jcdm.main.da.passingStationCollection.domain.ProductNewPassStation;
6 import com.jcdm.main.da.passingStationCollection.mapper.ProductNewPassStationMapper;
7 import com.jcdm.main.da.passingStationCollection.service.ProductNewPassStationService;
8 import com.jcdm.main.da.tileMatchCollection.domain.ReceiveDataVO;
9 import org.apache.commons.lang3.ObjectUtils;
10 import org.springframework.stereotype.Service;
11
12 import javax.annotation.Resource;
13 import java.util.List;
14
15 import static com.jcdm.main.plcserver.sub.OPCUaSubscription.miloService;
16
17
18 @Service
19 public class ProductNewPassStationServiceImpl implements ProductNewPassStationService {
20
21     @Resource
22     private ProductNewPassStationMapper productNewPassStationMapper;
23
24
25     public ProductNewPassStation getPassStation(ProductNewPassStation productNewPassStation){
26         return productNewPassStationMapper.getPassStation(productNewPassStation);
27     }
28
29     @Override
30     public List<ProductNewPassStation> getProductPassStationList(ProductNewPassStation productNewPassStation) {
31         return productNewPassStationMapper.getProductPassStationList(productNewPassStation);
32     }
33
34     @Override
8876c2 35     public List<ProductNewPassStation> getProductPassStationListByEngineList(List<String> engineNoList) {
W 36        return productNewPassStationMapper.getProductPassStationListByEngineList(engineNoList);
37     }
38
39     @Override
59e228 40     public void updatePassStationBySfcCode(String sfcCode) {
W 41         productNewPassStationMapper.updatePassStationBySfcCode(sfcCode);
42     }
43
44     @Override
51b05b 45     public void updateBoxCodeBySfcCode(String sfcCode, String newBoxCode) {
W 46         productNewPassStationMapper.updateBoxCodeBySfcCode(sfcCode, newBoxCode);
47     }
48
49     @Override
59e228 50     public void insertPassStation(ProductNewPassStation productNewPassStation) {
W 51         productNewPassStationMapper.insertPassStation(productNewPassStation);
52     }
53
54     @Override
55     public ReceiveDataVO getDetailData() throws Exception {
56         ReceiveDataVO vo = new ReceiveDataVO();
57         Object SNCodeObject = miloService.readFromOpcUa("CFL3ZZ.OP050.Code").getValue();
58         if (ObjectUtils.isNotEmpty(SNCodeObject) && StringUtils.isNoneBlank(SNCodeObject.toString())){
59             String SNCode = SNCodeObject.toString();
60             //获取产品型号
61             String productType = getProductTypeBySfcCode(SNCode);
62             vo.setProductSeries(productType);
63             vo.setSfcCode(SNCode);
64         }
65         return vo;
66     }
67
68     private String getProductTypeBySfcCode(String SNCode) {
69         ProductNewPassStation productNewPassStation = new ProductNewPassStation();
70         productNewPassStation.setSfcCode(SNCode);
71         List<ProductNewPassStation> passStationList = productNewPassStationMapper.getProductPassStationList(productNewPassStation);
72         String productType = "";
73         if (CollUtil.isNotEmpty(passStationList)){
74             ProductNewPassStation passStation = passStationList.get(0);
75             if (ObjectUtils.isNotEmpty(passStation)){
76                 productType = passStation.getProductType();
77             }
78         }
79         return productType;
80     }
81
82
83 }