| | |
| | | package com.jcdm.main.plcserver.sub; |
| | | |
| | | |
| | | import com.jcdm.framework.websocket.WebSocketUsers; |
| | | import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf; |
| | | import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService; |
| | | import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.websocket.Session; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | |
| | | public class OPCUaSubscription implements SubscriptionCallback { |
| | | |
| | | public static MiloService miloService; |
| | | |
| | | Map<String, Session> map = WebSocketUsers.getUsers(); |
| | | |
| | | public IDaPassingStationCollectionService daPassingStationCollectionService; |
| | | |
| | |
| | | //进站保存数据 |
| | | // inSaveDate(thoroughfare,device) |
| | | //记录数据完成 |
| | | String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone"; |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(recordDataDoneValue).build()); |
| | | // String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone"; |
| | | // miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(recordDataDoneValue).build()); |
| | | |
| | | //给前端发工件到位信号 |
| | | |
| | | WebSocketUsers.sendMessageToUserByText(map.get(device), "IN"); |
| | | //请求工单 |
| | | |
| | | |
| | | |
| | | |
| | |
| | | //记录数据完成 |
| | | String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone"; |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(recordDataDoneValue).build()); |
| | | }else{ |
| | | }else { |
| | | System.out.println("^"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | //保存拧紧数据 |
| | | else if (("AngleResult").equals(tab)) { |
| | | if("1".equals(tabVlaue)||"2".equals(tabVlaue)){ |
| | | String Torque = thoroughfare + "." + device + ".Torque"; |
| | | String Angle = thoroughfare + "." + device + ".Angle"; |
| | | String Result = thoroughfare + "." + device + ".Result"; |
| | | String Result1 = thoroughfare + "." + device + ".Result1"; |
| | | List<String> list = new ArrayList(); |
| | | list.add(Torque); |
| | | list.add(Angle); |
| | | list.add(Result); |
| | | list.add(Result1); |
| | | List<ReadWriteEntity> list1 = miloService.readFromOpcUa(list); |
| | | List<Object> collect = list1.stream().map(ReadWriteEntity::getValue).collect(Collectors.toList()); |
| | | String joinedString = String.join(",", collect.toString()); |
| | | WebSocketUsers.sendMessageToUserByText(map.get(device), joinedString); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |