From e86cacf12a7a31261233a60ab2ea1f569cbb6e37 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 29 五月 2024 10:00:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
UI-Project/src/layout/MainErpView.vue | 59 +++-
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java | 3
UI-Project/src/views/Returns/returns.vue | 128 ++++++++-
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java | 1
hangzhoumesParent/JsonFile/PlcdownGlass.json | 362 +++++++++++++++++++++++++
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java | 78 +++-
hangzhoumesParent/JsonFile/PlcLoadGlass.json | 78 +++++
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/WebSocketConfig.java | 3
hangzhoumesParent/JsonFile/PlcCacheVerticalGlass.json | 57 ++++
hangzhoumesParent/JsonFile/PlcCacheGlass.json | 64 ++++
10 files changed, 774 insertions(+), 59 deletions(-)
diff --git a/UI-Project/src/layout/MainErpView.vue b/UI-Project/src/layout/MainErpView.vue
index 91453ae..3bd4a05 100644
--- a/UI-Project/src/layout/MainErpView.vue
+++ b/UI-Project/src/layout/MainErpView.vue
@@ -13,24 +13,49 @@
const userStore = useUserInfoStore()
const user = userStore.user.userName
-// store.createWebSocket();
-function quit() {
- userStore.$patch({
- user: null,
- })
- // router.push('/login')
- let token = window.localStorage.getItem('userInfo')
-console.log(token);
- request.get("/loadGlass/sys/user/login").then((res) => {
- if (res.code === 200) {
- ElMessage.success(res.msg);
- console.log(res.data);
- } else {
- ElMessage.warning(res.msg);
- // router.push("/login");
- }
- });
+let userInfoStr = window.localStorage.getItem('userInfo')
+console.log(userInfoStr);
+// const userInfoStr = localStorage.getItem('userInfo');
+// let userInfo = userInfoStr.user.token;
+let token = userInfo; // 鎻愬彇 token
+// 閫�鍑虹櫥褰曟柟娉�
+const quit = async () => {
+ try {
+ const response = await request.get('/loadGlass/sys/user/logout', {
+ token: token,
+ user: null,
+ })
+ if (response.code === 200) {
+ // 鐧诲嚭鎴愬姛锛屾竻闄ゆ湰鍦板瓨鍌ㄧ殑 userInfo
+ localStorage.removeItem('userInfo');
+ // 鍙互鍦ㄨ繖閲岄噸缃簲鐢ㄧ姸鎬侊紝濡傚鑸埌鐧诲綍椤电瓑
+ console.log('鐧诲嚭鎴愬姛');
+ } else {
+ // 澶勭悊閿欒鎯呭喌
+ console.error('鐧诲嚭澶辫触', response);
+ }
}
+catch (error) {
+ // 澶勭悊閿欒
+ console.error(error);
+ }
+}
+// store.createWebSocket();
+// function quit() {
+// userStore.$patch({
+// user: null,
+// })
+// // router.push('/login')
+// request.get("/loadGlass/sys/user/login").then((res) => {
+// if (res.code === 200) {
+// ElMessage.success(res.msg);
+// console.log(res.data);
+// } else {
+// ElMessage.warning(res.msg);
+// // router.push("/login");
+// }
+// });
+// }
//鎻愬彇鑿滃崟妯″潡鍒楄〃
let menuList = $ref([])
diff --git a/UI-Project/src/views/Returns/returns.vue b/UI-Project/src/views/Returns/returns.vue
index 86be983..e179221 100644
--- a/UI-Project/src/views/Returns/returns.vue
+++ b/UI-Project/src/views/Returns/returns.vue
@@ -25,6 +25,10 @@
const selectedValuea = ref('');
const selectedValueb = ref('');
const selectedValuec = ref('');
+const upstatus = ref(''); // 鍋囪杩欎釜鐢ㄤ簬鏄剧ず鑷姩/鎵嬪姩鐘舵��
+const cuttingMachine = ref(''); // 鍋囪杩欎釜鐢ㄤ簬瀛樺偍鍚庣杩斿洖鐨勭姸鎬佸�硷紙0鎴�1锛�
+const cuttingMachineStatusColor = ref(''); // 鐢ㄤ簬鍔ㄦ�佽缃甶鏍囩鐨勮儗鏅壊
+const inKageWord = ref(0); // 鐢ㄤ簬瀛樺偍瑕佷紶閫掔粰鎺ュ彛鐨刬nKageWord鍊�
const options = ref<any[]>([]); // 涓嬫媺閫夐」鍒楄〃
const selectOptions = ref<Array<any>>([]); // 涓嬫媺閫夐�夐」鏁扮粍
const selectOptionsa = ref<Array<any>>([]); // 涓嬫媺閫夐�夐」鏁扮粍
@@ -41,21 +45,27 @@
console.log('鎴愬姛鑾峰彇琛ㄦ牸鏁版嵁:', response.data);
tableData.splice(0, tableData.length, ...response.data);
window.localStorage.setItem('engineeringId', response.data[0].engineeringId)
- selectOptions.value = response.data.map(item => ({
- value: item.width, // 鍋囪杩欐槸浣犳兂瑕佷綔涓簐alue鐨勫睘鎬�
- label: item.width, // 鍋囪杩欐槸浣犳兂瑕佹樉绀虹殑label
+ // 鑾峰彇鍞竴鍊�
+ const uniqueWidths = new Set(response.data.map(item => item.width));
+ const uniqueHeights = new Set(response.data.map(item => item.height));
+ const uniqueFilmsIds = new Set(response.data.map(item => item.filmsId));
+ const uniqueThicknesses = new Set(response.data.map(item => item.thickness));
+
+ selectOptions.value = Array.from(uniqueWidths).map(width => ({
+ value: width, // 鍋囪杩欐槸浣犳兂瑕佷綔涓簐alue鐨勫睘鎬�
+ label: width, // 鍋囪杩欐槸浣犳兂瑕佹樉绀虹殑label
}));
- selectOptionsa.value = response.data.map(item => ({
- value: item.height,
- label: item.height,
+ selectOptionsa.value = Array.from(uniqueHeights).map(height => ({
+ value: height,
+ label: height,
}));
- selectOptionsb.value = response.data.map(item => ({
- value: item.filmsId,
- label: item.filmsId,
+ selectOptionsb.value = Array.from(uniqueFilmsIds).map(filmsId => ({
+ value: filmsId,
+ label: filmsId,
}));
- selectOptionsc.value = response.data.map(item => ({
- value: item.thickness,
- label: item.thickness,
+ selectOptionsc.value = Array.from(uniqueThicknesses).map(thickness => ({
+ value: thickness,
+ label: thickness,
}));
} else {
ElMessage.error(response.msg);
@@ -462,6 +472,89 @@
const confirmCuttingMachine = () => {
cuttingMachineStatus.value = 'green';
};
+
+
+
+const wsUrl = 'ws://10.153.19.150:88/api/loadGlass/api/talk/loadGlass';
+const ws = new WebSocket(wsUrl);
+ws.onopen = () => {
+ console.log('WebSocket杩炴帴宸叉墦寮�');
+};
+
+// 鐩戝惉WebSocket鐨勯敊璇簨浠�
+ws.onerror = (error) => {
+ console.error('WebSocket鍙戠敓閿欒:', error);
+};
+
+// 鐩戝惉WebSocket鐨勫叧闂簨浠�
+ws.onclose = (event) => {
+ if (event.wasClean) {
+ console.log('WebSocket杩炴帴宸叉甯稿叧闂�');
+ } else {
+ console.error('WebSocket杩炴帴寮傚父鍏抽棴');
+ }
+};
+
+// 鐩戝惉WebSocket鐨勬秷鎭簨浠�
+ws.onmessage = (event) => {
+ // 鍋囪鏈嶅姟鍣ㄥ彂閫佺殑鏄疛SON鏍煎紡鐨勫瓧绗︿覆
+ try {
+ const data = JSON.parse(event.data); // 瑙f瀽娑堟伅涓篔SON
+
+ // 鍋囪鏈嶅姟鍣ㄥ彂閫佺殑鏁版嵁缁撴瀯鏄� { InkageStatus: ["1"] }
+ if (data && Array.isArray(data.InkageStatus) && data.InkageStatus.length > 0) {
+ const status = data.InkageStatus[0];
+ cuttingMachine.value = status;
+ upstatus.value = status === '1' ? '涓婄墖鏈鸿仈鏈虹姸鎬侊細' : '涓婄墖鏈烘墜鍔ㄧ姸鎬侊細';
+ cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green';
+ inKageWord.value = status === '1' ? 0 : 1;
+ } else {
+ // 澶勭悊閿欒鎯呭喌鎴栨棤鏁堟暟鎹�
+ console.error('鎺ユ敹鍒扮殑鏁版嵁鏃犳晥', data);
+ }
+ } catch (error) {
+ console.error('瑙f瀽WebSocket娑堟伅鏃跺彂鐢熼敊璇�', error);
+ }
+};
+const confirmCutting = async () => {
+ try {
+ const response = await request.post('/loadGlass/LoadGlass/updateMesInkageLoad',
+ inKageWord.value
+ );
+ if (response.code == 200) {
+ const status = response.data.status;
+ upstatus.value = status === '1' ? '涓婄墖鏈鸿仈鏈虹姸鎬�' : '涓婄墖鏈烘墜鍔ㄧ姸鎬�';
+ cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green';
+ // 鏄剧ず鎴愬姛娑堟伅
+ ElMessage.success(response.message);
+ } else {
+ ElMessage.error(response.message || '璇锋眰澶辫触');
+ }
+ } catch (error) {
+ // 澶勭悊閿欒
+ console.error('璇锋眰鏃跺彂鐢熼敊璇�', error);
+ ElMessage.error('璇锋眰鏃跺彂鐢熼敊璇�');
+ }
+};
+// const confirmCutting = async () => {
+// try {
+// const response = await request.post('/loadGlass/LoadGlass/updateMesInkageLoad', {
+// inKageWord: inKageWord.value
+// })
+// if (response.code == 200) {
+// inKageWord == '1' ? '涓婄墖鏈鸿仈鏈虹姸鎬侊細' : '涓婄墖鏈烘墜鍔ㄧ姸鎬侊細';
+// inKageWord.value == '1' ? '#911005' : 'green';
+// ElMessage.success(response.message);
+// } else {
+// // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+// ElMessage.error(response.msg);
+// }
+// }
+// catch (error) {
+// // 澶勭悊閿欒
+// console.error(error);
+// }
+// }
</script>
<template>
@@ -469,12 +562,15 @@
<div id="dotClass">
<div>鎵撴爣鏈哄氨缁姸鎬侊細</div>
<i :style="{ marginTop: '2px', backgroundColor: markingMachineStatus, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i>
- <el-button @click="confirmMarkingMachine" style="margin-left: 30px;margin-top: -3px;">鎵嬪姩纭</el-button>
-
+ <el-button @click="confirmMarkingMachine" style="margin-left: 30px;margin-top: -3px;">纭</el-button>
<div style="margin-left: 70px;">鍒囧壊鏈哄氨缁姸鎬侊細</div>
<i :style="{ marginTop: '2px', backgroundColor: cuttingMachineStatus, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i>
- <el-button @click="confirmCuttingMachine" style="margin-left: 30px;margin-top: -3px;" >鎵嬪姩纭</el-button>
- </div>
+ <el-button @click="confirmCuttingMachine" style="margin-left: 30px;margin-top: -3px;" >纭</el-button>
+ <div style="margin-left: 70px;">{{ upstatus }} </div>
+ <i :style="{ marginTop: '2px', backgroundColor: cuttingMachineStatusColor, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i>
+ <el-button @click="confirmCutting" style="margin-left: 30px;margin-top: -3px;" >纭</el-button>
+
+ </div>
<el-button style="margin-top: 5px;margin-left: 15px;" id="searchButton" type="primary" @click="dialogFormVisible = true">閫夋嫨宸ョ▼</el-button>
<el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="primary" @click="handleBind">寮�濮嬩笂鐗�</el-button>
<el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="warning" @click="handleBinda">鏆傚仠</el-button>
diff --git a/hangzhoumesParent/JsonFile/PlcCacheGlass.json b/hangzhoumesParent/JsonFile/PlcCacheGlass.json
new file mode 100644
index 0000000..01969b7
--- /dev/null
+++ b/hangzhoumesParent/JsonFile/PlcCacheGlass.json
@@ -0,0 +1,64 @@
+{
+ "plcAddressBegin":"DB11.0",
+ "plcAddressLenght":"80",
+ "dataType":"word",
+ "parameteInfor":[
+ {
+ "codeId": "A06_request_word",
+ "addressIndex":"0",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A05_scanning_ID",
+ "addressIndex":"2",
+ "addressLenght":"30",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "Current_slot",
+ "addressIndex":"36",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "MES_confirmation_word",
+ "addressIndex":"38",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "A08_glass_status",
+ "addressIndex":"68",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "A10_glass_status",
+ "addressIndex":"70",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "A09_prohibit_film_production",
+ "addressIndex":"72",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ }
+ ,
+ {
+ "codeId": "A10_prohibit_film_production",
+ "addressIndex":"74",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ }
+ ]
+}
diff --git a/hangzhoumesParent/JsonFile/PlcCacheVerticalGlass.json b/hangzhoumesParent/JsonFile/PlcCacheVerticalGlass.json
new file mode 100644
index 0000000..5838dac
--- /dev/null
+++ b/hangzhoumesParent/JsonFile/PlcCacheVerticalGlass.json
@@ -0,0 +1,57 @@
+{
+ "plcAddressBegin":"DB.0",
+ "plcAddressLenght":"72",
+ "dataType":"word",
+ "parameteInfor":[
+ {
+ "codeId": "D01Request",
+ "addressIndex":"0",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "D01ID1",
+ "addressIndex":"2",
+ "addressLenght":"6",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "D04Request",
+ "addressIndex":"8",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "D04ID1",
+ "addressIndex":"10",
+ "addressLenght":"6",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "D02Go",
+ "addressIndex":"20",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "D05Go",
+ "addressIndex":"22",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ }
+ ,
+ {
+ "codeId": "DeviceStatus",
+ "addressIndex":"70",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ }
+ ]
+}
\ No newline at end of file
diff --git a/hangzhoumesParent/JsonFile/PlcLoadGlass.json b/hangzhoumesParent/JsonFile/PlcLoadGlass.json
new file mode 100644
index 0000000..9b0432b
--- /dev/null
+++ b/hangzhoumesParent/JsonFile/PlcLoadGlass.json
@@ -0,0 +1,78 @@
+{
+ "plcAddressBegin":"DB1.2000",
+ "plcAddressLenght":"100",
+ "dataType":"word",
+ "parameteInfor":[
+ {
+ "codeId": "loadRequest",
+ "addressIndex":"0",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "PlcStatus",
+ "addressIndex":"10",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "MesToPlc",
+ "addressIndex":"20",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "InkageStatus",
+ "addressIndex":"22",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "WorkId",
+ "addressIndex":"24",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "GlassWidth",
+ "addressIndex":"26",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "GlassHeight",
+ "addressIndex":"28",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ }
+ ,
+ {
+ "codeId": "MesToPlcStatus",
+ "addressIndex":"40",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "MesToPlcStatusId",
+ "addressIndex":"42",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ },
+ {
+ "codeId": "MesTaskStatus",
+ "addressIndex":"56",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":""
+ }
+ ]
+}
\ No newline at end of file
diff --git a/hangzhoumesParent/JsonFile/PlcdownGlass.json b/hangzhoumesParent/JsonFile/PlcdownGlass.json
new file mode 100644
index 0000000..c813b1d
--- /dev/null
+++ b/hangzhoumesParent/JsonFile/PlcdownGlass.json
@@ -0,0 +1,362 @@
+{
+ "plcAddressBegin": "DB100.0",
+ "plcAddressLenght": "142",
+ "dataType": "word",
+ "parameteInfor": [
+ {
+ "codeId": "RequestWord",
+ "addressIndex": "0",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G04ID",
+ "addressIndex": "2",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G06RobotTaskRequestWord",
+ "addressIndex": "4",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G06ID",
+ "addressIndex": "6",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G11RobotTaskRequestWord",
+ "addressIndex": "8",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G011ID",
+ "addressIndex": "10",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "12",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "14",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "16",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "18",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "MESSendingWord",
+ "addressIndex": "20",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "InputGrid",
+ "addressIndex": "22",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "OutputGrid",
+ "addressIndex": "24",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "OutputID",
+ "addressIndex": "26",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "FrontOrRearLowerSlice",
+ "addressIndex": "28",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "30",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G06RobotTaskReply",
+ "addressIndex": "32",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G06Rack",
+ "addressIndex": "34",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G11RobotTaskReply",
+ "addressIndex": "36",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G11Rack",
+ "addressIndex": "38",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "40",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "42",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "44",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "46",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "48",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "50",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "52",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "54",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "MESTaskState",
+ "addressIndex": "56",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "58",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "AlarmState",
+ "addressIndex": "60",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "Alarm1",
+ "addressIndex": "62",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "Alarm2",
+ "addressIndex": "64",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "Alarm3",
+ "addressIndex": "66",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "Alarm4",
+ "addressIndex": "68",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "neirong",
+ "addressIndex": "70",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "device",
+ "addressIndex": "72",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "74",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "76",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "InOut1",
+ "addressIndex": "78",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "InOut2",
+ "addressIndex": "80",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "InOut3",
+ "addressIndex": "82",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "InOut4",
+ "addressIndex": "84",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "InOut5",
+ "addressIndex": "86",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "InOut6",
+ "addressIndex": "88",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "InOut7",
+ "addressIndex": "90",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "92",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "94",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "96",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "98",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "spare",
+ "addressIndex": "100",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G04ActionState",
+ "addressIndex": "102",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G05ActionState",
+ "addressIndex": "104",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G06ActionState",
+ "addressIndex": "106",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G07ActionState",
+ "addressIndex": "108",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G08ActionState",
+ "addressIndex": "110",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G09ActionState",
+ "addressIndex": "112",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G10ActionState",
+ "addressIndex": "114",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G11ActionState",
+ "addressIndex": "116",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G12ActionState",
+ "addressIndex": "118",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G13ActionState",
+ "addressIndex": "120",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G04IDS",
+ "addressIndex": "122",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G05IDS",
+ "addressIndex": "124",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G06IDS",
+ "addressIndex": "126",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G07IDS",
+ "addressIndex": "128",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G08IDS",
+ "addressIndex": "130",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G09IDS",
+ "addressIndex": "132",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G10IDS",
+ "addressIndex": "134",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G11IDS",
+ "addressIndex": "136",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G12IDS",
+ "addressIndex": "138",
+ "addressLenght": "2"
+ },
+ {
+ "codeId": "G13ID",
+ "addressIndex": "140",
+ "addressLenght": "2"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/WebSocketConfig.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/WebSocketConfig.java
index 387f053..f5d16bf 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/WebSocketConfig.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/WebSocketConfig.java
@@ -4,6 +4,9 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+/**
+ * @author SNG-010
+ */
@Configuration
public class WebSocketConfig {
/**
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
index c05fbee..d0d6e14 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
@@ -47,33 +47,38 @@
@Scheduled(fixedDelay = 300)
public void plcLoadGlassTask() throws InterruptedException {
try {
- //鑾峰彇鏄惁鏈変笂鐗囪姹�
- String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue();
- String mesToPlc = plcParameterObject.getPlcParameter("MesToPlc").getValue();
- //鍒ゆ柇寮�濮嬩笂鐗囩殑宸ョ▼鍙�
- Engineering engineering = engineeringService.selectInitiate(1);
- if ("1".equals(loadRequest) && engineering != null) {
- log.info("寮�濮嬩笂鐗囦换鍔�");
- UpPattenUsage upPattenUsage = upWorkstationService.selectPriority(engineering);
- log.info("褰撴湁璇锋眰鏃舵煡璇㈠綋鍓嶄笂鐗囬『搴忕殑鐜荤拑淇℃伅{}", upPattenUsage);
- UpWorkstation upwork = upWorkstationService.selectWorkstation(upPattenUsage);
- log.info("绗﹀悎鐨勫昂瀵哥殑宸ヤ綅鐜荤拑锛歿}", upwork);
- if (upwork != null) {
- int workId = upwork.getWorkstationId();//宸ヤ綅id
- double width = upwork.getPatternWidth();//瀹藉害
- double height = upwork.getPatternHeight();//楂樺害
- S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("WorkId").getAddress(), workId);
- S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassWidth").getAddress(), (long) width);
- S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassHeight").getAddress(), (long) height);
- S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 1);
- //鏇存敼涓婄墖琛ㄧ姸鎬�
- upPattenUsageService.updateUpPattenUsageState(upPattenUsage, workId);
+ //鑾峰彇鑱旀満鐘舵��
+ String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue();
+ if("1".equals(inkageStatus)) {
+ //鑾峰彇鏄惁鏈変笂鐗囪姹�
+ String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue();
+ String mesToPlc = plcParameterObject.getPlcParameter("MesToPlc").getValue();
+ //鍒ゆ柇寮�濮嬩笂鐗囩殑宸ョ▼鍙�
+ Engineering engineering = engineeringService.selectInitiate(1);
+ if ("1".equals(loadRequest) && engineering != null) {
+ log.info("寮�濮嬩笂鐗囦换鍔�");
+ UpPattenUsage upPattenUsage = upWorkstationService.selectPriority(engineering);
+ log.info("褰撴湁璇锋眰鏃舵煡璇㈠綋鍓嶄笂鐗囬『搴忕殑鐜荤拑淇℃伅{}", upPattenUsage);
+ UpWorkstation upwork = upWorkstationService.selectWorkstation(upPattenUsage);
+ log.info("绗﹀悎鐨勫昂瀵哥殑宸ヤ綅鐜荤拑锛歿}", upwork);
+ if (upwork != null) {
+ int workId = upwork.getWorkstationId();//宸ヤ綅id
+ double width = upwork.getPatternWidth();//瀹藉害
+ double height = upwork.getPatternHeight();//楂樺害
+ S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("WorkId").getAddress(), workId);
+ S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassWidth").getAddress(), (long) width);
+ S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassHeight").getAddress(), (long) height);
+ S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 1);
+ //鏇存敼涓婄墖琛ㄧ姸鎬�
+ upPattenUsageService.updateUpPattenUsageState(upPattenUsage, workId);
+
+ }
}
- }
- if("1".equals(mesToPlc)&& "0".equals(loadRequest)){
- //璇锋眰瀛椾负闆舵椂锛屼换鍔″瓧娓呴浂
- S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0);
+ if ("1".equals(mesToPlc) && "0".equals(loadRequest)) {
+ //璇锋眰瀛椾负闆舵椂锛屼换鍔″瓧娓呴浂
+ S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0);
+ }
}
//鎵ц鍚庝紤鐪�300姣
//Thread.sleep(300);
@@ -135,6 +140,29 @@
}
}
}
+ @Scheduled(fixedDelay = 5000)
+ public void loadGlassStatus(){
+ JSONObject jsonObject = new JSONObject();
+ //姝e湪杩涜鐨勪换鍔�
+ //String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue();
+ String inkageStatus ="1";
+ jsonObject.append("InkageStatus", inkageStatus);
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ if (webserver != null) {
+ webserver.sendMessage(jsonObject.toString());
+ List<String> messages = webserver.getMessages();
+ if (!messages.isEmpty()) {
+ // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ webserver.clearMessages();
+ }
+ } else {
+ log.info("Home is closed");
+ }
+ }
+ }
+ }
public void overTask(String loadStatus, int state) {
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java
index f1907fe..257bc80 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java
@@ -53,6 +53,7 @@
public Result<String> updateMesInkageLoad(@RequestBody short inKageWord) {
String result = upWorkstationService.updateMesInkageLoad(inKageWord);
return Result.success(result);
+
}
}
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java
index a9d15bf..b7d08c2 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java
@@ -92,7 +92,8 @@
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
log.info("淇敼璁惧鑱斿姩璇锋眰涓簕}锛�0绂荤嚎锛�1鑱斿姩", inKageWord);
S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord);
- return "success";
+ //璇诲彇plc鐨勫��
+ return plcParameterObject.getPlcParameter("InkageStatus").getValue();
}
}
\ No newline at end of file
--
Gitblit v1.8.0