春风项目四线(合箱线、总装线)
wujian
2024-08-18 8876c234904459d038a2b282b3fdc30e006f9925
提交 | 用户 | 时间
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
45     public void insertPassStation(ProductNewPassStation productNewPassStation) {
46         productNewPassStationMapper.insertPassStation(productNewPassStation);
47     }
48
49     @Override
50     public ReceiveDataVO getDetailData() throws Exception {
51         ReceiveDataVO vo = new ReceiveDataVO();
52         Object SNCodeObject = miloService.readFromOpcUa("CFL3ZZ.OP050.Code").getValue();
53         if (ObjectUtils.isNotEmpty(SNCodeObject) && StringUtils.isNoneBlank(SNCodeObject.toString())){
54             String SNCode = SNCodeObject.toString();
55             //获取产品型号
56             String productType = getProductTypeBySfcCode(SNCode);
57             vo.setProductSeries(productType);
58             vo.setSfcCode(SNCode);
59         }
60         return vo;
61     }
62
63     private String getProductTypeBySfcCode(String SNCode) {
64         ProductNewPassStation productNewPassStation = new ProductNewPassStation();
65         productNewPassStation.setSfcCode(SNCode);
66         List<ProductNewPassStation> passStationList = productNewPassStationMapper.getProductPassStationList(productNewPassStation);
67         String productType = "";
68         if (CollUtil.isNotEmpty(passStationList)){
69             ProductNewPassStation passStation = passStationList.get(0);
70             if (ObjectUtils.isNotEmpty(passStation)){
71                 productType = passStation.getProductType();
72             }
73         }
74         return productType;
75     }
76
77
78 }