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 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;
|
}
|
|
|
}
|