| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | if (0==i){ |
| | | map.put(identifier + "的saveRequest的信号",i+1); |
| | | } |
| | | // miloService.writeToOpcByte(entity); |
| | | miloService.writeToOpcByte(entity); |
| | | }else if ("SaveRequestLast".equals(parts[2])){ |
| | | ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeedLast", 1); |
| | | log.info("-------监听到,{}的SaveRequestLast的信号",identifier); |
| | |
| | | if (0==i){ |
| | | map.put(identifier + "的SaveRequestLast的信号",i+1); |
| | | } |
| | | // miloService.writeToOpcByte(entity); |
| | | miloService.writeToOpcByte(entity); |
| | | } |
| | | } |
| | | } |
| | |
| | | Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
| | | if(null != SNCodeObject) { |
| | | String SNCode=SNCodeObject.toString(); |
| | | String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]); |
| | | // String a="1"; |
| | | // String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]); |
| | | String a="1"; |
| | | // 1:OK可生产 2:NG不可生产 3:NG可返工 4:PC检索失败(无记录)5:PC检索失败(软件) |
| | | if (StrUtil.isNotBlank(a)){ |
| | | int input = Integer.parseInt(a); |
| | |
| | | } |
| | | |
| | | ReadWriteEntity entity2 = new ReadWriteEntity(parts[0]+"."+parts[1]+".OrderNumber", orderNum); |
| | | // miloService.writeToOpcByte(entity2); |
| | | miloService.writeToOpcUa(entity2); |
| | | } |
| | | //如果是返修工位需要传输返修工位号 |
| | | if (OPCElement.OP465_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP355_ZZ_CODE_CHECK.equals(Node)){ |
| | | rework(SNCode); |
| | | } |
| | | // miloService.writeToOpcByte(entity); |
| | | miloService.writeToOpcByte(entity); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void rework(String SNCode) { |
| | | private void rework(String SNCode) throws Exception{ |
| | | BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
| | | bsOrderScheduling.setEngineNo(SNCode); |
| | | List<String> allProcessCoed = new ArrayList<>(); |
| | |
| | | writeList.add(readWriteEntity); |
| | | }); |
| | | } |
| | | if (CollUtil.isNotEmpty(writeList)){ |
| | | ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
| | | readWriteEntity.setIdentifier("Repair_sign"); |
| | | readWriteEntity.setValue(1); |
| | | writeList.add(readWriteEntity); |
| | | // miloService.writeToOpcByte(writeList); |
| | | } |
| | | ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
| | | readWriteEntity.setIdentifier("Repair_sign"); |
| | | readWriteEntity.setValue(1); |
| | | writeList.add(readWriteEntity); |
| | | miloService.writeToOpcByte(writeList); |
| | | } |
| | | |
| | | |
| | |
| | | List<DaCollectionParamConf> list; |
| | | DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
| | | daCollectionParamConf.setGatherAddress(parts[0] + "." + parts[1]); |
| | | daCollectionParamConf.setRemarks("1"); |
| | | list = collectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf); |
| | | |
| | | List<String> nodeIdList = list.stream().map(info -> { |
| | |
| | | List<ReadWriteEntity> readWriteEntityList = miloService.readFromOpcUa(nodeIdList); |
| | | List<DaParamCollection> daParamCollectionlist = new ArrayList<>(); |
| | | for(int i=0;i<nodeIdList.size();i++){ |
| | | DaParamCollection ParamCollection = new DaParamCollection(); |
| | | if(!readWriteEntityList.get(i).getValue().toString().equals("0.0")){ |
| | | DaParamCollection ParamCollection = new DaParamCollection(); |
| | | ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]); |
| | | ParamCollection.setLocationCode(parts[1]); |
| | | ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString()); |
| | |
| | | daParamCollectionlist.add(ParamCollection); |
| | | } |
| | | } |
| | | System.out.println("11111111111111"); |
| | | daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist); |
| | | } |
| | | |
| | | Object object = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Runtime").getValue(); |
| | | Long beatTime = 0L; |
| | | if (ObjectUtil.isNotEmpty(object)){ |
| | | beatTime = (Long) object; |
| | | String str = object.toString(); |
| | | beatTime = Float.valueOf(str).longValue(); |
| | | } |
| | | DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection(); |
| | | PassingStationCollection.setSfcCode(SNCode); |