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