| | |
| | | config: |
| | | default: |
| | | endpoint: opc.tcp://127.0.0.1:49320 |
| | | security-policy: none |
| | | security-policy: none |
| | | websocketUrl: 'ws://10.10.12.100:8081/websocket/111122' |
| | | #websocketUrl: 'ws://127.0.0.1:8086/websocket/111122' |
| | |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Autowired |
| | | MiloService miloService; |
| | | |
| | | @Value("${websocketUrl}") |
| | | private String websocketUrl; |
| | | |
| | | @GetMapping("/forceUpload") |
| | | public void forceUpload() throws Exception { |
| | | ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP121_ZZ_CODE_CHECK, 1); |
| | | miloService.writeToOpcByte(entity); |
| | | } |
| | | |
| | | @GetMapping("/websocketUrl") |
| | | public String websocketName() { |
| | | return websocketUrl; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询订单排产列表 |
| | | */ |
| | |
| | | method: 'get', |
| | | }) |
| | | } |
| | | export function getUrl() { |
| | | return request({ |
| | | url: '/bs/orderScheduling/websocketUrl', |
| | | method: 'get', |
| | | }) |
| | | } |
| | | //查询追溯报表 |
| | | export function getFollowReport(query) { |
| | | return request({ |
| | |
| | | </template> |
| | | <script> |
| | | |
| | | import { listOrderScheduling, forceUploadMethod, getOrderScheduling, delOrderScheduling, addOrderScheduling, updateOrderScheduling } from "@/api/main/bs/orderScheduling/orderScheduling"; |
| | | import { listOrderScheduling, forceUploadMethod, getUrl, getOrderScheduling, delOrderScheduling, addOrderScheduling, updateOrderScheduling } from "@/api/main/bs/orderScheduling/orderScheduling"; |
| | | import { listPassingStationCollection, getPassingStationCollection, delPassingStationCollection, addPassingStationCollection, updatePassingStationCollection } from "@/api/main/da/passingStationCollection/passingStationCollection"; |
| | | import {listLineInfo} from "@/api/main/bs/lineInfo/lineInfo"; |
| | | import WebSocketReconnect from "@/utils/WebsocketTool"; |
| | |
| | | props: [], |
| | | data() { |
| | | return { |
| | | websocketUrl: '', |
| | | websocket: null, |
| | | result: {}, |
| | | transEngineNo: '', |
| | |
| | | // immediate:true |
| | | // } |
| | | }, |
| | | created() {}, |
| | | created() { |
| | | |
| | | }, |
| | | mounted() { |
| | | this.initWebSocket() |
| | | this.getWebUrl() |
| | | |
| | | }, |
| | | methods: { |
| | | getWebUrl(){ |
| | | console.log("1111") |
| | | getUrl().then(res=>{ |
| | | console.log("res",res) |
| | | this.websocketUrl = res |
| | | this.initWebSocket() |
| | | }) |
| | | }, |
| | | forceUpload() { |
| | | console.log('0000', this.form.engineNo) |
| | | if (this.form.engineNo !== null) { |
| | |
| | | //判断当前浏览器是否支持WebSocket |
| | | if ('WebSocket' in window) { |
| | | //连接WebSocket节点 |
| | | this.websocket = new WebSocketReconnect('ws://127.0.0.1:8086/websocket/111122') |
| | | console.log("9999",this.websocketUrl) |
| | | this.websocket = new WebSocketReconnect(this.websocketUrl) |
| | | |
| | | //接收到消息的回调方法 |
| | | this.websocket.socket.onmessage = (event) => { |