From 6877ca889fcc8e9963bb12fe27bff106bcc79ebd Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期二, 28 五月 2024 09:06:57 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
---
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java | 6
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java | 21
UI-Project/src/layout/MainErpView.vue | 14
hangzhoumesParent/moduleService/CacheGlassModule/pom.xml | 5
UI-Project/src/views/User/rolelist.vue | 476 ++------
UI-Project/src/views/Returns/returns.vue | 123 +
UI-Project/src/views/Identify/identify.vue | 4
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java | 7
hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java | 14
hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml | 4
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/WebSocketConfig.java | 18
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue | 207 --
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java | 15
UI-Project/src/views/UnLoadGlass/Landingindicationtwo.vue | 42
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java | 2
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java | 10
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/SmbTool.java | 71 +
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java | 3
UI-Project/src/views/User/permissions.vue | 601 ++++------
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java | 11
UI-Project/src/views/User/userlist.vue | 497 +++-----
hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterObject.java | 43
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java | 7
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml | 2
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java | 7
hangzhoumesParent/common/pom.xml | 20
UI-Project/src/views/UnLoadGlass/Landingindication.vue | 42
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java | 4
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java | 188 ++-
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/temperingglass/service/TemperingService.java | 8
UI-Project/src/utils/constants.js | 1
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java | 12
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java | 68 +
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/AppRunnerConfig.java | 2
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassTaskServiceImpl.java | 2
hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/S7control.java | 371 +++---
/dev/null | 162 --
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java | 2
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java | 59
UI-Project/src/router/index.js | 24
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java | 2
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java | 7
hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml | 1
UI-Project/src/utils/WebSocketService.js | 39
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java | 5
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/EdgStorageCageService.java | 3
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java | 9
47 files changed, 1,561 insertions(+), 1,680 deletions(-)
diff --git a/UI-Project/src/layout/MainErpView.vue b/UI-Project/src/layout/MainErpView.vue
index 65858e0..91453ae 100644
--- a/UI-Project/src/layout/MainErpView.vue
+++ b/UI-Project/src/layout/MainErpView.vue
@@ -18,7 +18,18 @@
userStore.$patch({
user: null,
})
- router.push('/login')
+ // 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");
+ }
+ });
}
//鎻愬彇鑿滃崟妯″潡鍒楄〃
@@ -27,6 +38,7 @@
request.get('/loadGlass/sys/menu/getMenuTree').then((res) => {
if (res.code == 200) {
menuList = deepClone(res.data)
+ console.log(response.data.token);
} else {
ElMessage.warning(res.msg)
router.push('/login')
diff --git a/UI-Project/src/router/index.js b/UI-Project/src/router/index.js
index 910f514..33ec397 100644
--- a/UI-Project/src/router/index.js
+++ b/UI-Project/src/router/index.js
@@ -210,7 +210,29 @@
}
]
},
-
+/*----------- 绯荤粺绠$悊 ----------------*/
+{
+ path: 'User',
+ name: 'user',
+ component: () => import('../views/User/user.vue'),
+ children:[
+ {
+ path: '/User/userlist',
+ name: 'userlist',
+ component: () => import('../views/User/userlist.vue')
+ },
+ {
+ path: '/User/rolelist',
+ name: 'rolelist',
+ component: () => import('../views/User/rolelist.vue')
+ },
+ {
+ path: '/User/permissions',
+ name: 'permissions',
+ component: () => import('../views/User/permissions.vue')
+ }
+ ]
+ },
/*----------- 绠$悊绯荤粺 ----------------*/
{
path: 'sys',
diff --git a/UI-Project/src/utils/WebSocketService.js b/UI-Project/src/utils/WebSocketService.js
new file mode 100644
index 0000000..432bd9c
--- /dev/null
+++ b/UI-Project/src/utils/WebSocketService.js
@@ -0,0 +1,39 @@
+// WebSocketService.js
+
+let socket = null;
+
+export const initializeWebSocket = (socketUrl, messageHandler) => {
+ if (typeof WebSocket === "undefined") {
+ console.log("Your browser does not support WebSocket");
+ return null;
+ }
+
+ const socket = new WebSocket(socketUrl);
+
+ socket.onopen = function () {
+ console.log("WebSocket is now open");
+ };
+
+ socket.onmessage = (msg) => {
+ if (!msg.data) {
+ return;
+ }
+
+ const obj = JSON.parse(msg.data);
+
+ // 璋冪敤娑堟伅澶勭悊鍑芥暟锛屽皢鏁版嵁浼犻�掔粰 Vue 缁勪欢
+ if (messageHandler) {
+ messageHandler(obj);
+ }
+ };
+
+ return socket;
+ };
+
+
+ export const closeWebSocket = (socket) => {
+ if (socket && socket.readyState === WebSocket.OPEN) {
+ socket.close();
+ console.log("WebSocket connection closed");
+ }
+};
\ No newline at end of file
diff --git a/UI-Project/src/utils/constants.js b/UI-Project/src/utils/constants.js
new file mode 100644
index 0000000..8a665eb
--- /dev/null
+++ b/UI-Project/src/utils/constants.js
@@ -0,0 +1 @@
+export const WebSocketHost = "localhost";
\ No newline at end of file
diff --git a/UI-Project/src/views/Identify/identify.vue b/UI-Project/src/views/Identify/identify.vue
index 84ef2b6..2d500f6 100644
--- a/UI-Project/src/views/Identify/identify.vue
+++ b/UI-Project/src/views/Identify/identify.vue
@@ -21,7 +21,7 @@
<!-- <div class="centered-text" >NG24030401B01</div> -->
<div class="centered-text">
<div>{{ rect.process_id }}</div>
- <div style="margin-top: 50px;margin-left: -85px;">{{ rect.width }}*{{ rect.height }}</div>
+ <div style="margin-top: 50px;margin-left: -85px;">{{ rect.widtha }}*{{ rect.heighta }}</div>
</div>
</div>
<!-- 鐐瑰嚮寮瑰嚭 -->
@@ -78,6 +78,8 @@
x_axis: (rect.x_axis*100) * 0.005, // 灏唜鍊奸櫎浠�3
y_axis: (rect.y_axis*100) * 0.005,
width: (rect.width*100) * 0.004 ,
+ widtha: rect.width ,
+ heighta: rect.height ,
height:( rect.height*100) * 0.004 ,
glass_state: rect.glass_state
}));
diff --git a/UI-Project/src/views/Returns/returns.vue b/UI-Project/src/views/Returns/returns.vue
index 1bf0404..eddab30 100644
--- a/UI-Project/src/views/Returns/returns.vue
+++ b/UI-Project/src/views/Returns/returns.vue
@@ -14,11 +14,19 @@
const adda = ref(false)
const flake = ref(false)
const flakea = ref(false)
-const state = reactive({updateKey: 0})
-// const value = ref('')
+// const patternHeight = ref('');
+// const patternWidth = ref('');
+// const filmsId = ref('');
+// const patternThickness = ref('');
+// const number = ref('');
+// patternHeight.value = '';
+ // patternWidth.value = '';
+ // filmsId.value = '';
+ // patternThickness.value = '';
+ // number.value = '';
import request from "@/utils/request"
const ida = ref(null);
-import { ref, onMounted } from "vue";
+import { ref, onMounted, onUnmounted } from "vue";
// import http from "@/http/index";
let ruleForm = ref({
@@ -58,28 +66,82 @@
}
} catch (error) {
// 澶勭悊璇锋眰澶辫触鐨勬儏鍐�
- ElMessage.error('鑾峰彇琛ㄦ牸鏁版嵁澶辫触锛岃閲嶈瘯');
+ // ElMessage.error('鑾峰彇琛ㄦ牸鏁版嵁澶辫触锛岃閲嶈瘯');
}
};
- request.get("/loadGlass/LoadGlass/list").then((res) => {
- if (res.code === 200) {
- console.log(res.data);
- tableDataa.value = res.data;
+onMounted(async () => {
+ await fetchTableData();
+
+ // 璁剧疆瀹氭椂鍣ㄦ潵瀹氭湡鍒锋柊鏁版嵁
+ const intervalId = setInterval(async () => {
+ await fetchTableData();
+ }, 1000); // 姣�1绉掑埛鏂颁竴娆�
+
+ // 缁勪欢鍗歌浇鏃舵竻闄ゅ畾鏃跺櫒
+ onUnmounted(() => {
+ clearInterval(intervalId);
+ });
+});
+onMounted(async () => {
+ await fetchTableDataa();
+
+ // 璁剧疆瀹氭椂鍣ㄦ潵瀹氭湡鍒锋柊鏁版嵁
+ const intervalId = setInterval(async () => {
+ await fetchTableDataa();
+ }, 1000); // 姣�1绉掑埛鏂颁竴娆�
+
+ // 缁勪欢鍗歌浇鏃舵竻闄ゅ畾鏃跺櫒
+ onUnmounted(() => {
+ clearInterval(intervalId);
+ });
+});
+ // request.get("/loadGlass/LoadGlass/list").then((res) => {
+ // if (res.code === 200) {
+ // console.log(res.data);
+ // tableDataa.value = res.data;
- if (tableDataa.value.length === 2) {
- if (tableDataa.value[0].patternWidth > 0) {
- flake.value = true;
- }
+ // if (tableDataa.value.length === 2) {
+ // if (tableDataa.value[0].patternWidth > 0) {
+ // flake.value = true;
+ // }
- if (tableDataa.value[1].patternWidth > 0) {
- flakea.value = true;
- }
- }
- } else {
- ElMessage.warning(res.msg);
- // router.push("/login");
- }
- });
+ // if (tableDataa.value[1].patternWidth > 0) {
+ // flakea.value = true;
+ // }
+ // }
+ // } else {
+ // ElMessage.warning(res.msg);
+ // // router.push("/login");
+ // }
+ // });
+ async function fetchTableDataa() {
+ try {
+ const res = await request.get("/loadGlass/LoadGlass/list");
+ if (res.code === 200) {
+ tableDataa.value = res.data;
+
+ // 鏍规嵁鏁版嵁鏇存柊 flake 鍜� flakea 鐨勫��
+ if (res.data.length >= 2) {
+ if (res.data[0].patternWidth > 0) {
+ flake.value = true;
+ } else {
+ flake.value = false;
+ }
+
+ if (res.data[1].patternWidth > 0) {
+ flakea.value = true;
+ } else {
+ flakea.value = false;
+ }
+ }
+ } else {
+ ElMessage.warning(res.msg);
+ }
+ } catch (error) {
+ console.error('鑾峰彇琛ㄦ牸鏁版嵁澶辫触', error);
+ // 鍙互鍦ㄨ繖閲屾坊鍔犻澶栫殑閿欒澶勭悊閫昏緫
+ }
+}
// request.get("/loadGlass/LoadGlass/list").then((res) => {
// window.localStorage.setItem('patternWidth', res.data.patternWidth)
// window.localStorage.setItem('workstationId', res.data.workstationId)
@@ -248,6 +310,11 @@
// window.location.reload()
add.value = false;
tableDataa.value = response.data;
+ // patternHeight = '';
+ // patternWidth.value = '';
+ // filmsId.value = '';
+ // patternThickness.value = '';
+ // number.value = '';
window.localStorage.setItem('workstationId', response.data.workstationId)
let workstationId = window.localStorage.getItem('workstationId')
if (workstationId == '1') {
@@ -351,6 +418,7 @@
ElMessage.success(response.message);
// window.location.reload()
dialogFormVisible.value = false;
+ selectedProjectNo.value = ''
} else {
// 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
ElMessage.error(response.msg);
@@ -374,7 +442,7 @@
// window.location.reload()
blind.value = false;
tableData.splice(0, tableData.length, ...response.data);
-
+ selectedProjectNoa.value = ''
} else {
// 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
ElMessage.error(response.msg);
@@ -402,7 +470,7 @@
blinda.value = false;
// tableData.value = response.data
// tableData.value = [];
- state.updateKey ++
+ tableData.splice([]);
} else {
// 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
ElMessage.error(response.msg);
@@ -435,7 +503,7 @@
ElMessage.success(response.message);
// window.location.reload()
blindb.value = false;
- state.updateKey ++
+ tableData.splice([]);
// 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
ElMessage.error(response.msg);
@@ -454,6 +522,7 @@
}
}
onMounted(fetchTableData);
+onMounted(fetchTableDataa);
function getStatusText(state: number) {
switch (state) {
case 0:
@@ -577,7 +646,7 @@
<el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="danger" @click="handleBindb">鍋滄浠诲姟</el-button>
<el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading">
- <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;" :key="state.updateKey">
+ <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
<el-table
height="150"
ref="table"
@@ -678,7 +747,7 @@
:header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"
>
<el-table-column prop="patternWidth" align="center" label="瀹�" min-width="80" />
- <el-table-column prop="patternHeight" align="center" label="闀�" min-width="80" />
+ <el-table-column prop="patternHeight" align="center" label="楂�" min-width="80" />
<el-table-column prop="filmsId" align="center" label="鑶滅郴" min-width="80" />
<el-table-column prop="number" align="center" label="鏁伴噺" min-width="80" />
<el-table-column fixed="right" label="鎿嶄綔" align="center" width="150">
@@ -698,7 +767,7 @@
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
<div>
- <el-form-item label="闀匡細" :required="true" style="width: 14vw">
+ <el-form-item label="楂橈細" :required="true" style="width: 14vw">
<el-input v-model="patternHeight" autocomplete="off" />
</el-form-item></div></div>
</el-col>
diff --git a/UI-Project/src/views/UnLoadGlass/Landingindication.vue b/UI-Project/src/views/UnLoadGlass/Landingindication.vue
index bf305e6..a55acb0 100644
--- a/UI-Project/src/views/UnLoadGlass/Landingindication.vue
+++ b/UI-Project/src/views/UnLoadGlass/Landingindication.vue
@@ -32,9 +32,12 @@
</template>
<script setup>
-import { ref, watchEffect } from 'vue';
+import { ref, watchEffect ,onMounted} from 'vue';
+
import Swal from 'sweetalert2'
import request from "@/utils/request";
+import { initializeWebSocket } from '@/utils/WebSocketService';
+ import { WebSocketHost } from '@/utils/constants';
const racks = ref([
{ x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } },
@@ -110,9 +113,40 @@
}
};
-fetchFlowCardId()
-// setTimeout(fetchFlowCardId(),1000);
-//setInterval(fetchFlowCardId, 2000)
+const socketUrl = `ws://${WebSocketHost}:8085/api/talk/unloadglass2`;
+// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
+const handleMessage = (data) => {
+
+ // 鏇存柊 tableData 鐨勬暟鎹�
+
+ data.glassinfo[0].forEach((itemData, index) => {
+ if (index < racks.value.length) {
+ const rack = racks.value[index];
+ const newItem = {
+ content: itemData.item.content,
+ fillColor: itemData.item.fillColor,
+ width: itemData.item.width === 0 ? "" : 10,
+ height: itemData.item.height === 0 ? "" : 90
+ };
+
+ if (index === 2 && itemData.item.width > 0) {
+ newItem.width = 100;
+ newItem.height = 20;
+ }
+
+ rack.item = newItem;
+
+ // console.log("鏄剧ず鍥�1",racks.value); // 鎵撳嵃鏇存柊鍚庣殑 racks 鍊�
+ }
+});
+};
+
+// 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
+
+onMounted(() => {
+ fetchFlowCardId(); // 鑾峰彇鏁版嵁
+ initializeWebSocket(socketUrl, handleMessage);
+});
const showCustomAlert = (content) => {
diff --git a/UI-Project/src/views/UnLoadGlass/Landingindicationtwo.vue b/UI-Project/src/views/UnLoadGlass/Landingindicationtwo.vue
index e5f562f..cf75a2e 100644
--- a/UI-Project/src/views/UnLoadGlass/Landingindicationtwo.vue
+++ b/UI-Project/src/views/UnLoadGlass/Landingindicationtwo.vue
@@ -32,10 +32,12 @@
</template>
<script setup>
-import { ref, watchEffect } from 'vue';
+import { ref, watchEffect ,onMounted} from 'vue';
+
import Swal from 'sweetalert2'
import request from "@/utils/request";
-
+import { initializeWebSocket } from '@/utils/WebSocketService';
+ import { WebSocketHost } from '@/utils/constants';
const racks = ref([
{ x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } },
@@ -110,7 +112,41 @@
}
};
-fetchFlowCardId()
+const socketUrl = `ws://${WebSocketHost}:8085/api/talk/unloadglass3`;
+// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
+const handleMessage = (data) => {
+
+ // 鏇存柊 tableData 鐨勬暟鎹�
+
+ data.glassinfo2[0].forEach((itemData, index) => {
+ if (index < racks.value.length) {
+ const rack = racks.value[index];
+ const newItem = {
+ content: itemData.item.content,
+ fillColor: itemData.item.fillColor,
+ width: itemData.item.width === 0 ? "" : 10,
+ height: itemData.item.height === 0 ? "" : 90
+ };
+
+ if (index === 2 && itemData.item.width > 0) {
+ newItem.width = 100;
+ newItem.height = 20;
+ }
+
+ rack.item = newItem;
+
+ //console.log("鏄剧ず鍥�2",racks.value); // 鎵撳嵃鏇存柊鍚庣殑 racks 鍊�
+ }
+});
+};
+
+// 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
+
+onMounted(() => {
+ fetchFlowCardId(); // 鑾峰彇鏁版嵁
+ initializeWebSocket(socketUrl, handleMessage);
+});
+
// const showCustomAlert = (content) => {
// var str="鏋跺彿 : 111\n" +
diff --git a/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue b/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
index d4a17c1..d53fe3c 100644
--- a/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
+++ b/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -1,6 +1,7 @@
<script setup>
import {Search} from "@element-plus/icons-vue";
-import {reactive, onMounted} from "vue";
+import {reactive, onMounted, onBeforeUnmount} from "vue";
+
import {useRouter} from "vue-router"
const router = useRouter()
@@ -9,75 +10,24 @@
import Landingindication from "./Landingindication.vue";
import Landingindicationtwo from "./Landingindicationtwo.vue";
import request from "@/utils/request";
+import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
+ import { WebSocketHost } from '@/utils/constants';
+
const dialogFormVisiblea = ref(false)
-
-
const dialogFormVisiblea2 = ref(false)
-
-
-
-
-
-let socket;
-
-
-const initWebSocket = (token) =>{ //鍒濆鍖杦e
-
-let viewname = "unloadglass";
-
-if (typeof WebSocket === "undefined") {
- console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
-} else {
- let socketUrl = "ws://" + "localhost"+":88" + "/api/talk/" + viewname;
- if (socket != null) {
- socket.close();
- socket = null;
- }
-
- // 寮�鍚竴涓獁ebsocket鏈嶅姟
- socket = new WebSocket(socketUrl);
-
- // 鎵撳紑浜嬩欢
- socket.onopen = function () {
- console.log("websocket宸叉墦寮�");
- };
-
-
-
-socket.onmessage = (msg) => {
-if (!msg.data) {
-return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
-}
-
- let obj = JSON.parse(msg.data);
-
-
- console.log('鏀跺埌娑堟伅锛�', obj.data);
-
- }
-
- }
- }
-
-
-
// 鏁版嵁
const loading = ref(false);
-
// 寮规鏄剧ず鎺у埗
-
const dialogFormVisible = ref(false);
-
// 琛ㄥ崟鏁版嵁
const workstationId = ref('');
const flowCardId = ref('');
const flowCardOptions = ref([]);
const tableData = reactive([]);
-
// 鏂规硶
const handleSelectionChange = () => {
// 澶勭悊琛ㄦ牸琛岄�夋嫨浜嬩欢
@@ -85,15 +35,10 @@
const handleBindRack = (row) => {
workstationId.value = row.workstationId; // 鍋囪rackNumber鏄灦鍙峰瓧娈电殑灞炴�у悕
-
// 鍙戣捣鎺ュ彛璇锋眰鑾峰彇娴佺▼鍗″彿
fetchFlowCardId();
-
-
dialogFormVisiblea.value = true; // 鎵撳紑缁戝畾鏋跺瓙瀵硅瘽妗�
};
-
-
//鑾峰彇娴佺▼鍗″彿
const fetchFlowCardId = async () => {
@@ -101,9 +46,12 @@
const response = await request.get('unLoadGlass/downWorkStation/getflowCardId');
console.log(response)
if (response.code === 200) {
- flowCardOptions.value = response.data.map(item => ({ flowcard_id: item.flow_card_Id }));
- console.log(flowCardOptions.value)
- } else {
+ flowCardOptions.value = response.data
+ .filter(item => item !== null)
+ .map(item => ({ flowcard_id: item.flow_card_Id }));
+ console.log(flowCardOptions.value);
+}
+ else {
ElMessage.error(response.msg);
}
} catch (error) {
@@ -141,19 +89,12 @@
// 鍋囪浣犵殑椤甸潰涓婃湁涓�涓悕涓� tableData 鐨� Vue 缁勪欢
// 浣犲彲浠ョ洿鎺ユ洿鏂� tableData 鐨勬暟鎹�
fetchTableData()
-
// 浣跨敤 $forceUpdate() 寮哄埗鏇存柊缁勪欢
-
+
};
-
-
const handleBindRack2 = (row) => {
workstationId.value = row.workstationId; // 鍋囪rackNumber鏄灦鍙峰瓧娈电殑灞炴�у悕
-
-
-
-
dialogFormVisiblea2.value = true; // 鎵撳紑缁戝畾鏋跺瓙瀵硅瘽妗�
};
//娓呴櫎鍐呭
@@ -185,9 +126,6 @@
};
-
-
-
// 鍙戦�佽幏鍙栬〃鏍兼暟鎹殑璇锋眰
const fetchTableData = async () => {
try {
@@ -210,89 +148,36 @@
};
+const socketUrl = `ws://${WebSocketHost}:8085/api/talk/unloadglass`;
+// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
+const handleMessage = (data) => {
+
+ // 鏇存柊 tableData 鐨勬暟鎹�
+
+ tableData.splice(0, tableData.length, ...data.params[0]);
+ // console.log("鏇存柊鍚庢暟鎹�", tableData);
+
+};
+
+// 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
+
+onMounted(() => {
+ fetchFlowCardId();
+ fetchTableData(); // 鑾峰彇鏁版嵁
+ initializeWebSocket(socketUrl, handleMessage);
+});
+
+onBeforeUnmount(() => {
+ console.log("鍏抽棴浜�")
+ closeWebSocket();
+});
+
+// beforeUnmount(() => {
+// closeWebSocket();
+// });
-// initWebSocket();
-onMounted(fetchTableData);
// setInterval(fetchTableData, 2000)
-
-const open = () => {
- ElMessageBox.confirm(
- '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
- .then(() => {
- ElMessage({
- type: 'success',
- message: '鍒犻櫎鎴愬姛锛�',
- })
- })
- .catch(() => {
- ElMessage({
- type: 'info',
- message: '鍒犻櫎澶辫触',
- })
- })
-}
-const getTableRow = (row,type) =>{
- switch (type) {
- case 'edit' :{
- //alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
- router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }})
- break
- }
- case 'delete':{
- alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
- break
- }
- }
-}
-
-const gridOptions = reactive({
- border: "full",//琛ㄦ牸鍔犺竟妗�
- keepSource: true,//淇濇寔婧愭暟鎹�
- align: 'center',//鏂囧瓧灞呬腑
- stripe:true,//鏂戦┈绾�
- rowConfig: {isCurrent: true, isHover: true,height: 50},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
- id: 'OrderList',
- showFooter: true,//鏄剧ず鑴�
- printConfig: {},
- importConfig: {},
- exportConfig: {},
- scrollY:{ enabled: true },//寮�鍚櫄鎷熸粴鍔�
- showOverflow:true,
- columnConfig: {
- resizable: true,
- useKey: true
- },
- filterConfig: { //绛涢�夐厤缃」
- remote: true
- },
- customConfig: {
- storage: true
- },
- editConfig: {
- trigger: 'click',
- mode: 'row',
- showStatus: true
- },
- data: [
- {
- 'id': '1',
- 'long': '5',
- 'wide': '1005',
- 'thick': '183.6',
- }
- ],
-})
-
-
-
</script>
@@ -311,7 +196,19 @@
<el-table-column prop="racksnumber" align="center" label="宸茶惤鏋舵暟閲�" min-width="120" />
<el-table-column prop="work_state" align="center" label="鐘舵��" min-width="120" />
<el-table-column prop="deviceId" align="center" label="璁惧鍙�" min-width="120" />
- <el-table-column prop="enableState" align="center" label="鍚敤鐘舵��" min-width="120" />
+
+
+
+ <el-table-column
+ align="center"
+ label="鍚敤鐘舵��"
+ min-width="80"
+ prop="enableState"
+ >
+ <template #default="scope">
+ <el-tag type="success" >{{ scope.row.enableState==1?"鍚敤":"鏈惎鐢�" }}</el-tag>
+ </template>
+ </el-table-column>
<el-table-column fixed="right" label="鎿嶄綔" align="center" width="200">
<template #default="scope">
<el-button size="mini" type="text" plain v-show="scope.row.enableState !== '宸插惎鐢�' " @click="handleBindRack(scope.row)">缁戝畾鏋跺瓙</el-button>
diff --git a/UI-Project/src/views/User/permissions.vue b/UI-Project/src/views/User/permissions.vue
index 15a996d..b5e4ae6 100644
--- a/UI-Project/src/views/User/permissions.vue
+++ b/UI-Project/src/views/User/permissions.vue
@@ -1,273 +1,259 @@
-<script lang="ts" setup>
+<script setup>
import {Search} from "@element-plus/icons-vue";
import {reactive} from "vue";
import {useRouter} from "vue-router"
-import { ref } from 'vue'
-
const router = useRouter()
-const value1 = ref(true)
const add = ref(false)
const adda = ref(false)
-const changer = ref(false)
+import request from "@/utils/request"
+import { ref, onMounted } from "vue";
+// import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
+// import LanguageMixin from './lang/LanguageMixin'
+const selectedProjectNoa = ref(''); // 褰撳墠閫変腑鐨勮鑹�
+// const options = ref<any[]>([]); // 涓嬫媺閫夐」鍒楄〃
+ const menuName = ref('');
+ const parentId = ref('');
+ const url = ref('');
+const tableData = ref([])
+const slot = ref('')
+ request.get("/loadGlass/sys/menu/nav").then((res) => {
+ if (res.code == 200) {
+ console.log(res.data);
+ tableData.value = res.data.tree
+ } else {
+ ElMessage.warning(res.msg)
-const tableData = [
- {
- id: '1',
- long: '1005',
- wide: '183.6',
- thick: '1991',
- time: '2024/4/1',
- type: '寰呰瘑鍒�',
- typea: '1',
- },
- {
- id: '2',
- long: '105',
- wide: '183',
- time: '2024/4/1',
- thick: '191',
- typea: '1',
- type: '寰呰瘑鍒�'
- },
- {
- id: '2',
- long: '105',
- wide: '183',
- time: '2024/4/1',
- thick: '191',
- typea: '1',
- type: '寰呰瘑鍒�'
- },
-]
-const open = () => {
- ElMessageBox.confirm(
- '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
- .then(() => {
- ElMessage({
- type: 'success',
- message: '鍒犻櫎鎴愬姛锛�',
- })
- })
- .catch(() => {
- ElMessage({
- type: 'info',
- message: '鍒犻櫎澶辫触',
- })
- })
-}
-const getTableRow = (row,type) =>{
- switch (type) {
- case 'edit' :{
- //alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
- router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }})
- break
- }
- case 'delete':{
- alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
- break
- }
- }
-}
-const dialogForm = () => {
- ElMessageBox.confirm(
- '鏄惁閲嶇疆瀵嗙爜?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
- .then(() => {
- // this.boxa = true
- // this.box = false
-
- })
-}
-const dialogForma = () => {
- ElMessageBox.confirm(
- '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
-}
-
-const options = [
- {
- value: 'Option1',
- label: 'admin',
- },
- {
- value: 'Option2',
- label: 'ueser2',
- },
- {
- value: 'Option3',
- label: 'ueser3',
- },
-]
-const optionsa = [
- {
- valuea: 'Option1',
- labela: '姝e父',
- },
- {
- valuea: 'Option2',
- labela: '绂佺敤',
- },
-]
-
-const data= reactive({
- tableList:[]//table鏁版嵁
-})
-
-const beforeChange = () => {
- return new Promise((resolve) => {
- setTimeout(() => {
- ElMessage.success("淇敼鎴愬姛锛�");
- return resolve(true);
- }, 1000);
- });
-};
-
-// //js灞傦紝瀹炴垬鐗堟湰,涓庡悗鍙版帴鍙d氦浜�
-// const gettableList = (id) = >{
-// xxx鎺ュ彛.({
-// id:id
-// }).then((res)=>{
-// //灏嗘暟鎹紶缁檈l-table缁戝畾鐨�:data=>data.tableList
-// data.tableList = res.data
-
-// })
-// }
+ }
+ });
+const titleSelectJsona = ref({
+ processType: [],
-// //鏈�鍚庡皢璇锋眰鍑芥暟鎸傝浇鍒皏ue瑙嗗浘涓�
-// onMounted(() => {
-// gettableList ()
-
-// })
-// const delete = () => {
-// ElMessageBox.confirm(
-// '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
-// '鎻愮ず',
-// {
-// confirmButtonText: '鏄�',
-// cancelButtonText: '鍙栨秷',
-// type: 'warning',
-// }
-// )
-// .then(() => {
-
-// })
-// }
-const gridOptions = reactive({
- border: "full",//琛ㄦ牸鍔犺竟妗�
- keepSource: true,//淇濇寔婧愭暟鎹�
- align: 'center',//鏂囧瓧灞呬腑
- stripe:true,//鏂戦┈绾�
- rowConfig: {isCurrent: true, isHover: true,height: 50},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
- id: 'OrderList',
- showFooter: true,//鏄剧ず鑴�
- printConfig: {},
- importConfig: {},
- exportConfig: {},
- scrollY:{ enabled: true },//寮�鍚櫄鎷熸粴鍔�
- showOverflow:true,
- columnConfig: {
- resizable: true,
- useKey: true
- },
- filterConfig: { //绛涢�夐厤缃」
- remote: true
- },
- customConfig: {
- storage: true
- },
- editConfig: {
- trigger: 'click',
- mode: 'row',
- showStatus: true
- },
- data: [
- {
- 'id': '1',
- 'long': '5',
- 'wide': '1005',
- 'thick': '183.6',
- 'time': '2024/4/1',
- }
- ]
})
+// const handleInputChangea = async (value: string) => {
+// if (value) {
+// await fetchOptionsa(value);
+// } else {
+// options.value = []; // 娓呯┖閫夐」鍒楄〃
+// }
+// };
+onMounted(() => {
+ // 鍦ㄧ粍浠舵寕杞藉悗璋冪敤 fetchOptions('') 鏉ュ姞杞藉垵濮嬫暟鎹紙濡傛灉闇�瑕侊級
+ fetchOptionsa('');
+});
+ // 瑙掕壊涓嬫媺閫�
+ const fetchOptionsa = async () => {
+ try {
+ // 鍙戦�佽姹傚埌鍚庣鎺ュ彛
+ const response = await request.post('/loadGlass/sys/role/queryRole',{
+ key: ''
+});
+ if (response.code == 200) {
+ titleSelectJsona.value.processTypea = response.data;
+ console.log(response.data);
+
+ } else {
+ ElMessage.warning(response.data);
+ }
+ } catch (error) {
+ console.error('Error fetching options:', error);
+ }
+};
+// 娣诲姞
+const getTableRow = async () => {
+ try {
+ const response = await request.post('/loadGlass/sys/menu/save', {
+ menuName: menuName.value,
+ parentId: parentId.value,
+ url: url.value,
+ });
+
+ if (response.code == 200) {
+ // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
+ ElMessage.success(response.message);
+ add.value = false;
+ // tableData.value = response.data;
+ } else {
+ // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ // 澶勭悊閿欒
+ console.error(error);
+ }
+};
+// 缂栬緫
+const getTableRowa = async () => {
+ try {
+ const response = await request.post('/loadGlass/sys/menu/updateMenu', {
+ menuName: menuName.value,
+ parentId: parentId.value,
+ url: url.value,
+ });
+
+ if (response.code == 200) {
+ // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
+ ElMessage.success(response.message);
+ add.value = false;
+ tableData.value = response.data;
+ } else {
+ // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ // 澶勭悊閿欒
+ console.error(error);
+ }
+};
+// 鍒犻櫎
+ const opena = async(row) => {
+ try {
+ const confirmResult = await ElMessageBox.confirm(
+ '鏄惁鍒犻櫎璇ョ敤鎴�?',
+ '鎻愮ず',
+ {
+ confirmButtonText: '鏄�',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ }
+ );
+ if (confirmResult === 'confirm') {
+ // 鐢ㄦ埛鐐瑰嚮浜嗏�滄槸鈥濓紝鐜板湪璋冪敤鍒犻櫎鎺ュ彛
+ const response = await request.post("/loadGlass/sys/menu/deleteMenu", {
+ menuId: row.id,
+ })
+ if (response.code === 200) {
+ ElMessage.success(response.message);
+ } else {
+ // 鍒犻櫎澶辫触锛屾偍鍙互澶勭悊閿欒鎴栨樉绀洪敊璇俊鎭粰鐢ㄦ埛
+ ElMessage.error(response.msg);
+ // alert('鍒犻櫎澶辫触锛�' + deleteResponse.message);
+ }
+ }
+ } catch (error) {
+ // 澶勭悊鍙兘鍑虹幇鐨勯敊璇紝姣斿 ElMessageBox 鎶涘嚭鐨勫紓甯哥瓑
+ console.error('鍙戠敓閿欒:', error);
+ }
+};
+// const gridOptions = reactive({
+// border: "full",//琛ㄦ牸鍔犺竟妗�
+// keepSource: true,//淇濇寔婧愭暟鎹�
+// align: 'center',//鏂囧瓧灞呬腑
+// stripe:true,//鏂戦┈绾�
+// rowConfig: {isCurrent: true, isHover: true,height: 50},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+// id: 'OrderList',
+// showFooter: true,//鏄剧ず鑴�
+// printConfig: {},
+// importConfig: {},
+// exportConfig: {},
+// scrollY:{ enabled: true },//寮�鍚櫄鎷熸粴鍔�
+// showOverflow:true,
+// columnConfig: {
+// resizable: true,
+// useKey: true
+// },
+// filterConfig: { //绛涢�夐厤缃」
+// remote: true
+// },
+// customConfig: {
+// storage: true
+// },
+// editConfig: {
+// trigger: 'click',
+// mode: 'row',
+// showStatus: true
+// },
+// data: [
+// {
+// 'id': '1',
+// 'long': '5',
+// 'wide': '1005',
+// 'thick': '183.6',
+// }
+// ]
+
+// })
</script>
<template>
- <div>
- <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">娣诲姞鐢ㄦ埛</el-button>
- <el-input
- clearable
- placeholder="璇疯緭鍏ョ敤鎴峰悕"
- size="mini"
- style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;"
- />
- <el-input
- clearable
- placeholder="璇疯緭鍏ラ偖绠�"
- size="mini"
- style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;"
- />
- <el-button type="primary" size="mini" @click="searchSubmit" style="margin-top: 10px;">鏌ヨ</el-button >
- <el-button type="primary" size="mini" @click="empty" style="margin-top: 10px;">娓呯┖</el-button>
- <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading">
- <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;">
- <el-table height="100%" ref="table"
- @selection-change="handleSelectionChange"
- :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
- <el-table-column prop="id" align="center" label="鐢ㄦ埛鍚�" min-width="80" />
- <el-table-column prop="long" align="center" label="閭" min-width="120" />
- <el-table-column prop="time" align="center" label="鍒涘缓鏃堕棿" min-width="120" />
- <el-table-column align="center" prop="changer" label="鏄惁绂佺敤" min-width="140" >
- <template #default="scope">
- <el-switch v-model="scope.row.changer" :before-change="beforeChange" />
- </template>
- </el-table-column>
-
- <el-table-column fixed="right" label="鎿嶄綔" align="center" width="200">
- <template #default>
- <el-button size="mini" type="text" plain @click="dialogForm">閲嶇疆瀵嗙爜</el-button>
- <el-button size="mini" type="text" plain @click="adda = true">缂栬緫</el-button>
- <el-button size="mini" type="text" plain @click="dialogForma">鍒犻櫎</el-button>
+ <div style="height: 700px;">
+ <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">娣诲姞鑿滃崟</el-button>
+ <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading">
+ <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 650px;">
+ <el-table
+ :data="tableData"
+ height="650"
+ @expand-change="handleExpandChange"
+ row-key="id"
+ :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"
+ >
+ <el-table-column type="expand">
+ <template #default="props">
+ <div v-if="props.row.children && props.row.children.length">
+ <el-table
+ :data="props.row.children"
+ border
+ style="width: 100%;margin-left: 20px;"
+ row-key="id"
+ :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"
+ >
+ <el-table-column prop="menuName" label="浜岀骇鑿滃崟鏍�" align="center" min-width="140" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"/>
+ <el-table-column prop="url" label="閾炬帴" align="center" min-width="160"/>
+ <el-table-column prop="id" align="center" label="鎺掑簭" min-width="140"/>
+ <el-table-column fixed="right" label="鎿嶄綔" align="center">
+ <template #default="scope">
+ <el-button size="mini" type="text" plain @click="adda = true">缂栬緫</el-button>
+ <el-button size="mini" type="text" plain @click="opena(scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
- </el-table>
+ </el-table>
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column prop="menuName" label="涓�绾ц彍鍗曟爮" align="center" min-width="120" />
+ <el-table-column prop="url" label="閾炬帴" align="center" min-width="200"/>
+ <el-table-column prop="id" align="center" label="鎺掑簭" min-width="180" />
+ <el-table-column fixed="right" label="鎿嶄綔" align="center" width="200">
+ <template #default="scope">
+ <el-button size="mini" type="text" plain @click="adda = true">缂栬緫</el-button>
+ <el-button size="mini" type="text" plain @click="opena(scope.row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <!-- <el-table height="240" ref="table"
+ @selection-change="handleSelectionChange"
+ :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
+ <el-table-column prop="menuName" align="center" label="鑿滃崟鏍�" min-width="180" />
+ <el-table-column align="center" label="閾炬帴" min-width="180">
+ <template #default="scope">
+ <el-tag v-for="role in scope.row.children">
+ {{role.url}}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="id" align="center" label="鎺掑簭" min-width="180" />
+ <el-table-column fixed="right" label="鎿嶄綔" align="center" width="200">
+ <template #default="scope">
+ <el-button size="mini" type="text" plain @click="adda = true">缂栬緫</el-button>
+ <el-button size="mini" type="text" plain @click="opena(scope.row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table> -->
</div>
</el-card>
-
</div>
-
- <el-dialog v-model="add" top="23vh" width="37%" title="娣诲姞鐢ㄦ埛" >
+ <el-dialog v-model="add" top="23vh" width="37%" title="娣诲姞鑿滃崟" >
<div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
<el-form size="mini" label-width="150px">
<el-form label-width="100px" label-position="right">
<el-row style="margin-top: -15px;margin-bottom: -2px;">
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="鐢ㄦ埛鍚嶏細" :required="true" style="width: 25vw">
- <el-input autocomplete="off" />
+ <div>
+ <el-form-item label="鑿滃崟鏍忥細" :required="true" style="width: 25vw">
+ <el-input v-model="menuName" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -275,20 +261,8 @@
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
<div>
- <el-form-item label="瑙掕壊锛�" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨瑙掕壊"
- style="width: 330px"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
+ <el-form-item label="閾炬帴锛�" :required="true" style="width: 25vw">
+ <el-input v-model="url" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -296,38 +270,8 @@
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
<div>
- <el-form-item label="閭锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="鏄惁绂佺敤" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨鏄惁绂佺敤"
- style="width: 330px"
- >
- <el-option
- v-for="item in optionsa"
- :key="item.valuea"
- :label="item.labela"
- :value="item.valuea"
- />
- </el-select>
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="瀵嗙爜锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
+ <el-form-item label="鎺掑簭锛�" :required="true" style="width: 25vw">
+ <el-input v-model="parentId" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -336,23 +280,23 @@
</div>
<template #footer>
<div id="dialog-footer">
- <el-button type="primary" @click="getTableRow('edit')">
+ <el-button type="primary" @click="getTableRow">
纭
</el-button>
<el-button @click="add = false">鍙栨秷</el-button>
</div>
</template>
- </el-dialog>
- <el-dialog v-model="adda" top="23vh" width="37%" title="淇敼鐢ㄦ埛" >
+ </el-dialog>
+ <el-dialog v-model="adda" top="23vh" width="37%" title="淇敼鑿滃崟" >
<div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
<el-form size="mini" label-width="150px">
<el-form label-width="100px" label-position="right">
<el-row style="margin-top: -15px;margin-bottom: -2px;">
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="鐢ㄦ埛鍚嶏細" :required="true" style="width: 25vw">
- <el-input autocomplete="off" />
+ <div>
+ <el-form-item label="鑿滃崟鏍忥細" :required="true" style="width: 25vw">
+ <el-input v-model="menuName" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -360,20 +304,8 @@
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
<div>
- <el-form-item label="瑙掕壊锛�" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨瑙掕壊"
- style="width: 330px"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
+ <el-form-item label="閾炬帴锛�" :required="true" style="width: 25vw">
+ <el-input v-model="url" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -381,38 +313,8 @@
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
<div>
- <el-form-item label="閭锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="鏄惁绂佺敤" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨鏄惁绂佺敤"
- style="width: 330px"
- >
- <el-option
- v-for="item in optionsa"
- :key="item.valuea"
- :label="item.labela"
- :value="item.valuea"
- />
- </el-select>
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="瀵嗙爜锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
+ <el-form-item label="鎺掑簭锛�" :required="true" style="width: 25vw">
+ <el-input v-model="parentId" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -421,13 +323,13 @@
</div>
<template #footer>
<div id="dialog-footer">
- <el-button type="primary" @click="getTableRow('edit')">
+ <el-button type="primary" @click="getTableRowa">
纭
</el-button>
<el-button @click="adda = false">鍙栨秷</el-button>
</div>
</template>
- </el-dialog>
+ </el-dialog>
</template>
<style scoped>
@@ -448,14 +350,7 @@
margin-left: 28%;
}
#awatch{
- height: 450px;
-}
-#main-body{
- margin-top: -20px;
- margin-left: 300px;
-}
-#main-bodya{
- margin-top: -10px;
- margin-left: 100px;
+ height: 460px;
+ /* margin-top: -60px; */
}
</style>
\ No newline at end of file
diff --git a/UI-Project/src/views/User/rolelist.vue b/UI-Project/src/views/User/rolelist.vue
index 15a996d..7594048 100644
--- a/UI-Project/src/views/User/rolelist.vue
+++ b/UI-Project/src/views/User/rolelist.vue
@@ -1,178 +1,131 @@
-<script lang="ts" setup>
+<script setup>
import {Search} from "@element-plus/icons-vue";
import {reactive} from "vue";
import {useRouter} from "vue-router"
-import { ref } from 'vue'
-
const router = useRouter()
-const value1 = ref(true)
const add = ref(false)
const adda = ref(false)
-const changer = ref(false)
+import request from "@/utils/request"
+import { ref, onMounted } from "vue";
+// import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
+// import LanguageMixin from './lang/LanguageMixin'
+const selectedProjectNoa = ref(''); // 褰撳墠閫変腑鐨勮鑹�
+// const options = ref<any[]>([]); // 涓嬫媺閫夐」鍒楄〃
+ const name = ref('');
-const tableData = [
- {
- id: '1',
- long: '1005',
- wide: '183.6',
- thick: '1991',
- time: '2024/4/1',
- type: '寰呰瘑鍒�',
- typea: '1',
- },
- {
- id: '2',
- long: '105',
- wide: '183',
- time: '2024/4/1',
- thick: '191',
- typea: '1',
- type: '寰呰瘑鍒�'
- },
- {
- id: '2',
- long: '105',
- wide: '183',
- time: '2024/4/1',
- thick: '191',
- typea: '1',
- type: '寰呰瘑鍒�'
- },
-]
-const open = () => {
- ElMessageBox.confirm(
- '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
- .then(() => {
- ElMessage({
- type: 'success',
- message: '鍒犻櫎鎴愬姛锛�',
- })
- })
- .catch(() => {
- ElMessage({
- type: 'info',
- message: '鍒犻櫎澶辫触',
- })
- })
-}
-const getTableRow = (row,type) =>{
- switch (type) {
- case 'edit' :{
- //alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
- router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }})
- break
- }
- case 'delete':{
- alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
- break
- }
- }
-}
-const dialogForm = () => {
- ElMessageBox.confirm(
- '鏄惁閲嶇疆瀵嗙爜?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
- .then(() => {
- // this.boxa = true
- // this.box = false
-
- })
-}
-const dialogForma = () => {
- ElMessageBox.confirm(
- '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
-}
+const tableData = ref([])
+const slot = ref('')
-const options = [
- {
- value: 'Option1',
- label: 'admin',
- },
- {
- value: 'Option2',
- label: 'ueser2',
- },
- {
- value: 'Option3',
- label: 'ueser3',
- },
-]
-const optionsa = [
- {
- valuea: 'Option1',
- labela: '姝e父',
- },
- {
- valuea: 'Option2',
- labela: '绂佺敤',
- },
-]
-
-const data= reactive({
- tableList:[]//table鏁版嵁
-})
-
-const beforeChange = () => {
- return new Promise((resolve) => {
- setTimeout(() => {
- ElMessage.success("淇敼鎴愬姛锛�");
- return resolve(true);
- }, 1000);
- });
-};
-
-// //js灞傦紝瀹炴垬鐗堟湰,涓庡悗鍙版帴鍙d氦浜�
-// const gettableList = (id) = >{
-// xxx鎺ュ彛.({
-// id:id
-// }).then((res)=>{
-// //灏嗘暟鎹紶缁檈l-table缁戝畾鐨�:data=>data.tableList
-// data.tableList = res.data
-
-// })
-// }
+const titleSelectJsona = ref({
+ processType: [],
-// //鏈�鍚庡皢璇锋眰鍑芥暟鎸傝浇鍒皏ue瑙嗗浘涓�
-// onMounted(() => {
-// gettableList ()
+})
+// const handleInputChangea = async (value: string) => {
+// if (value) {
+// await fetchOptionsa(value);
+// } else {
+// options.value = []; // 娓呯┖閫夐」鍒楄〃
+// }
+// };
+onMounted(() => {
+ // 鍦ㄧ粍浠舵寕杞藉悗璋冪敤 fetchOptions('') 鏉ュ姞杞藉垵濮嬫暟鎹紙濡傛灉闇�瑕侊級
+ fetchOptionsa('');
+});
+ // 瑙掕壊涓嬫媺閫�
+ const fetchOptionsa = async () => {
+ try {
+ // 鍙戦�佽姹傚埌鍚庣鎺ュ彛
+ const response = await request.post('/loadGlass/sys/role/queryRole',{
+ key: ''
+});
+ if (response.code == 200) {
+ tableData.value = response.data
+ // titleSelectJsona.value.processTypea = response.data.menuList;
+ console.log(response.data);
+
+ } else {
+ ElMessage.warning(response.data);
+ }
+ } catch (error) {
+ console.error('Error fetching options:', error);
+ }
+};
+// 娣诲姞
+const getTableRow = async () => {
+ try {
+ const response = await request.post('/loadGlass/sys/role/saveRole', {
+ name: name.value,
+ });
+
+ if (response.code == 200) {
+ // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
+ ElMessage.success(response.message);
+ add.value = false;
+ // tableData.value = response.data;
+ } else {
+ // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ // 澶勭悊閿欒
+ console.error(error);
+ }
+};
+// 缂栬緫
+const getTableRowa = async () => {
+ try {
+ const response = await request.post('/loadGlass/sys/role/updateRole', {
+ name: name.value,
-// })
-// const delete = () => {
-// ElMessageBox.confirm(
-// '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
-// '鎻愮ず',
-// {
-// confirmButtonText: '鏄�',
-// cancelButtonText: '鍙栨秷',
-// type: 'warning',
-// }
-// )
-// .then(() => {
-
-// })
-// }
+ });
+
+ if (response.code == 200) {
+ // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
+ ElMessage.success(response.message);
+ add.value = false;
+ tableData.value = response.data;
+ } else {
+ // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ // 澶勭悊閿欒
+ console.error(error);
+ }
+};
+// 鍒犻櫎
+ const opena = async(row) => {
+ try {
+ const confirmResult = await ElMessageBox.confirm(
+ '鏄惁鍒犻櫎璇ョ敤鎴�?',
+ '鎻愮ず',
+ {
+ confirmButtonText: '鏄�',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ }
+ );
+ if (confirmResult === 'confirm') {
+ // 鐢ㄦ埛鐐瑰嚮浜嗏�滄槸鈥濓紝鐜板湪璋冪敤鍒犻櫎鎺ュ彛
+ const response = await request.post("/loadGlass/sys/role/delete", {
+ ids: row.id,
+ })
+ if (response.code === 200) {
+ ElMessage.success(response.message);
+ } else {
+ // 鍒犻櫎澶辫触锛屾偍鍙互澶勭悊閿欒鎴栨樉绀洪敊璇俊鎭粰鐢ㄦ埛
+ ElMessage.error(response.msg);
+ // alert('鍒犻櫎澶辫触锛�' + deleteResponse.message);
+ }
+ }
+ } catch (error) {
+ // 澶勭悊鍙兘鍑虹幇鐨勯敊璇紝姣斿 ElMessageBox 鎶涘嚭鐨勫紓甯哥瓑
+ console.error('鍙戠敓閿欒:', error);
+ }
+};
+
const gridOptions = reactive({
border: "full",//琛ㄦ牸鍔犺竟妗�
keepSource: true,//淇濇寔婧愭暟鎹�
@@ -207,58 +160,32 @@
'long': '5',
'wide': '1005',
'thick': '183.6',
- 'time': '2024/4/1',
}
]
+
})
-
</script>
<template>
<div>
- <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">娣诲姞鐢ㄦ埛</el-button>
- <el-input
- clearable
- placeholder="璇疯緭鍏ョ敤鎴峰悕"
- size="mini"
- style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;"
- />
- <el-input
- clearable
- placeholder="璇疯緭鍏ラ偖绠�"
- size="mini"
- style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;"
- />
- <el-button type="primary" size="mini" @click="searchSubmit" style="margin-top: 10px;">鏌ヨ</el-button >
- <el-button type="primary" size="mini" @click="empty" style="margin-top: 10px;">娓呯┖</el-button>
- <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading">
- <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;">
- <el-table height="100%" ref="table"
+ <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">娣诲姞瑙掕壊</el-button>
+ <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading">
+ <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
+ <el-table height="240" ref="table"
@selection-change="handleSelectionChange"
:data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
- <el-table-column prop="id" align="center" label="鐢ㄦ埛鍚�" min-width="80" />
- <el-table-column prop="long" align="center" label="閭" min-width="120" />
- <el-table-column prop="time" align="center" label="鍒涘缓鏃堕棿" min-width="120" />
- <el-table-column align="center" prop="changer" label="鏄惁绂佺敤" min-width="140" >
- <template #default="scope">
- <el-switch v-model="scope.row.changer" :before-change="beforeChange" />
- </template>
- </el-table-column>
-
+ <el-table-column prop="name" align="center" label="瑙掕壊" min-width="180" />
<el-table-column fixed="right" label="鎿嶄綔" align="center" width="200">
- <template #default>
- <el-button size="mini" type="text" plain @click="dialogForm">閲嶇疆瀵嗙爜</el-button>
- <el-button size="mini" type="text" plain @click="adda = true">缂栬緫</el-button>
- <el-button size="mini" type="text" plain @click="dialogForma">鍒犻櫎</el-button>
+ <template #default="scope">
+ <el-button size="mini" type="text" plain @click="adda = true">缂栬緫</el-button>
+ <el-button size="mini" type="text" plain @click="opena(scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
-
</div>
-
- <el-dialog v-model="add" top="23vh" width="37%" title="娣诲姞鐢ㄦ埛" >
+ <el-dialog v-model="add" top="23vh" width="37%" title="娣诲姞瑙掕壊" >
<div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
<el-form size="mini" label-width="150px">
<el-form label-width="100px" label-position="right">
@@ -266,68 +193,8 @@
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
<div>
- <el-form-item label="鐢ㄦ埛鍚嶏細" :required="true" style="width: 25vw">
- <el-input autocomplete="off" />
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="瑙掕壊锛�" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨瑙掕壊"
- style="width: 330px"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="閭锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="鏄惁绂佺敤" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨鏄惁绂佺敤"
- style="width: 330px"
- >
- <el-option
- v-for="item in optionsa"
- :key="item.valuea"
- :label="item.labela"
- :value="item.valuea"
- />
- </el-select>
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="瀵嗙爜锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
+ <el-form-item label="瑙掕壊锛�" :required="true" style="width: 25vw">
+ <el-input v-model="name" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -336,83 +203,23 @@
</div>
<template #footer>
<div id="dialog-footer">
- <el-button type="primary" @click="getTableRow('edit')">
+ <el-button type="primary" @click="getTableRow">
纭
</el-button>
<el-button @click="add = false">鍙栨秷</el-button>
</div>
</template>
- </el-dialog>
- <el-dialog v-model="adda" top="23vh" width="37%" title="淇敼鐢ㄦ埛" >
+ </el-dialog>
+ <el-dialog v-model="adda" top="23vh" width="37%" title="淇敼瑙掕壊" >
<div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
<el-form size="mini" label-width="150px">
- <el-form label-width="100px" label-position="right">
+ <el-form label-width="100px" label-position="right">
<el-row style="margin-top: -15px;margin-bottom: -2px;">
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
<div>
- <el-form-item label="鐢ㄦ埛鍚嶏細" :required="true" style="width: 25vw">
- <el-input autocomplete="off" />
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="瑙掕壊锛�" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨瑙掕壊"
- style="width: 330px"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="閭锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="鏄惁绂佺敤" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨鏄惁绂佺敤"
- style="width: 330px"
- >
- <el-option
- v-for="item in optionsa"
- :key="item.valuea"
- :label="item.labela"
- :value="item.valuea"
- />
- </el-select>
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="瀵嗙爜锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
+ <el-form-item label="瑙掕壊锛�" :required="true" style="width: 25vw">
+ <el-input v-model="name" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -421,13 +228,13 @@
</div>
<template #footer>
<div id="dialog-footer">
- <el-button type="primary" @click="getTableRow('edit')">
+ <el-button type="primary" @click="getTableRowa">
纭
</el-button>
<el-button @click="adda = false">鍙栨秷</el-button>
</div>
</template>
- </el-dialog>
+ </el-dialog>
</template>
<style scoped>
@@ -448,14 +255,7 @@
margin-left: 28%;
}
#awatch{
- height: 450px;
-}
-#main-body{
- margin-top: -20px;
- margin-left: 300px;
-}
-#main-bodya{
- margin-top: -10px;
- margin-left: 100px;
+ height: 460px;
+ /* margin-top: -60px; */
}
</style>
\ No newline at end of file
diff --git a/UI-Project/src/views/User/userlist.vue b/UI-Project/src/views/User/userlist.vue
index 15a996d..bca1fae 100644
--- a/UI-Project/src/views/User/userlist.vue
+++ b/UI-Project/src/views/User/userlist.vue
@@ -1,178 +1,176 @@
-<script lang="ts" setup>
+<script setup>
import {Search} from "@element-plus/icons-vue";
import {reactive} from "vue";
import {useRouter} from "vue-router"
-import { ref } from 'vue'
-
const router = useRouter()
-const value1 = ref(true)
const add = ref(false)
const adda = ref(false)
-const changer = ref(false)
+import request from "@/utils/request"
+import { ref, onMounted } from "vue";
+// import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
+// import LanguageMixin from './lang/LanguageMixin'
+const selectedProjectNoa = ref(''); // 褰撳墠閫変腑鐨勮鑹�
+// const options = ref<any[]>([]); // 涓嬫媺閫夐」鍒楄〃
+ const userName = ref('');
+ const password = ref('');
-const tableData = [
- {
- id: '1',
- long: '1005',
- wide: '183.6',
- thick: '1991',
- time: '2024/4/1',
- type: '寰呰瘑鍒�',
- typea: '1',
- },
- {
- id: '2',
- long: '105',
- wide: '183',
- time: '2024/4/1',
- thick: '191',
- typea: '1',
- type: '寰呰瘑鍒�'
- },
- {
- id: '2',
- long: '105',
- wide: '183',
- time: '2024/4/1',
- thick: '191',
- typea: '1',
- type: '寰呰瘑鍒�'
- },
-]
-const open = () => {
- ElMessageBox.confirm(
- '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
- .then(() => {
- ElMessage({
- type: 'success',
- message: '鍒犻櫎鎴愬姛锛�',
- })
+const tableData = ref([])
+const slot = ref('')
+request.post("/loadGlass/sys/user/listByUserName",{
+ key: ''
+}).then((res) => {
+ if (res.code == 200) {
+ console.log(res.data);
+ tableData.value = res.data
+ } else {
+ ElMessage.warning(res.msg)
+
+ }
+ });
+// 閲嶇疆瀵嗙爜
+ const open = async(row) => {
+ try {
+ const confirmResult = await ElMessageBox.confirm(
+ '鏄惁閲嶇疆鐢ㄦ埛瀵嗙爜?',
+ '鎻愮ず',
+ {
+ confirmButtonText: '鏄�',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ }
+ );
+ if (confirmResult === 'confirm') {
+ // 鐢ㄦ埛鐐瑰嚮浜嗏�滄槸鈥濓紝鐜板湪璋冪敤鍒犻櫎鎺ュ彛
+ var url="/loadGlass/sys/user/resetPassword?userId="+row.id;
+ console.log(url);
+ const response = await request.post(url, {
+ esdId: row.esdId
})
- .catch(() => {
- ElMessage({
- type: 'info',
- message: '鍒犻櫎澶辫触',
- })
- })
-}
-const getTableRow = (row,type) =>{
- switch (type) {
- case 'edit' :{
- //alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
- router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }})
- break
- }
- case 'delete':{
- alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
- break
- }
- }
-}
-const dialogForm = () => {
- ElMessageBox.confirm(
- '鏄惁閲嶇疆瀵嗙爜?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
- .then(() => {
- // this.boxa = true
- // this.box = false
-
- })
-}
-const dialogForma = () => {
- ElMessageBox.confirm(
- '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
- '鎻愮ず',
- {
- confirmButtonText: '鏄�',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- )
-}
-
-const options = [
- {
- value: 'Option1',
- label: 'admin',
- },
- {
- value: 'Option2',
- label: 'ueser2',
- },
- {
- value: 'Option3',
- label: 'ueser3',
- },
-]
-const optionsa = [
- {
- valuea: 'Option1',
- labela: '姝e父',
- },
- {
- valuea: 'Option2',
- labela: '绂佺敤',
- },
-]
-
-const data= reactive({
- tableList:[]//table鏁版嵁
-})
-
-const beforeChange = () => {
- return new Promise((resolve) => {
- setTimeout(() => {
- ElMessage.success("淇敼鎴愬姛锛�");
- return resolve(true);
- }, 1000);
- });
-};
-
-// //js灞傦紝瀹炴垬鐗堟湰,涓庡悗鍙版帴鍙d氦浜�
-// const gettableList = (id) = >{
-// xxx鎺ュ彛.({
-// id:id
-// }).then((res)=>{
-// //灏嗘暟鎹紶缁檈l-table缁戝畾鐨�:data=>data.tableList
-// data.tableList = res.data
-
-// })
-// }
+ if (response.code === 200) {
+ ElMessage.success(response.message);
+ } else {
+ // 鍒犻櫎澶辫触锛屾偍鍙互澶勭悊閿欒鎴栨樉绀洪敊璇俊鎭粰鐢ㄦ埛
+ ElMessage.error(response.msg);
+ // alert('鍒犻櫎澶辫触锛�' + deleteResponse.message);
+ }
+ }
+ } catch (error) {
+ // 澶勭悊鍙兘鍑虹幇鐨勯敊璇紝姣斿 ElMessageBox 鎶涘嚭鐨勫紓甯哥瓑
+ console.error('鍙戠敓閿欒:', error);
+ }
+};
+const titleSelectJsona = ref({
+ processType: [],
-// //鏈�鍚庡皢璇锋眰鍑芥暟鎸傝浇鍒皏ue瑙嗗浘涓�
-// onMounted(() => {
-// gettableList ()
+})
+// const handleInputChangea = async (value: string) => {
+// if (value) {
+// await fetchOptionsa(value);
+// } else {
+// options.value = []; // 娓呯┖閫夐」鍒楄〃
+// }
+// };
+onMounted(() => {
+ // 鍦ㄧ粍浠舵寕杞藉悗璋冪敤 fetchOptions('') 鏉ュ姞杞藉垵濮嬫暟鎹紙濡傛灉闇�瑕侊級
+ fetchOptionsa('');
+});
+ // 瑙掕壊涓嬫媺閫�
+ const fetchOptionsa = async () => {
+ try {
+ // 鍙戦�佽姹傚埌鍚庣鎺ュ彛
+ const response = await request.post('/loadGlass/sys/role/queryRole',{
+ key: ''
+});
+ if (response.code == 200) {
+ titleSelectJsona.value.processTypea = response.data;
+ console.log(response.data);
+
+ } else {
+ ElMessage.warning(response.data);
+ }
+ } catch (error) {
+ console.error('Error fetching options:', error);
+ }
+};
+// 娣诲姞
+const getTableRow = async () => {
+ try {
+ const response = await request.post('/loadGlass/sys/user/saveUser', {
+ userName: userName.value,
+ password: password.value,
+ name: selectedProjectNoa.value,
+ });
+
+ if (response.code == 200) {
+ // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
+ ElMessage.success(response.message);
+ add.value = false;
+ // tableData.value = response.data;
+ } else {
+ // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ // 澶勭悊閿欒
+ console.error(error);
+ }
+};
+// 缂栬緫
+const getTableRowa = async () => {
+ try {
+ const response = await request.post('/loadGlass/sys/user/updateUser', {
+ userName: userName.value,
+ password: password.value,
+ name: selectedProjectNoa.value,
+ });
+
+ if (response.code == 200) {
+ // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
+ ElMessage.success(response.message);
+ add.value = false;
+ tableData.value = response.data;
+ } else {
+ // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ // 澶勭悊閿欒
+ console.error(error);
+ }
+};
+// 鍒犻櫎
+ const opena = async(row) => {
+ try {
+ const confirmResult = await ElMessageBox.confirm(
+ '鏄惁鍒犻櫎璇ョ敤鎴�?',
+ '鎻愮ず',
+ {
+ confirmButtonText: '鏄�',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ }
+ );
+ if (confirmResult === 'confirm') {
+ // 鐢ㄦ埛鐐瑰嚮浜嗏�滄槸鈥濓紝鐜板湪璋冪敤鍒犻櫎鎺ュ彛
+ const response = await request.post("/loadGlass/sys/user/deleteUser", {
+ ids: [row.id],
+ })
+ if (response.code === 200) {
+ ElMessage.success(response.message);
+ } else {
+ // 鍒犻櫎澶辫触锛屾偍鍙互澶勭悊閿欒鎴栨樉绀洪敊璇俊鎭粰鐢ㄦ埛
+ ElMessage.error(response.msg);
+ // alert('鍒犻櫎澶辫触锛�' + deleteResponse.message);
+ }
+ }
+ } catch (error) {
+ // 澶勭悊鍙兘鍑虹幇鐨勯敊璇紝姣斿 ElMessageBox 鎶涘嚭鐨勫紓甯哥瓑
+ console.error('鍙戠敓閿欒:', error);
+ }
+};
-// })
-// const delete = () => {
-// ElMessageBox.confirm(
-// '鏄惁鍒犻櫎璇ユ潯淇℃伅?',
-// '鎻愮ず',
-// {
-// confirmButtonText: '鏄�',
-// cancelButtonText: '鍙栨秷',
-// type: 'warning',
-// }
-// )
-// .then(() => {
-
-// })
-// }
const gridOptions = reactive({
border: "full",//琛ㄦ牸鍔犺竟妗�
keepSource: true,//淇濇寔婧愭暟鎹�
@@ -207,57 +205,39 @@
'long': '5',
'wide': '1005',
'thick': '183.6',
- 'time': '2024/4/1',
}
]
+
})
-
</script>
<template>
<div>
- <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">娣诲姞鐢ㄦ埛</el-button>
- <el-input
- clearable
- placeholder="璇疯緭鍏ョ敤鎴峰悕"
- size="mini"
- style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;"
- />
- <el-input
- clearable
- placeholder="璇疯緭鍏ラ偖绠�"
- size="mini"
- style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;"
- />
- <el-button type="primary" size="mini" @click="searchSubmit" style="margin-top: 10px;">鏌ヨ</el-button >
- <el-button type="primary" size="mini" @click="empty" style="margin-top: 10px;">娓呯┖</el-button>
- <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading">
- <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;">
- <el-table height="100%" ref="table"
+ <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">娣诲姞鐢ㄦ埛</el-button>
+ <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading">
+ <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
+ <el-table height="240" ref="table"
@selection-change="handleSelectionChange"
:data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
- <el-table-column prop="id" align="center" label="鐢ㄦ埛鍚�" min-width="80" />
- <el-table-column prop="long" align="center" label="閭" min-width="120" />
- <el-table-column prop="time" align="center" label="鍒涘缓鏃堕棿" min-width="120" />
- <el-table-column align="center" prop="changer" label="鏄惁绂佺敤" min-width="140" >
- <template #default="scope">
- <el-switch v-model="scope.row.changer" :before-change="beforeChange" />
- </template>
- </el-table-column>
-
+ <el-table-column prop="userName" align="center" label="鐢ㄦ埛鍚�" min-width="180" />
+ <el-table-column align="center" label="瑙掕壊" min-width="80">
+ <template #default="scope">
+ <el-tag v-for="role in scope.row.roleList">
+ {{role.name}}
+ </el-tag>
+ </template>
+ </el-table-column>
<el-table-column fixed="right" label="鎿嶄綔" align="center" width="200">
- <template #default>
- <el-button size="mini" type="text" plain @click="dialogForm">閲嶇疆瀵嗙爜</el-button>
- <el-button size="mini" type="text" plain @click="adda = true">缂栬緫</el-button>
- <el-button size="mini" type="text" plain @click="dialogForma">鍒犻櫎</el-button>
+ <template #default="scope">
+ <el-button size="mini" type="text" plain @click="open(scope.row)">閲嶇疆瀵嗙爜</el-button>
+ <el-button size="mini" type="text" plain @click="adda = true">缂栬緫</el-button>
+ <el-button size="mini" type="text" plain @click="opena(scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
-
</div>
-
<el-dialog v-model="add" top="23vh" width="37%" title="娣诲姞鐢ㄦ埛" >
<div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
<el-form size="mini" label-width="150px">
@@ -266,8 +246,8 @@
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
<div>
- <el-form-item label="鐢ㄦ埛鍚嶏細" :required="true" style="width: 25vw">
- <el-input autocomplete="off" />
+ <el-form-item label="鐢ㄦ埛鍚嶏細" :required="true" style="width: 25vw">
+ <el-input v-model="userName" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -277,46 +257,17 @@
<div>
<el-form-item label="瑙掕壊锛�" :required="true" style="width: 25vw;">
<el-select
- v-model="value"
+ v-model="selectedProjectNoa"
+ filterable
clearable
placeholder="璇烽�夋嫨瑙掕壊"
style="width: 330px"
>
<el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="閭锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="鏄惁绂佺敤" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨鏄惁绂佺敤"
- style="width: 330px"
- >
- <el-option
- v-for="item in optionsa"
- :key="item.valuea"
- :label="item.labela"
- :value="item.valuea"
+ v-for="item in titleSelectJsona['processTypea']"
+ :key="item.id"
+ :label="item.name"
+ :value="item.name"
/>
</el-select>
</el-form-item></div></div>
@@ -327,7 +278,11 @@
<div id="dt" style="font-size: 15px;">
<div>
<el-form-item label="瀵嗙爜锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
+ <el-input style="width: 340px;"
+ v-model="password"
+ autocomplete="off"
+ :prefix-icon="Lock"
+ show-password/>
</el-form-item></div></div>
</el-col>
</el-row>
@@ -336,13 +291,13 @@
</div>
<template #footer>
<div id="dialog-footer">
- <el-button type="primary" @click="getTableRow('edit')">
+ <el-button type="primary" @click="getTableRow">
纭
</el-button>
<el-button @click="add = false">鍙栨秷</el-button>
</div>
</template>
- </el-dialog>
+ </el-dialog>
<el-dialog v-model="adda" top="23vh" width="37%" title="淇敼鐢ㄦ埛" >
<div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
<el-form size="mini" label-width="150px">
@@ -351,8 +306,8 @@
<el-col :span="6">
<div id="dt" style="font-size: 15px;">
<div>
- <el-form-item label="鐢ㄦ埛鍚嶏細" :required="true" style="width: 25vw">
- <el-input autocomplete="off" />
+ <el-form-item label="鐢ㄦ埛鍚嶏細" :required="true" style="width: 25vw">
+ <el-input v-model="userName" autocomplete="off" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -362,46 +317,17 @@
<div>
<el-form-item label="瑙掕壊锛�" :required="true" style="width: 25vw;">
<el-select
- v-model="value"
+ v-model="selectedProjectNoa"
+ filterable
clearable
placeholder="璇烽�夋嫨瑙掕壊"
style="width: 330px"
>
<el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="閭锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
- </el-form-item></div></div>
- </el-col>
- </el-row>
- <el-row style="margin-top: 10px;">
- <el-col :span="6">
- <div id="dt" style="font-size: 15px;">
- <div>
- <el-form-item label="鏄惁绂佺敤" :required="true" style="width: 25vw;">
- <el-select
- v-model="value"
- clearable
- placeholder="璇烽�夋嫨鏄惁绂佺敤"
- style="width: 330px"
- >
- <el-option
- v-for="item in optionsa"
- :key="item.valuea"
- :label="item.labela"
- :value="item.valuea"
+ v-for="item in titleSelectJsona['processTypea']"
+ :key="item.id"
+ :label="item.name"
+ :value="item.name"
/>
</el-select>
</el-form-item></div></div>
@@ -412,7 +338,11 @@
<div id="dt" style="font-size: 15px;">
<div>
<el-form-item label="瀵嗙爜锛�" :required="true" style="width: 25vw;">
- <el-input autocomplete="off" />
+ <el-input style="width: 340px;"
+ v-model="password"
+ autocomplete="off"
+ :prefix-icon="Lock"
+ show-password/>
</el-form-item></div></div>
</el-col>
</el-row>
@@ -421,13 +351,13 @@
</div>
<template #footer>
<div id="dialog-footer">
- <el-button type="primary" @click="getTableRow('edit')">
+ <el-button type="primary" @click="getTableRowa">
纭
</el-button>
<el-button @click="adda = false">鍙栨秷</el-button>
</div>
</template>
- </el-dialog>
+ </el-dialog>
</template>
<style scoped>
@@ -448,14 +378,7 @@
margin-left: 28%;
}
#awatch{
- height: 450px;
-}
-#main-body{
- margin-top: -20px;
- margin-left: 300px;
-}
-#main-bodya{
- margin-top: -10px;
- margin-left: 100px;
+ height: 460px;
+ /* margin-top: -60px; */
}
</style>
\ No newline at end of file
diff --git a/hangzhoumesParent/common/pom.xml b/hangzhoumesParent/common/pom.xml
index 951b4ea..9da0bc0 100644
--- a/hangzhoumesParent/common/pom.xml
+++ b/hangzhoumesParent/common/pom.xml
@@ -191,16 +191,26 @@
<version>1.2.33</version>
</dependency>
-<!-- <dependency>-->
-<!-- <groupId>com.github.yulichang</groupId>-->
-<!-- <artifactId>mybatis-plus-join</artifactId>-->
-<!-- <version>1.2.4</version>-->
-<!-- </dependency>-->
+ <!-- <dependency>-->
+ <!-- <groupId>com.github.yulichang</groupId>-->
+ <!-- <artifactId>mybatis-plus-join</artifactId>-->
+ <!-- <version>1.2.4</version>-->
+ <!-- </dependency>-->
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId>
<version>1.4.12</version>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-websocket</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-thymeleaf</artifactId>
+ </dependency>
</dependencies>
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
new file mode 100644
index 0000000..387f053
--- /dev/null
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/WebSocketConfig.java
@@ -0,0 +1,18 @@
+package com.mes.common.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+
+@Configuration
+public class WebSocketConfig {
+ /**
+ * bean娉ㄥ唽锛氫細鑷姩鎵弿甯︽湁@ServerEndpoint娉ㄨВ澹版槑鐨刉ebsocket Endpoint(绔偣)锛屾敞鍐屾垚涓篧ebsocket bean銆�
+ * 瑕佹敞鎰忥紝濡傛灉椤圭洰浣跨敤澶栫疆鐨剆ervlet瀹瑰櫒锛岃�屼笉鏄洿鎺ヤ娇鐢╯pringboot鍐呯疆瀹瑰櫒鐨勮瘽锛屽氨涓嶈娉ㄥ叆ServerEndpointExporter锛屽洜涓哄畠灏嗙敱瀹瑰櫒鑷繁鎻愪緵鍜岀鐞嗐��
+ */
+ @Bean
+ public ServerEndpointExporter serverEndpointExporter() {
+ return new ServerEndpointExporter();
+ }
+
+}
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterObject.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterObject.java
index b32c593..dae4ca1 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterObject.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterObject.java
@@ -1,5 +1,8 @@
package com.mes.device;
+import com.github.xingshuangs.iot.utils.IntegerUtil;
+import com.github.xingshuangs.iot.utils.ShortUtil;
+
import java.lang.reflect.Array;
import java.nio.charset.StandardCharsets;
import java.util.*;
@@ -156,15 +159,14 @@
Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]);
}
if (plcParameterInfo.getAddressLength() == 2) {
- plcParameterInfo.setValue(String.valueOf(byte2short(valueList)));
+ plcParameterInfo.setValue(String.valueOf(ShortUtil.toUInt16(valueList)));
} else if (plcParameterInfo.getAddressLength() == 4) {
- plcParameterInfo.setValue(String.valueOf(byte2int(valueList)));
+ plcParameterInfo.setValue(String.valueOf(IntegerUtil.toUInt32(valueList)));
}
else if (plcParameterInfo.getAddressLength() >10) {
plcParameterInfo.setValue((byteToHexString(valueList)));
} else {
- String valuestr = new String(valueList);
- plcParameterInfo.setValue(valuestr);
+ plcParameterInfo.setValue((byteToHexString(valueList)));
}
}
}
@@ -194,6 +196,25 @@
}
}*/
}
+ /**
+ * 鎶婂啓鍏ュ�艰浆鍖栦负byte[]
+ * @param param 鍙傛暟瀹炰緥
+ * @param data 鍐欏叆鍊肩殑瀛楃绫诲瀷
+ */
+ public byte[] setValueToBytes(PlcParameterInfo param, String data) {
+ if (param.getAddressLength() == 2) {
+ return ShortUtil.toByteArray(Integer.parseInt(data));
+
+ } else if (param.getAddressLength() == 4) {
+
+ return IntegerUtil.toByteArray(Long.parseLong(data));
+ }
+ else if (param.getAddressLength() >10) {
+ return data.getBytes();
+ } else {
+ return data.getBytes();
+ }
+ }
/**
* short绫诲瀷杞琤yte[]
@@ -203,7 +224,7 @@
public static byte[] short2byte(short s) {
byte[] b = new byte[2];
for (int i = 0; i < 2; i++) {
- int offset = 16 - (i + 1) * 8; //鍥犱负byte鍗�4涓瓧鑺傦紝鎵�浠ヨ璁$畻鍋忕Щ閲�
+ int offset = 16 - (i + 1) * 8; //璁$畻鍋忕Щ閲�
b[i] = (byte) ((s >> offset) & 0xff); //鎶�16浣嶅垎涓�2涓�8浣嶈繘琛屽垎鍒瓨鍌�
}
return b;
@@ -228,14 +249,22 @@
*
* @param b byte[]绫诲瀷鍊�
*/
- public static short byte2int(byte[] b) {
- short l = 0;
+ public static int byte2int(byte[] b) {
+ int l = 0;
for (int i = 0; i < 4; i++) {
l <<= 8; //<<=鍜屾垜浠殑 +=鏄竴鏍风殑锛屾剰鎬濆氨鏄� l = l << 8
l |= (b[3-i] & 0xff); //鍜屼笂闈篃鏄竴鏍风殑 l = l | (b[i]&0xff)
}
return l;
}
+ public static byte[] int2byte(int s){
+ byte[] b = new byte[2];
+ for(int i = 0; i < 4; i++){
+ int offset = 16 - (i+1)*8; //鍥犱负byte鍗�4涓瓧鑺傦紝鎵�浠ヨ璁$畻鍋忕Щ閲�
+ b[i] = (byte)((s >> offset)&0xff); //鎶�32浣嶅垎涓�4涓�8浣嶈繘琛屽垎鍒瓨鍌�
+ }
+ return b;
+ }
public static String byteToHexString(byte[] bytes) {
String str = new String(bytes, StandardCharsets.UTF_8).trim();
return str;
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
index f1fa50d..f69a142 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
@@ -2,13 +2,14 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
-import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import java.io.Serializable;
+
/**
* <p>
- *
+ *
* </p>
*
* @author wu
@@ -57,6 +58,16 @@
private String filmsid;
/**
+ * 灞傛暟
+ */
+ private int layer;
+
+ /**
+ * 鎬诲眰鏁�
+ */
+ private int totalLayer;
+
+ /**
* 纾ㄥ墠瀹�
*/
private Double edgWidth;
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java
index 622197a..19cb029 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java
@@ -43,6 +43,16 @@
private String glassType;
/**
+ * 灞傛暟
+ */
+ private int layer;
+
+ /**
+ * 鎬诲眰鏁�
+ */
+ private int totalLayer;
+
+ /**
* 灏忕墖瀹斤紙鍔犵(閲忥級
*/
private Double pWidth;
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
index 885be4c..be26553 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
@@ -1,6 +1,7 @@
package com.mes.glassinfo.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
+import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.query.MPJQueryWrapper;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.entity.OptimizeGlassinfo;
@@ -11,7 +12,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import com.github.yulichang.base.MPJBaseServiceImpl;
import java.util.ArrayList;
import java.util.List;
@@ -35,7 +35,7 @@
List<OptimizeGlassinfo> optimizeGlassinfos=null;
if (engineeringId != null) {
optimizeGlassinfos = optimizeProjectMapper.selectJoinList(OptimizeGlassinfo.class, new MPJQueryWrapper<OptimizeProject>()
- .select("b.process_id,t.type,b.width,b.height,t.glass_thickness,t.glass_type,b.p_width,b.p_height,b.stock_id,b.heat_layout_id,b.heat_layout_sort,b.x_axis,b.y_axis,b.project_no,b.glass_id")
+ .select("b.process_id,t.type,b.width,b.height,t.glass_thickness,t.glass_type,b.p_width,b.p_height,b.layer, b.total_layer, b.stock_id,b.heat_layout_id,b.heat_layout_sort,b.x_axis,b.y_axis,b.project_no,b.glass_id")
.leftJoin("optimize_detail b on t.project_no=b.project_no")
//.eq("t.state",100)
.eq("t.project_no", engineeringId));
@@ -56,6 +56,8 @@
glassInfo.setWidth(map.getWidth());
glassInfo.setHeight(map.getHeight());
glassInfo.setEdgWidth(map.getPWidth());
+ glassInfo.setLayer(map.getLayer());
+ glassInfo.setTotalLayer(map.getTotalLayer());
glassInfo.setEdgHeight(map.getPHeight());
glassInfo.setThickness(map.getGlassThickness());
glassInfo.setPatternSequence(map.getStockId());//
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/S7control.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/S7control.java
index 0b206d5..32812b3 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/S7control.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/S7control.java
@@ -3,9 +3,7 @@
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite;
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
-import com.google.common.primitives.Bytes;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@@ -22,17 +20,32 @@
/**
* 鍏抽棴瑗块棬瀛恠7閫氳杩炴帴
*/
- public void CloseS7client() {
- if (s7PLC == null) {
+ public void closeS7client() {
+ if (s7PLC != null) {
s7PLC.close();
}
- s7PLC.checkConnected();
}
+
+ /**
+ * 閲嶅惎瑗块棬瀛恠7閫氳杩炴帴
+ */
+ public boolean reStartS7client() {
+ if (s7PLC != null) {
+ try {
+ s7PLC.hotRestart();
+ return true;
+ } catch (Exception ex) {
+ return false;
+ }
+ }
+ return false;
+ }
+
/**
* s7閫氳杩炴帴鐘舵��
*/
- public boolean CheckConnected() {
+ public boolean checkConnected() {
return s7PLC.checkConnected();
}
@@ -42,11 +55,24 @@
* @param address 鍦板潃
* @param data word鐨勫��
*/
- public void WriteWord(String address, short data) {
+ public boolean writeWord(String address, int data) {
if (s7PLC == null) {
- return;
+ return false;
}
- s7PLC.writeInt16(address, data);
+ boolean result = false;
+ int tryCount = 2;
+ do {
+ try {
+ s7PLC.writeUInt16(address, data);
+ result = true;
+ } catch (Exception ex) {
+ reStartS7client();
+ } finally {
+ tryCount -= 1;
+ }
+ }
+ while (!result && tryCount > 0);
+ return result;
}
/**
@@ -55,17 +81,31 @@
* @param address 鍦板潃
* @param datas word鐨勫��
*/
- public void WriteWord(String address, List<Short> datas) {
+ public boolean writeWord(String address, List<Integer> datas) {
if (s7PLC == null) {
- return;
+ return false;
}
+ boolean result = false;
+ int tryCount = 2;
// s7PLC.write(address, data);
- List<String> addresslist = GetAddressList(address, datas.size(), 16);
+ List<String> addresslist = getAddressList(address, datas.size(), 16);
MultiAddressWrite addressWrite = new MultiAddressWrite();
for (int i = 0; i < datas.size(); i++) {
- addressWrite.addInt16(addresslist.get(i), datas.get(i));
+ addressWrite.addUInt16(addresslist.get(i), datas.get(i));
}
- s7PLC.writeMultiData(addressWrite);
+ do {
+ try {
+ s7PLC.writeMultiData(addressWrite);
+ result = true;
+ } catch (Exception ex) {
+ reStartS7client();
+ } finally {
+ tryCount -= 1;
+ }
+ }
+ while (!result && tryCount > 0);
+ return result;
+
}
/**
@@ -82,11 +122,24 @@
* @param address 鍦板潃
* @param data Bit鐨勫��
*/
- public void WriteBit(String address, Boolean data) {
+ public boolean writeBit(String address, Boolean data) {
if (s7PLC == null) {
- return;
+ return false;
}
- s7PLC.writeBoolean(address, data);
+ boolean result = false;
+ int tryCount = 2;
+ do {
+ try {
+ s7PLC.writeBoolean(address, data);
+ result = true;
+ } catch (Exception ex) {
+ reStartS7client();
+ } finally {
+ tryCount -= 1;
+ }
+ }
+ while (!result && tryCount > 0);
+ return result;
}
/**
@@ -95,17 +148,30 @@
* @param address 鍦板潃
* @param datas bit鐨勫��
*/
- public void WriteBit(List<String> address, List<Boolean> datas) {
+ public boolean writeBit(List<String> address, List<Boolean> datas) {
if (s7PLC == null) {
- return;
+ return false;
}
- // s7PLC.write(address, data);
MultiAddressWrite addressWrite = new MultiAddressWrite();
for (int i = 0; i < address.size(); i++) {
addressWrite.addBoolean(address.get(i), datas.get(i));
}
- s7PLC.writeMultiData(addressWrite);
+ boolean result = false;
+ int tryCount = 2;
+ do {
+ try {
+ s7PLC.writeMultiData(addressWrite);
+ result = true;
+ } catch (Exception ex) {
+ reStartS7client();
+ } finally {
+ tryCount -= 1;
+ }
+ }
+ while (!result && tryCount > 0);
+ return result;
+
}
/**
@@ -114,17 +180,31 @@
* @param address 鍦板潃
* @param datas word鐨勫��
*/
- public void WriteBit(String address, List<Boolean> datas) {
+ public boolean writeBit(String address, List<Boolean> datas) {
if (s7PLC == null) {
- return;
+ return false;
}
+
// s7PLC.write(address, data);
- List<String> addresslist = GetAddressList(address, datas.size(), 1);
+ List<String> addresslist = getAddressList(address, datas.size(), 1);
MultiAddressWrite addressWrite = new MultiAddressWrite();
for (int i = 0; i < datas.size(); i++) {
addressWrite.addBoolean(addresslist.get(i), datas.get(i));
}
- s7PLC.writeMultiData(addressWrite);
+ boolean result = false;
+ int tryCount = 2;
+ do {
+ try {
+ s7PLC.writeMultiData(addressWrite);
+ result = true;
+ } catch (Exception ex) {
+ reStartS7client();
+ } finally {
+ tryCount -= 1;
+ }
+ }
+ while (!result && tryCount > 0);
+ return result;
}
/**
@@ -133,12 +213,24 @@
* @param address 鍦板潃
* @param datas byte鐨勫��
*/
- public void WriteByte(String address, byte[] datas) {
+ public boolean writeByte(String address, byte[] datas) {
if (s7PLC == null) {
- return;
+ return false;
}
- // s7PLC.write(address, data);
- s7PLC.writeByte(address, datas);
+ boolean result = false;
+ int tryCount = 2;
+ do {
+ try {
+ s7PLC.writeByte(address, datas);
+ result = true;
+ } catch (Exception ex) {
+ reStartS7client();
+ } finally {
+ tryCount -= 1;
+ }
+ }
+ while (!result && tryCount > 0);
+ return result;
}
/**
@@ -147,31 +239,22 @@
* @param address 鍦板潃
* @return 缁撴灉
*/
- public List<Short> ReadWord(List<String> address) {
+ public List<Integer> readWord(List<String> address) {
if (s7PLC == null) {
return null;
}
-
+ List<Integer> result = null;
try {
- return s7PLC.readInt16(address);
+ result = s7PLC.readUInt16(address);
} catch (Exception e) {
+ s7PLC.hotRestart();
System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
- return null;
+
+ } finally {
+ return result;
}
}
-
- private int getIndexFromAddress(String address) {
-
- // 鍙互瑙f瀽鍑哄湴鍧�涓殑鏁板瓧閮ㄥ垎锛屽苟杞崲涓烘暣鏁�
- return 0;
- }
-
- private String getAddressFromIndex(int index) {
-
- // 鏁存暟杞崲涓哄湴鍧�鏍煎紡鐨勫瓧绗︿覆
- return "";
- }
/**
* 鎸夋寚瀹氱殑鍦板潃 璇诲彇word缁撴灉闆�
@@ -180,18 +263,19 @@
* @param count 杩炵画璇诲灏戜釜word
* @return 缁撴灉
*/
- public List<Short> ReadWord(String address, int count) {
+ public List<Integer> readWord(String address, int count) {
if (s7PLC == null) {
return null;
}
-
- List<String> addresslist = GetAddressList(address, count, 16);
+ List<Integer> result = null;
+ List<String> addresslist = getAddressList(address, count, 16);
try {
- return s7PLC.readInt16(addresslist);
+ result = s7PLC.readUInt16(addresslist);
} catch (Exception e) {
+ s7PLC.hotRestart();
System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
-
- return null;
+ } finally {
+ return result;
}
}
@@ -202,18 +286,20 @@
* @param count 杩炵画璇诲灏戜釜byte
* @return 缁撴灉
*/
- public byte[] ReadByte(String address, int count) {
+ public byte[] readByte(String address, int count) {
if (s7PLC == null) {
return null;
}
// List<String> addresslist = GetAddressList(address, count, 16);
-
+ byte[] bytes = null;
try {
- return s7PLC.readByte(address, count);
+ bytes = s7PLC.readByte(address, count);
} catch (Exception e) {
// 澶勭悊寮傚父
+ s7PLC.hotRestart();
System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
- return null;
+ } finally {
+ return bytes;
}
}
@@ -224,14 +310,22 @@
* @param addresslist 鍦板潃闆�
* @return Boolean缁撴灉
*/
- public List<Boolean> ReadBits(List<String> addresslist) {
+ public List<Boolean> readBits(List<String> addresslist) {
if (s7PLC == null) {
return null;
}
- return s7PLC.readBoolean(addresslist);
+ List<Boolean> values = new ArrayList<>();
+ try {
+ values = s7PLC.readBoolean(addresslist);
+ } catch (Exception e) {
+ // 澶勭悊寮傚父
+ s7PLC.hotRestart();
+ } finally {
+ return values;
+ }
}
- //璇诲彇涓嶈繛缁湴鍧�bit
+ /* //璇诲彇涓嶈繛缁湴鍧�bit
public List<Boolean> readBits(List<String> addressList) {
if (s7PLC == null || addressList.isEmpty()) {
return null;
@@ -249,141 +343,61 @@
}
return values;
- }
+ }*/
-
- //璇诲彇StringList
- public List<String> readStrings(List<String> addressList) {
- if (s7PLC == null) {
- return null;
- }
- List<String> result = new ArrayList<>();
- for (String address : addressList) {
- try {
- byte[] bytes = s7PLC.readByte(address, 14);
- if (bytes != null) {
- String str = new String(bytes, StandardCharsets.UTF_8);
- result.add(str);
- }
- } catch (Exception e) {
- System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
- result.add(null);
- }
- }
-
- return result;
- }
//璇诲彇瀛楃涓�
public String readString(String address) {
if (s7PLC == null) {
return null;
}
+ String result = null;
try {
- return s7PLC.readString(address);
+ result = s7PLC.readString(address);
} catch (Exception e) {
+ s7PLC.hotRestart();
System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
- return null;
+ } finally {
+ return result;
}
}
-
- //涓嶈繛缁湴鍧�鍐欏叆Word
- public void WriteWord(List<String> address, List<Short> datas) {
- if (s7PLC == null) {
- return;
- }
-
- for (int i = 0; i < address.size(); i++) {
- String addr = address.get(i);
- short data = datas.get(i);
-
- if (addr.contains("-")) {
- outmesid(String.valueOf(data), addr); // 鍗曠嫭澶勭悊甯︾牬鎶樺彿鐨勫湴鍧�
- } else {
- s7PLC.writeInt16(addr, data); // 灏嗘暟鎹啓鍏ュ崟涓湴鍧�
- }
- }
- }
-
-
- //瀛楃涓插啓鍏�
- public void outmesid(String data, String addr) {
-// System.out.println("outmesid: " + data);
- List<Byte> glassidlist = new ArrayList<>();
- String[] parts = addr.split("-");
- if (parts.length == 2) {
- addr = parts[0]; // 鍙繚鐣� "-" 鍓嶉潰鐨勯儴鍒�
- }
- for (char iditem : data.toCharArray()) {
- glassidlist.add(Byte.valueOf(String.valueOf(iditem)));
- }
- byte[] bytes = Bytes.toArray(glassidlist);
- WriteByte(addr, bytes);
- }
-
- //璇诲彇涓嶈繛缁瓀ord
- public List<Short> readWords(List<String> addresses) {
- if (s7PLC == null) {
- return null;
- }
- List<Short> data = new ArrayList<>();
-
- for (String address : addresses) {
- try {
- // 鍗曚釜鍦板潃
- Short value = s7PLC.readInt16(address);
- data.add(value);
- } catch (Exception e) {
- System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
-
- }
-
- }
- return data;
- }
-
- //璇诲彇鍗曚釜word
- public Short readWord(String address) {
- if (s7PLC == null) {
- return null;
- }
- try {
- // 鍗曚釜鍦板潃
- return s7PLC.readInt16(address);
- } catch (Exception e) {
- System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
-
- }
- return -1;
- }
//璇诲彇鏃堕棿
public Long readtime(String address) {
if (s7PLC == null) {
return null;
}
+ Long result = null;
try {
- return s7PLC.readTime(address);
+ result = s7PLC.readTime(address);
} catch (Exception e) {
+ s7PLC.hotRestart();
System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
- return null;
+ } finally {
+ return result;
}
}
- public void writetime(String address, long datas) {
- if (s7PLC == null)
- return;
-
-
- s7PLC.writeTime(address, datas); // 灏嗘暟鎹啓鍏ュ崟涓湴鍧�
- }
-
-
- private int extractAddressNumber(String address) {
- String numberStr = address.replaceAll("\\D+", ""); // 浣跨敤姝e垯琛ㄨ揪寮忔彁鍙栨暟瀛楅儴鍒�
- return Integer.parseInt(numberStr);
+ public boolean writetime(String address, long datas) {
+ if (s7PLC == null) {
+ return false;
+ }
+ boolean result = false;
+ int tryCount = 2;
+ do {
+ try {
+ s7PLC.writeTime(address, datas); // 灏嗘暟鎹啓鍏ュ崟涓湴鍧�
+ result = true;
+ } catch (Exception ex) {
+ reStartS7client();
+ } finally {
+ tryCount -= 1;
+ }
+ }
+ while (!result && tryCount > 0);
+ return result;
}
@@ -394,23 +408,26 @@
* @param count 闀垮害
* @return Boolean缁撴灉
*/
- public List<Boolean> ReadBits(String address, int count) {
- if (s7PLC == null)
- return null;
- List<String> addresslist = GetAddressList(address, count, 1);
- try {
- return s7PLC.readBoolean(addresslist);
- } catch (Exception e) {
- System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
+ public List<Boolean> readBits(String address, int count) {
+ if (s7PLC == null) {
return null;
}
-
+ List<Boolean> values = new ArrayList<>();
+ List<String> addresslist = getAddressList(address, count, 1);
+ try {
+ values = s7PLC.readBoolean(addresslist);
+ } catch (Exception e) {
+ s7PLC.hotRestart();
+ System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
+ } finally {
+ return values;
+ }
}
;
- private List<String> GetAddressList(String address, int count, int addedbit) {
+ private List<String> getAddressList(String address, int count, int addedbit) {
List<String> addresslist = new ArrayList<String>();
String[] stringdatas = address.trim().split("\\.");
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/WebSocketServer.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java
similarity index 91%
rename from hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/WebSocketServer.java
rename to hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java
index 5fabafa..11ce5dd 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/WebSocketServer.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java
@@ -1,4 +1,4 @@
-package com.mes.common;
+package com.mes.tools;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
@@ -22,12 +22,6 @@
public static ConfigurableApplicationContext applicationContext;
- // 瑙e喅鏃犳硶娉ㄥ叆mapper闂 //浣跨敤鏂规硶
- // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class);
- public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) {
- WebSocketServer.applicationContext = configurableApplicationContext;
- }
-
private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
private List<String> messages;
/**
@@ -35,8 +29,8 @@
*/
public static final Map<String, ArrayList<WebSocketServer>> sessionMap = new ConcurrentHashMap<>();
- String username;
- Session session;
+ public String username;
+ public Session session;
public WebSocketServer() {
this.messages = new ArrayList<>();
@@ -111,8 +105,6 @@
JSONObject jsonObject = new JSONObject();
jsonObject.set("message", text);
this.messages.add(text);
- this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject)
-
}
@OnError
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/pom.xml b/hangzhoumesParent/moduleService/CacheGlassModule/pom.xml
index eabe196..568e912 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/pom.xml
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/pom.xml
@@ -22,6 +22,11 @@
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
+ <dependency>
+ <groupId>org.samba.jcifs</groupId>
+ <artifactId>jcifs</artifactId>
+ <version>1.2.19</version>
+ </dependency>
<!-- <dependency>-->
<!-- <groupId>com.github.yulichang</groupId>-->
<!-- <artifactId>mybatis-plus-join-boot-starter</artifactId>-->
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java
index f13c19b..f63bc63 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java
@@ -14,7 +14,7 @@
public class S7object extends Thread {
public S7control plccontrol; // PLC閫氳绫诲疄渚�
private EPlcType plcType = EPlcType.S1200; // 瑗块棬瀛怭LC绫诲瀷
- private String ip = "192.168.10.1"; // plc ip鍦板潃
+ private String ip = "192.168.10.11"; // plc ip鍦板潃
private int port = 102; // plc 绔彛鍙�
@@ -52,9 +52,10 @@
e.printStackTrace();
}
- byte[] getplcvlues = plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
- PlcMesObject.setPlcParameterList(getplcvlues);
-
+ byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
+ if (getplcvlues != null) {
+ PlcMesObject.setPlcParameterList(getplcvlues);
+ }
}
}
}
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/SmbTool.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/SmbTool.java
new file mode 100644
index 0000000..2b5c9d5
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/SmbTool.java
@@ -0,0 +1,71 @@
+package com.mes.common;
+
+import jcifs.smb.NtlmPasswordAuthentication;
+import jcifs.smb.SmbFile;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class SmbTool {
+ public static String USER_DOMAIN=null;//鍏变韩璁$畻鏈篿p "192.168.3.102";
+ public static String USER_ACCOUNT=null;//鐧诲綍鍏变韩鏂囦欢澶� 鐢ㄦ埛鍚� "aaa"锛屽鏋滄槸鍏变韩鏄棤瀵嗙爜妯″紡 姝ゅ鍊艰缃负 null;
+ public static String USER_PWS=null;//鐧诲綍鍏变韩鏂囦欢澶� 瀵嗙爜"guoyujie"锛屽鏋滄槸鍏变韩鏄棤瀵嗙爜妯″紡 姝ゅ鍊艰缃负 null;
+
+ /**
+ * test 娴嬭瘯绀轰緥
+ */
+ private void test()
+ {
+ int index= SmbTool.getDescriptionIndex("log","P20240522");//杈撳叆鍒囧壊鏈哄叡浜枃浠跺す鍚嶅瓧銆佸伐绋嬪彿锛岃繑鍥炲綋鍓嶅伐绋嬫鍦ㄥ垏鍓茬殑鐗堝浘鍙�
+ System.out.print(index);
+ }
+ /**
+ * smbGetall 杩斿洖鎸囧畾鐩綍涓嬬殑鏂囦欢鍚嶅瓧
+ * @param GoalUrl 杩滅鐩綍锛�"smb://192.168.2.100//ceshi//"锛�
+ */
+ public static String[] smbGetallFilenames(String GoalUrl) {
+ NtlmPasswordAuthentication auth=new NtlmPasswordAuthentication(USER_DOMAIN,USER_ACCOUNT,USER_PWS);
+ List<String> filenames=new ArrayList<>();
+ try {
+ SmbFile remoteFile = new SmbFile(GoalUrl,auth);
+ if (remoteFile == null) {
+ return filenames.toArray(new String[]{});
+ }
+ if (remoteFile.exists())
+ {
+ SmbFile[] listFiles = remoteFile.listFiles();
+ for(int i = 0; i < listFiles.length; i++) {
+ filenames.add(listFiles[i].getName());
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return filenames.toArray(new String[]{});
+ }
+ /**
+ * getDescriptionIndex 鏍规嵁宸ョ▼鍙凤紝杩斿洖褰撳墠姝e湪鍒囧壊鐨勭増鍥惧彿
+ * @param folderName 鍏变韩鏂囦欢澶瑰悕瀛�
+ * @param project_no 宸ョ▼鍙�
+ */
+ public static int getDescriptionIndex(String folderName,String project_no)
+ {
+ SimpleDateFormat formatter= new SimpleDateFormat("yyyyMMdd");
+ Date date = new Date(System.currentTimeMillis());
+ System.out.println(formatter.format(date));
+ String[] getfilenames= smbGetallFilenames("smb://"+USER_DOMAIN+"/"+folderName+"/"+formatter.format(date)+"/");
+ for (int i = 0; i < getfilenames.length; i++) {
+ String[] splitvalues= getfilenames[i].split("_");
+ if (splitvalues.length>=3&&splitvalues[1].trim().equals(project_no))
+ {
+ String[] indexstr= splitvalues[2].trim().split("\\.");
+ if (indexstr.length>1) {
+ return Integer.parseInt(indexstr[0]);
+ }
+ }
+ }
+ return -1;
+ }
+}
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java
index 6e85d25..8ec6a5a 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java
@@ -31,6 +31,11 @@
/**
* 璁惧id
*/
+ private String engineerId;
+
+ /**
+ * 璁惧id
+ */
private Integer deviceId;
/**
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/EdgStorageCageService.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/EdgStorageCageService.java
index a9d0721..8c2763e 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/EdgStorageCageService.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/EdgStorageCageService.java
@@ -19,9 +19,10 @@
/**
* 鏌ヨ绗煎唴绂绘寚瀹氭牸瀛愭渶杩戠┖鏍�
+ *
* @return
*/
- EdgStorageCage selectNearestEmpty(int currentSlot);
+ EdgStorageCage selectNearestEmpty(int currentSlot, boolean flag);
/**
* 鏌ヨ绗煎唴绌烘牸
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java
index f94d854..12a13ad 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java
@@ -37,7 +37,7 @@
UpPattenUsageMapper upPattenUsageMapper;
@Override
- public EdgStorageCage selectNearestEmpty(int currentSlot) {
+ public EdgStorageCage selectNearestEmpty(int currentSlot, boolean flag) {
List<EdgStorageCage> emptyList = this.selectJoinList(EdgStorageCage.class, new MPJLambdaWrapper<EdgStorageCage>()
.selectAll(EdgStorageCage.class)
.leftJoin(EdgStorageCageDetails.class, on -> on
@@ -46,7 +46,10 @@
.isNull(EdgStorageCageDetails::getSlot)
.last("order by abs(t.slot - " + currentSlot + ") asc limit 2")
);
- if (CollectionUtil.isEmpty(emptyList) || emptyList.size() < 2) {
+ if (flag && CollectionUtil.isNotEmpty(emptyList)) {
+ return emptyList.get(0);
+ }
+ if (CollectionUtil.isEmpty(emptyList) || emptyList.size() == 1) {
return null;
}
return emptyList.get(0);
@@ -105,12 +108,9 @@
.select(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight, EdgStorageCageDetails::getId)
.leftJoin(EdgStorageCageDetails.class, on -> on
.eq(EdgStorageCageDetails::getDeviceId, EdgStorageCage::getDeviceId)
+ .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)
.eq(EdgStorageCageDetails::getSlot, EdgStorageCage::getSlot))
);
-// return baseMapper.selectJoinMaps(new MPJQueryWrapper<EdgStorageCage>().selectAll(EdgStorageCage.class)
-// .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height")
-// .leftJoin("edg_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot")
-// );
}
/**
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
deleted file mode 100644
index 9f8583a..0000000
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package com.mes.glassinfo.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * <p>
- *
- * </p>
- *
- * @author zhoush
- * @since 2024-04-07
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class GlassInfo implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 鐜荤拑淇℃伅琛╥d
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 娴佺▼鍗�
- */
- private String flowCardId;
-
- /**
- * 娴佺▼鍗$幓鐠冪被鍨�
- */
- private Integer glassType;
-
- /**
- * 瀹�
- */
- private Double width;
-
- /**
- * 楂�
- */
- private Double height;
-
- /**
- * 鍘氬害
- */
- private Double thickness;
-
- /**
- * 鑶滅郴
- */
- private String filmsid;
-
- /**
- * 纾ㄥ墠瀹�
- */
- private Double edgWidth;
-
- /**
- * 纾ㄥ墠楂�
- */
- private Double edgHeight;
-
- /**
- * 鏄惁閰嶇墖
- */
- private Integer ismultiple;
-
- /**
- * 閰嶇墖鏈�澶у
- */
- private Double maxWidth;
-
- /**
- * 閰嶇墖鏈�澶ч珮
- */
- private Double maxHeight;
-
- /**
- * 閽㈠寲鏄惁鎺ュ彈妯斁
- */
- private Integer ishorizontal;
-
- /**
- * 鍘熺墖椤哄簭
- */
- private Integer patternSequence;
-
- /**
- * 閽㈠寲鐗堝浘id
- */
- private Integer temperingLayoutId;
-
- /**
- * 閽㈠寲鐗堝浘鐗囧簭
- */
- private Integer temperingFeedSequence;
-
- /**
- * x鍧愭爣
- */
- private Integer xCoordinate;
-
- /**
- * y鍧愭爣
- */
- private Integer yCoordinate;
-
- /**
- * 鏃嬭浆瑙掑害锛堥�嗘椂閽堬級
- */
- private Integer angle;
-
- /**
- * 宸ョ▼鍙�
- */
- private String engineerId;
-
- /**
- * 鐢熶骇瑙勫垯id
- */
- private Integer ruleId;
-
- /**
- * 鐜荤拑ID
- */
- private String glassId;
-
-
-}
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
index 053491a..61a5e69 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
@@ -5,9 +5,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.query.MPJQueryWrapper;
-import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.common.S7object;
-import com.mes.common.WebSocketServer;
import com.mes.common.config.Const;
import com.mes.device.PlcParameterObject;
import com.mes.edgglasstask.entity.EdgGlassTaskInfo;
@@ -20,6 +18,7 @@
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.taskcache.entity.TaskCache;
import com.mes.taskcache.service.TaskCacheService;
+import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
@@ -86,7 +85,7 @@
return;
}
log.info("2銆佽幏鍙栧埌鐨勮姹傚瓧涓�0锛屽皢纭瀛楁敼涓�0");
- S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 0);
+ S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 0);
return;
}
if (!"0".equals(confirmationWrodValue)) {
@@ -104,14 +103,10 @@
} else if ("3".equals(taskRequestTypeValue)) {
log.info("2銆佽繘鐗囧拰鍑虹墖閮界┖闂诧紝鎵ц鍑虹墖浠诲姟");
//鍔犵瀛愰噷闈㈡槸鍚︽湁鐜荤拑锛屾湁鍏堝嚭锛屾棤鐜荤拑鍏堣繘
- if (("1".equals(out08Glassstate) || "1".equals(out10Glassstate))) {
- boolean outFlase = outTo(Integer.parseInt(out08Glassstate),
- Integer.parseInt(out10Glassstate), confirmationWrodAddress, glassIdeValue, Integer.parseInt(currentSlot));
- log.info("鍑虹墖浠诲姟鏄惁瀹屾垚锛歿},澶辫触涓旂幓鐠僫d:{}涓嶄负绌哄垯鎵ц杩涚墖浠诲姟", outFlase, glassIdeValue);
- if (!outFlase && StringUtils.isNotBlank(glassIdeValue)) {
- inTo(glassIdeValue, confirmationWrodAddress, currentSlot);
- }
- } else {
+ boolean outFlase = outTo(Integer.parseInt(out08Glassstate),
+ Integer.parseInt(out10Glassstate), confirmationWrodAddress, glassIdeValue, Integer.parseInt(currentSlot));
+ log.info("鍑虹墖浠诲姟鏄惁瀹屾垚锛歿},澶辫触涓旂幓鐠僫d:{}涓嶄负绌哄垯鎵ц杩涚墖浠诲姟", outFlase, glassIdeValue);
+ if (!outFlase && StringUtils.isNotBlank(glassIdeValue)) {
inTo(glassIdeValue, confirmationWrodAddress, currentSlot);
}
}
@@ -147,33 +142,64 @@
*/
private void inTo(String glassId, String confirmationWrodAddress, String currentSlot) {
log.info("1銆佹寜鐓х幓鐠僫d:{}鑾峰彇鐜荤拑灏忕墖淇℃伅,褰撳墠鏍煎瓙涓�:{}", glassId, currentSlot);
- GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
- if (glassInfo == null) {
- log.info("2銆佹鐜荤拑缂栧彿涓嶅瓨鍦�");
- return;
- }
- log.info("2銆佽幏鍙栧埌鐨勭幓鐠冧俊鎭负{}", glassInfo);
//娣诲姞杩涚墖浠诲姟 鏌ユ壘绌烘牸
- EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(Integer.parseInt(currentSlot));
+ EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(Integer.parseInt(currentSlot), Boolean.FALSE);
Assert.isTrue(null != nearestEmpty, "鏍煎瓙宸叉弧");
- log.info("3銆佹煡璇㈠崸寮忕悊鐗囩閲岄潰鐨勭┖鏍�:{}", nearestEmpty);
+ log.info("2銆佹煡璇㈠崸寮忕悊鐗囩閲岄潰鐨勭┖鏍�:{}", nearestEmpty);
- log.info("4銆佸皢鐜荤拑淇℃伅鎻掑叆鍗у紡鐞嗙墖绗�,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
+ //鏌ヨ鐜荤拑骞惰繘琛屼氦鎹�
+ GlassInfo glassInfo = queryAndChangeGlass(glassId);
+ log.info("3銆佸皢鐜荤拑淇℃伅鎻掑叆鍗у紡鐞嗙墖绗�,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
EdgStorageCageDetails details = new EdgStorageCageDetails();
BeanUtils.copyProperties(glassInfo, details);
details.setState(Const.GLASS_STATE_IN);
details.setSlot(nearestEmpty.getSlot());
details.setDeviceId(nearestEmpty.getDeviceId());
edgStorageCageDetailsService.save(details);
- log.info("5銆佺幓鐠冧俊鎭凡瀛樺叆鐞嗙墖绗艰鎯呰〃锛岀幓鐠冧俊鎭负{}", details);
+ log.info("4銆佺幓鐠冧俊鎭凡瀛樺叆鐞嗙墖绗艰鎯呰〃锛岀幓鐠冧俊鎭负{}", details);
//娣诲姞杩涚墖浠诲姟
boolean taskCache = saveTaskCache(details.getGlassId(), 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN);
- log.info("6銆佺敓鎴愯繘鐗囦换鍔′俊鎭瓨鍏ヤ换鍔¤〃鏄惁瀹屾垚锛歿}", taskCache);
+ log.info("5銆佺敓鎴愯繘鐗囦换鍔′俊鎭瓨鍏ヤ换鍔¤〃鏄惁瀹屾垚锛歿}", taskCache);
- S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1);
- log.info("7銆佸彂閫佺‘璁ゅ瓧瀹屾垚");
+ S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1);
+ log.info("6銆佸彂閫佺‘璁ゅ瓧瀹屾垚");
+ }
+
+ /**
+ * 鏌ヨ鐜荤拑骞惰繘琛屼氦鎹�
+ *
+ * @param glassId
+ * @return
+ */
+ public GlassInfo queryAndChangeGlass(String glassId) {
+ GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
+ Assert.isFalse(null == glassInfo, "鐜荤拑淇℃伅涓嶅瓨鍦�");
+ //鎸夌収鐜荤拑灏哄
+ LambdaQueryWrapper<GlassInfo> queryWrapper = new LambdaQueryWrapper<GlassInfo>()
+ .eq(GlassInfo::getWidth, glassInfo.getWidth())
+ .eq(GlassInfo::getHeight, glassInfo.getHeight())
+ .eq(GlassInfo::getThickness, glassInfo.getThickness())
+ .eq(GlassInfo::getFilmsid, glassInfo.getFilmsid())
+ .eq(GlassInfo::getTotalLayer, glassInfo.getTotalLayer())
+ .eq(GlassInfo::getLayer, glassInfo.getLayer())
+ .eq(GlassInfo::getEngineerId, glassInfo.getEngineerId())
+ .notInSql(GlassInfo::getGlassId, "select distinct glass_id from edg_storage_cage_details " +
+ "where engineer_id = '" + glassInfo.getEngineerId() + "' and width = " + glassInfo.getWidth() + " and height = " + glassInfo.getHeight())
+ .orderByAsc(GlassInfo::getTemperingLayoutId)
+ .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)
+ .last("Limit 1");
+ GlassInfo swapGlassInfo = glassInfoService.getOne(queryWrapper);
+ if (swapGlassInfo != null && !glassInfo.getGlassId().equals(swapGlassInfo.getGlassId())) {
+ String swapGlassId = swapGlassInfo.getGlassId();
+ swapGlassInfo.setGlassId(glassId);
+ glassInfo.setGlassId(swapGlassId);
+ glassInfoService.updateById(swapGlassInfo);
+ glassInfoService.updateById(glassInfo);
+ return swapGlassInfo;
+ }
+ return glassInfo;
}
/**
@@ -185,7 +211,7 @@
* @param glassId
* @param currentSlot
*/
- private boolean outTo(int out08Glassstate, int out10Glassstate, String confirmationWrodAddress, String glassId, int currentSlot) {
+ public boolean outTo(int out08Glassstate, int out10Glassstate, String confirmationWrodAddress, String glassId, int currentSlot) {
//閫昏緫姝ラ锛�
// 0銆丄09銆丄10鏄惁绌洪棽锛屾槸鍚﹀彲浠ユ墽琛屽嚭鐗囦换鍔�
// 1銆佽幏鍙栭挗鍖栫増鍥炬槸鍚﹁秴杩囬槇鍊�
@@ -199,7 +225,10 @@
// 1.2.3銆佹寜鐓у嚭鐗囦俊鎭幓璇︽儏琛ㄦ煡璇㈡牸瀛愬湪绗煎瓙閲岄潰鍓╀綑鐩稿悓灏哄鐨勭幓鐠冩暟鎹笖浠ョ増鍥緄d銆佺増搴忓崌搴忔帓搴� 鍙栫涓�鍧楃幓鐠冨嚭鐗�
// 2銆佸鏋滄病鏈夊巻鍙插嚭鐗囦换鍔�
// 2.1銆佸嚭褰撳墠鐗堝浘id鏈�灏忕増搴忔渶灏忕殑鐜荤拑锛堥棶棰橈細涓ゆ潯绾块兘娌℃湁鍘嗗彶浠诲姟锛屽嚭鐗囨椂涓ゆ潯绾跨殑鐜荤拑灏哄鐩稿悓锛屾槸鍚︽壘灏哄涓嶅悓鐨勶級
- Assert.isFalse(out08Glassstate == 0 && out10Glassstate == 0, "A09銆丄10閮芥湁鐜荤拑锛屾棤娉曞嚭鐗�");
+ if (out08Glassstate == 2 && out10Glassstate == 2) {
+ log.info("A09銆丄10涓簕},{}闈炶嚜鍔ㄧ姸鎬侊紝鏃犳硶鍑虹墖");
+ return Boolean.FALSE;
+ }
log.info("0銆佸嚭鐗囦换鍔″嚭鐨勭姸鎬�:A09:銆恵}銆�;A10:銆恵}銆�)", out08Glassstate, out10Glassstate);
//瀹氫箟鍑虹墖鐜荤拑淇℃伅
int endcell = 0;
@@ -219,36 +248,59 @@
endcell = queryLineByGlassInfo(a09EdgGlass, a10EdgGlass, glassInfo, out08Glassstate, out10Glassstate);
} else {
//鍒ゆ柇涓ゆ潯绾挎槸鍚﹂兘绌洪棽
- endcell = out08Glassstate == 1 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
- if (out08Glassstate == 1 && out10Glassstate == 1) {
+ endcell = out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
+
+ if ((out08Glassstate == 0 && out10Glassstate == 0) || (out08Glassstate == 1 && out10Glassstate == 1)) {
EdgStorageCageDetails a09EdgGlass = queryGlassByTaskCache(Const.A09_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT);
EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT);
if (a09EdgGlass == null && a10EdgGlass == null) {
- MPJLambdaWrapper<EdgStorageCageDetails> wrapper = new MPJLambdaWrapper<>();
- wrapper.select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight)
- .selectCount(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails::getCount)
- .groupBy(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight)
- .last("order by count(t.glass_id) desc limit 2");
+ MPJQueryWrapper<EdgStorageCageDetails> wrapper = new MPJQueryWrapper<>();
+ wrapper.select("count(t.glass_id), t.width, t.height")
+ .eq("t.state", Const.GLASS_STATE_IN)
+ .groupBy("t.width, t.height");
+ if (endcell == Const.A10_OUT_TARGET_POSITION) {
+ wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+ "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
+ "on t.glass_id = t1.glass_id and t1.first_length <3500 and t1.second_length<2600 ");
+ }
+ wrapper.last("order by count(t.glass_id) desc limit 2");
List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper);
if (CollectionUtil.isEmpty(list)) {
- GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>()
- .eq(GlassInfo::getGlassId, glassId));
- EdgStorageCageDetails resultDetails = new EdgStorageCageDetails();
- BeanUtils.copyProperties(one, resultDetails);
- glassInfo = resultDetails;
+ MPJQueryWrapper<GlassInfo> queryWrapper = new MPJQueryWrapper<GlassInfo>()
+ .selectAll(GlassInfo.class).eq("t.glass_id", glassId);
+ if (endcell == Const.A10_OUT_TARGET_POSITION) {
+ queryWrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+ "case when width < height then width else height end as second_length from glass_info) t1 " +
+ "on t.glass_id = t1.glass_id and t1.first_length <3500 and t1.second_length<2600 ");
+ }
+ GlassInfo one = glassInfoService.getOne(queryWrapper);
+ if (one != null) {
+ EdgStorageCageDetails resultDetails = new EdgStorageCageDetails();
+ BeanUtils.copyProperties(one, resultDetails);
+ glassInfo = resultDetails;
+ } else {
+ log.info("鑾峰彇绗煎唴鐜荤拑鍜屽甫杩涚墖鐜荤拑涓虹┖鎴栬�呬笉绗﹀悎纾ㄨ竟灏哄");
+ }
} else {
glassInfo = queryMinGlass(list.get(0).getWidth(), list.get(0).getHeight(), glassId);
}
} else if (a09EdgGlass != null && a10EdgGlass != null) {
List<EdgStorageCageDetails> a09Count = queryGlassByTaskLine(Const.A09_OUT_TARGET_POSITION);
- List<EdgStorageCageDetails> a10Count = queryGlassByTaskLine(Const.A09_OUT_TARGET_POSITION);
+ List<EdgStorageCageDetails> a10Count = queryGlassByTaskLine(Const.A10_OUT_TARGET_POSITION);
endcell = a09Count.size() > a10Count.size() ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
glassInfo = a09Count.size() > a10Count.size() ? queryMinGlass(a09EdgGlass.getWidth(), a09EdgGlass.getHeight(), glassId)
: queryMinGlass(a10EdgGlass.getWidth(), a10EdgGlass.getHeight(), glassId);
} else {
- endcell = a09EdgGlass != null ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
- glassInfo = a09EdgGlass != null ? queryMinGlass(a09EdgGlass.getWidth(), a09EdgGlass.getHeight(), glassId)
- : queryMinGlass(a10EdgGlass.getWidth(), a10EdgGlass.getHeight(), glassId);
+ //鎸夌収鍘嗗彶浠诲姟鑾峰彇闇�瑕佹墽琛岀殑璺嚎锛屽鏋滆鏉$嚎绗煎唴鏃犵幓鐠� 璧板叾浠栭�昏緫
+ endcell = a09EdgGlass == null ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
+ List<EdgStorageCageDetails> details = queryGlassByTaskLine(endcell);
+ if (CollectionUtil.isEmpty(details)) {
+ int othercell = endcell == Const.A10_OUT_TARGET_POSITION ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
+ glassInfo = queryChangeGlassInfo(othercell, glassId);
+ } else {
+ glassInfo = a09EdgGlass != null ? queryMinGlass(a09EdgGlass.getWidth(), a09EdgGlass.getHeight(), glassId)
+ : queryMinGlass(a10EdgGlass.getWidth(), a10EdgGlass.getHeight(), glassId);
+ }
}
} else {
List<EdgStorageCageDetails> edgStorageCageDetails = queryGlassByTaskLine(endcell);
@@ -257,7 +309,10 @@
} else {
//鑾峰彇绗煎唴鎵�鏈夌幓鐠冧俊鎭紝鍖呮嫭寰呰繘鐗囩殑
List<EdgStorageCageDetails> glassList = queryEdgAllGlass(glassId);
- Assert.isTrue(CollectionUtil.isNotEmpty(glassList), "绗煎唴鍜屽緟杩涚墖閮芥病鏈夌幓鐠�");
+ if (CollectionUtil.isEmpty(glassList)) {
+ log.info("绗煎唴鍜屽緟杩涚墖閮芥病鏈夌幓鐠�");
+ return Boolean.FALSE;
+ }
if (glassList.size() == 1 && glassId.equals(glassList.get(0).getGlassId())) {
glassInfo = glassList.get(0);
} else {
@@ -278,6 +333,7 @@
private List<EdgStorageCageDetails> queryEdgAllGlass(String glassId) {
List<EdgStorageCageDetails> glassList = new ArrayList<>();
//鑾峰彇寰呰繘鐗囩幓鐠�
+ //todo: 鑾峰彇姝e湪鎵ц鐨勫伐绋嬩俊鎭�
if (StringUtils.isNotBlank(glassId)) {
GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>()
.eq(GlassInfo::getGlassId, glassId));
@@ -400,22 +456,18 @@
*/
private Integer queryLineByGlassInfo(EdgStorageCageDetails a08EdgStorageCageDetails, EdgStorageCageDetails a10EdgStorageCageDetails,
EdgStorageCageDetails glassInfo, int out08Glassstate, int out10Glassstate) {
- if (a08EdgStorageCageDetails != null && a08EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight())
- && a08EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth()) && out08Glassstate == 1) {
- return Const.A09_OUT_TARGET_POSITION;
+ boolean b08 = a08EdgStorageCageDetails != null && a08EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight())
+ && a08EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth());
+ boolean b10 = a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight())
+ && a10EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth());
+ //瀛樺湪鍑虹墖浠诲姟 07涓虹┖
+ if (b10) {
+ return out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
}
- if (a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight())
- && a10EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth()) && out10Glassstate == 1) {
- return Const.A10_OUT_TARGET_POSITION;
+ if (b08) {
+ return out08Glassstate == 2 ? Const.A10_OUT_TARGET_POSITION : Const.A09_OUT_TARGET_POSITION;
}
- if (out08Glassstate == 1) {
- return Const.A09_OUT_TARGET_POSITION;
- }
- if (out10Glassstate == 1) {
- return Const.A10_OUT_TARGET_POSITION;
- }
- Assert.isTrue(Boolean.FALSE, "娌℃湁鎵惧埌鍑虹墖璺緞");
- return 0;
+ return out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
}
/**
@@ -425,14 +477,18 @@
* @param glassId
* @return
*/
- private EdgStorageCageDetails queryChangeGlassInfo(int endcell, String glassId) {
+ public EdgStorageCageDetails queryChangeGlassInfo(int endcell, String glassId) {
//鑾峰彇绗煎瓙鍐呮暟閲忓墠浜岀殑鐜荤拑鏁伴噺
- MPJLambdaWrapper<EdgStorageCageDetails> wrapper = new MPJLambdaWrapper<>();
- wrapper.select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight)
- .selectCount(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails::getCount)
- .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)
- .groupBy(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight)
- .last("order by count(t.glass_id) desc limit 2");
+ MPJQueryWrapper<EdgStorageCageDetails> wrapper = new MPJQueryWrapper<>();
+ wrapper.select("count(t.glass_id), t.width, t.height")
+ .eq("t.state", Const.GLASS_STATE_IN)
+ .groupBy("t.width, t.height");
+ if (endcell == Const.A09_OUT_TARGET_POSITION) {
+ wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+ "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
+ "on t.glass_id = t1.glass_id and t1.first_length <3500 and t1.second_length<2600 ");
+ }
+ wrapper.last("order by count(t.glass_id) desc limit 2");
List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper);
if (CollectionUtil.isEmpty(list)) {
return null;
@@ -502,7 +558,7 @@
log.info("5銆佺洿閫氫换鍔�,灏嗙幓鐠冧俊鎭彃鍏ュ崸寮忕悊鐗囩,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
EdgStorageCageDetails details = new EdgStorageCageDetails();
BeanUtils.copyProperties(glassInfo, details);
- EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(currentSlot);
+ EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(currentSlot, Boolean.TRUE);
Assert.isTrue(null != nearestEmpty, "鏍煎瓙宸叉弧,鏃犳硶鎵ц鐩撮�氫换鍔�");
log.info("3銆佹煡璇㈠崸寮忕悊鐗囩閲岄潰鐨勭┖鏍�:{}", nearestEmpty);
details.setSlot(nearestEmpty.getSlot());
@@ -525,7 +581,7 @@
}
boolean glassSizeStatus = saveGlassSize(glassInfo);
log.info("7銆佹坊鍔犲嚭鐗囩幓鐠冨昂瀵镐俊鎭埌纾ㄨ竟鍓嶇幓鐠冭〃鏄惁瀹屾垚锛歿}", glassSizeStatus);
- S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1);
+ S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1);
log.info("8銆佸彂閫佺‘璁ゅ瓧宸插畬鎴�");
return Boolean.TRUE;
}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java
index 785ef2f..ac57db3 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java
@@ -51,7 +51,7 @@
e.printStackTrace();
}
- byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength());
+ byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
PlcMesObject.setPlcParameterList(getplcvlues);
}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/WebSocketServer.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/WebSocketServer.java
deleted file mode 100644
index 5fabafa..0000000
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/WebSocketServer.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package com.mes.common;
-
-import cn.hutool.json.JSONObject;
-import cn.hutool.json.JSONUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.stereotype.Component;
-
-import javax.websocket.*;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-@ServerEndpoint(value = "/api/talk/{username}")
-@Component("webSocketServer")
-public class WebSocketServer {
-
-
- public static ConfigurableApplicationContext applicationContext;
-
- // 瑙e喅鏃犳硶娉ㄥ叆mapper闂 //浣跨敤鏂规硶
- // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class);
- public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) {
- WebSocketServer.applicationContext = configurableApplicationContext;
- }
-
- private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
- private List<String> messages;
- /**
- * 璁板綍褰撳墠鍦ㄧ嚎杩炴帴鏁�
- */
- public static final Map<String, ArrayList<WebSocketServer>> sessionMap = new ConcurrentHashMap<>();
-
- String username;
- Session session;
-
- public WebSocketServer() {
- this.messages = new ArrayList<>();
- }
-
- /**
- * 杩炴帴寤虹珛鎴愬姛璋冪敤鐨勬柟娉�
- */
- @OnOpen
- public void onOpen(Session session, @PathParam("username") String username) {
- this.username = username;
- this.session = session;
- List<WebSocketServer> webSocketServers = sessionMap.get(username);
- if (webSocketServers == null) {
- ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>();
- arrayListwebserver.add(this);
- sessionMap.put(username, arrayListwebserver);
- } else {
- webSocketServers.add(this);
- }
-
- log.info("鏈夋柊鐢ㄦ埛鍔犲叆锛寀sername={}, 褰撳墠鍦ㄧ嚎浜烘暟涓猴細{}", username, sessionMap.get(username).size());
-
- // JSONObject result = new JSONObject();
- // JSONArray array = new JSONArray();
- // result.set("users", array);
- // for (Object key : sessionMap.keySet()) {
- // JSONObject jsonObject = new JSONObject();
- // jsonObject.set("username", key);
- // array.add(jsonObject);
- // }
-
- // sendAllMessage(JSONUtil.toJsonStr(result)); // 鍚庡彴鍙戦�佹秷鎭粰鎵�鏈夌殑瀹㈡埛绔�
- }
-
- /**
- * 杩炴帴鍏抽棴璋冪敤鐨勬柟娉�
- */
- @OnClose
- public void onClose(Session session, @PathParam("username") String username) {
- List<WebSocketServer> webSocketServers = sessionMap.get(username);
- ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>();
- if (webSocketServers.size() > 1) {
- for (WebSocketServer webSocketServer : webSocketServers) {
- if (webSocketServer != this) {
- arrayListwebserver.add(webSocketServer);
- }
- }
- sessionMap.put(username, arrayListwebserver);
- log.info("绉婚櫎username={}涓�鍚嶇敤鎴穝ession, {}鐨勫綋鍓嶅湪绾夸汉鏁颁负锛歿}", username, username, sessionMap.get(username).size());
- } else {
- sessionMap.remove(username);
- log.info("绉婚櫎username={}涓�鍚嶇敤鎴穝ession, {}杩炴帴鍏抽棴, 褰撳墠杩炴帴鏁颁负锛歿}", username, username, sessionMap.size());
- }
-
- }
-
- /**
- * 鏀跺埌瀹㈡埛绔秷鎭悗璋冪敤鐨勬柟娉�
- * 鍚庡彴鏀跺埌瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
- * onMessage 鏄竴涓秷鎭殑涓浆绔�
- * 鎺ュ彈 娴忚鍣ㄧ socket.send 鍙戦�佽繃鏉ョ殑 json鏁版嵁
- *
- * @param message 瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
- */
- @OnMessage
- public void onMessage(String message, Session session, @PathParam("username") String username) {
- log.info("鏈嶅姟绔敹鍒扮敤鎴穟sername={}鐨勬秷鎭�:{}", username, message);
- JSONObject obj = JSONUtil.parseObj(message);
- String text = obj.getStr("data");
-
- JSONObject jsonObject = new JSONObject();
- jsonObject.set("message", text);
- this.messages.add(text);
- this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject)
-
- }
-
- @OnError
- public void onError(Session session, Throwable error) {
- log.error("鍙戠敓閿欒");
- error.printStackTrace();
- }
-
- /**
- * 鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔�
- */
- public void sendMessage(String message) {
- try {
- // log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
- this.session.getBasicRemote().sendText(message);
- } catch (Exception e) {
- log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
- }
- }
-
- // /**
- // * 鏈嶅姟绔彂閫佹秷鎭粰鎵�鏈夊鎴风
- // */
- // public void sendAllMessage(String message) {
- // try {
- // for (WebSocketServer webSocketServer : sessionMap.values()) {
- // // log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
- // webSocketServer.sendMessage(message);
- // }
- // } catch (Exception e) {
- // log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
- // }
- // }
-
- public List<String> getMessages() {
- return messages;
-
- }
-
- public void clearMessages() {
- messages.clear();
- }
-
-
-}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
deleted file mode 100644
index c38d086..0000000
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package com.mes.glassinfo.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * <p>
- *
- * </p>
- *
- * @author zhoush
- * @since 2024-03-27
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class GlassInfo implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 鐜荤拑淇℃伅琛╥d
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 娴佺▼鍗�
- */
- private String flowcardId;
-
- /**
- * 娴佺▼鍗$幓鐠冪被鍨�
- */
- private Integer glassType;
-
- /**
- * 瀹�
- */
- private Double width;
-
- /**
- * 楂�
- */
- private Double height;
-
- /**
- * 鍘氬害
- */
- private Double thickness;
-
- /**
- * 鑶滅郴
- */
- private String filmsid;
-
- /**
- * 纾ㄥ墠瀹�
- */
- private Double edgWidth;
-
- /**
- * 纾ㄥ墠楂�
- */
- private Double edgHeight;
-
- /**
- * 鏄惁閰嶇墖
- */
- private Integer ismultiple;
-
- /**
- * 閰嶇墖鏈�澶у
- */
- private Double maxWidth;
-
- /**
- * 閰嶇墖鏈�澶ч珮
- */
- private Double maxHeight;
-
- /**
- * 閽㈠寲鏄惁鎺ュ彈妯斁
- */
- private Integer ishorizontal;
-
- /**
- * 鍘熺墖椤哄簭
- */
- private Integer patternSequence;
-
- /**
- * 閽㈠寲鐗堝浘id
- */
- private Integer temperingLayoutId;
-
- /**
- * 閽㈠寲鐗堝浘鐗囧簭
- */
- private Integer temperingFeedSequence;
-
- /**
- * x鍧愭爣
- */
- private Integer xCoordinate;
-
- /**
- * y鍧愭爣
- */
- private Integer yCoordinate;
-
- /**
- * 鏃嬭浆瑙掑害锛堥�嗘椂閽堬級
- */
- private Integer angle;
-
- /**
- * 宸ョ▼鍙�
- */
- private Long engineerId;
-
- /**
- * 鐢熶骇瑙勫垯id
- */
- private Integer ruleId;
-
-
-}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
index 1e9a559..f34d1a3 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -9,14 +9,13 @@
import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService;
import com.mes.bigstoragetask.service.BigStorageCageOutTaskService;
import com.mes.common.S7object;
-import com.mes.common.WebSocketServer;
import com.mes.device.PlcParameterObject;
import com.mes.edgstoragetask.service.TaskCacheService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.menu.service.SysMenuService;
+import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java
index 2630c1e..bf80e00 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java
@@ -53,9 +53,10 @@
e.printStackTrace();
}
- byte[] getplcvlues = plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
- PlcMesObject.setPlcParameterList(getplcvlues);
-
+ byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
+ if(getplcvlues!=null) {
+ PlcMesObject.setPlcParameterList(getplcvlues);
+ }
}
}
}
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/WebSocketServer.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/WebSocketServer.java
deleted file mode 100644
index 5fabafa..0000000
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/WebSocketServer.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package com.mes.common;
-
-import cn.hutool.json.JSONObject;
-import cn.hutool.json.JSONUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.stereotype.Component;
-
-import javax.websocket.*;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-@ServerEndpoint(value = "/api/talk/{username}")
-@Component("webSocketServer")
-public class WebSocketServer {
-
-
- public static ConfigurableApplicationContext applicationContext;
-
- // 瑙e喅鏃犳硶娉ㄥ叆mapper闂 //浣跨敤鏂规硶
- // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class);
- public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) {
- WebSocketServer.applicationContext = configurableApplicationContext;
- }
-
- private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
- private List<String> messages;
- /**
- * 璁板綍褰撳墠鍦ㄧ嚎杩炴帴鏁�
- */
- public static final Map<String, ArrayList<WebSocketServer>> sessionMap = new ConcurrentHashMap<>();
-
- String username;
- Session session;
-
- public WebSocketServer() {
- this.messages = new ArrayList<>();
- }
-
- /**
- * 杩炴帴寤虹珛鎴愬姛璋冪敤鐨勬柟娉�
- */
- @OnOpen
- public void onOpen(Session session, @PathParam("username") String username) {
- this.username = username;
- this.session = session;
- List<WebSocketServer> webSocketServers = sessionMap.get(username);
- if (webSocketServers == null) {
- ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>();
- arrayListwebserver.add(this);
- sessionMap.put(username, arrayListwebserver);
- } else {
- webSocketServers.add(this);
- }
-
- log.info("鏈夋柊鐢ㄦ埛鍔犲叆锛寀sername={}, 褰撳墠鍦ㄧ嚎浜烘暟涓猴細{}", username, sessionMap.get(username).size());
-
- // JSONObject result = new JSONObject();
- // JSONArray array = new JSONArray();
- // result.set("users", array);
- // for (Object key : sessionMap.keySet()) {
- // JSONObject jsonObject = new JSONObject();
- // jsonObject.set("username", key);
- // array.add(jsonObject);
- // }
-
- // sendAllMessage(JSONUtil.toJsonStr(result)); // 鍚庡彴鍙戦�佹秷鎭粰鎵�鏈夌殑瀹㈡埛绔�
- }
-
- /**
- * 杩炴帴鍏抽棴璋冪敤鐨勬柟娉�
- */
- @OnClose
- public void onClose(Session session, @PathParam("username") String username) {
- List<WebSocketServer> webSocketServers = sessionMap.get(username);
- ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>();
- if (webSocketServers.size() > 1) {
- for (WebSocketServer webSocketServer : webSocketServers) {
- if (webSocketServer != this) {
- arrayListwebserver.add(webSocketServer);
- }
- }
- sessionMap.put(username, arrayListwebserver);
- log.info("绉婚櫎username={}涓�鍚嶇敤鎴穝ession, {}鐨勫綋鍓嶅湪绾夸汉鏁颁负锛歿}", username, username, sessionMap.get(username).size());
- } else {
- sessionMap.remove(username);
- log.info("绉婚櫎username={}涓�鍚嶇敤鎴穝ession, {}杩炴帴鍏抽棴, 褰撳墠杩炴帴鏁颁负锛歿}", username, username, sessionMap.size());
- }
-
- }
-
- /**
- * 鏀跺埌瀹㈡埛绔秷鎭悗璋冪敤鐨勬柟娉�
- * 鍚庡彴鏀跺埌瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
- * onMessage 鏄竴涓秷鎭殑涓浆绔�
- * 鎺ュ彈 娴忚鍣ㄧ socket.send 鍙戦�佽繃鏉ョ殑 json鏁版嵁
- *
- * @param message 瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
- */
- @OnMessage
- public void onMessage(String message, Session session, @PathParam("username") String username) {
- log.info("鏈嶅姟绔敹鍒扮敤鎴穟sername={}鐨勬秷鎭�:{}", username, message);
- JSONObject obj = JSONUtil.parseObj(message);
- String text = obj.getStr("data");
-
- JSONObject jsonObject = new JSONObject();
- jsonObject.set("message", text);
- this.messages.add(text);
- this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject)
-
- }
-
- @OnError
- public void onError(Session session, Throwable error) {
- log.error("鍙戠敓閿欒");
- error.printStackTrace();
- }
-
- /**
- * 鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔�
- */
- public void sendMessage(String message) {
- try {
- // log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
- this.session.getBasicRemote().sendText(message);
- } catch (Exception e) {
- log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
- }
- }
-
- // /**
- // * 鏈嶅姟绔彂閫佹秷鎭粰鎵�鏈夊鎴风
- // */
- // public void sendAllMessage(String message) {
- // try {
- // for (WebSocketServer webSocketServer : sessionMap.values()) {
- // // log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
- // webSocketServer.sendMessage(message);
- // }
- // } catch (Exception e) {
- // log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
- // }
- // }
-
- public List<String> getMessages() {
- return messages;
-
- }
-
- public void clearMessages() {
- messages.clear();
- }
-
-
-}
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java
index 6b9a536..322ebc0 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java
@@ -11,13 +11,14 @@
import com.mes.pp.mapper.OptimizeProjectMapper;
import com.mes.uppattenusage.entity.OptimizeUpPattenUsage;
import com.mes.uppattenusage.entity.UpPattenUsage;
-import com.mes.uppattenusage.service.UpPattenUsageService;
import com.mes.uppattenusage.mapper.UpPattenUsageMapper;
+import com.mes.uppattenusage.service.UpPattenUsageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
/**
* <p>
@@ -57,7 +58,7 @@
List<OptimizeUpPattenUsage> upPattenUsageList = null;
if (engineeringId != null) {
upPattenUsageList = optimizeProjectMapper.selectJoinList(OptimizeUpPattenUsage.class, new MPJQueryWrapper<OptimizeProject>()
- .select("t.project_no,t.glass_type,b.width,b.height,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.stock_id")
+ .select("t.project_no,t.glass_type,b.realwidth as width,b.realheight as height ,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.stock_id")
.leftJoin("optimize_layout b on t.project_no=b.project_no")
.eq("b.project_no", engineeringId));
}
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/entity/GlassInfo.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/entity/GlassInfo.java
deleted file mode 100644
index 78ccdb5..0000000
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/entity/GlassInfo.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package com.mes.workstation.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * <p>
- *
- * </p>
- *
- * @author zhoush
- * @since 2024-04-07
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class GlassInfo implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 鐜荤拑淇℃伅琛╥d
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 娴佺▼鍗�
- */
- private String flowcardId;
-
- /**
- * 娴佺▼鍗$幓鐠冪被鍨�
- */
- private Integer glassType;
-
- /**
- * 瀹�
- */
- private Double width;
-
- /**
- * 楂�
- */
- private Double height;
-
- /**
- * 鍘氬害
- */
- private Double thickness;
-
- /**
- * 鑶滅郴
- */
- private Integer filmsid;
-
- /**
- * 纾ㄥ墠瀹�
- */
- private Double edgWidth;
-
- /**
- * 纾ㄥ墠楂�
- */
- private Double edgHeight;
-
- /**
- * 鏄惁閰嶇墖
- */
- private Integer ismultiple;
-
- /**
- * 閰嶇墖鏈�澶у
- */
- private Double maxWidth;
-
- /**
- * 閰嶇墖鏈�澶ч珮
- */
- private Double maxHeight;
-
- /**
- * 閽㈠寲鏄惁鎺ュ彈妯斁
- */
- private Integer ishorizontal;
-
- /**
- * 鍘熺墖椤哄簭
- */
- private Integer patternSequence;
-
- /**
- * 閽㈠寲鐗堝浘id
- */
- private Integer temperingLayoutId;
-
- /**
- * 閽㈠寲鐗堝浘鐗囧簭
- */
- private Integer temperingFeedSequence;
-
- /**
- * x鍧愭爣
- */
- private Integer xCoordinate;
-
- /**
- * y鍧愭爣
- */
- private Integer yCoordinate;
-
- /**
- * 鏃嬭浆瑙掑害锛堥�嗘椂閽堬級
- */
- private Integer angle;
-
- /**
- * 宸ョ▼鍙�
- */
- private Long engineerId;
-
- /**
- * 鐢熶骇瑙勫垯id
- */
- private Integer ruleId;
-
-
-}
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 9949483..a9d15bf 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
@@ -90,8 +90,8 @@
@Override
public String updateMesInkageLoad(short inKageWord) {
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
- log.info("淇敼璁惧涓ゆ爧璇锋眰涓簕}锛�0鑱旂嚎锛�1鑱斿姩", inKageWord);
- S7object.getinstance().plccontrol.WriteWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord);
+ log.info("淇敼璁惧鑱斿姩璇锋眰涓簕}锛�0绂荤嚎锛�1鑱斿姩", inKageWord);
+ S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord);
return "success";
}
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
index 625cc04..94840e1 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
@@ -7,5 +7,5 @@
name: loadGlass
mybatis-plus:
mapper-locations: classpath*:mapper/*.xml
-# configuration:
-# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 鎵撳嵃sql璇彞
\ No newline at end of file
+ configuration:
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/temperingglass/entity/GlassInfo.java b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/temperingglass/entity/GlassInfo.java
deleted file mode 100644
index 9ca72f2..0000000
--- a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/temperingglass/entity/GlassInfo.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package com.mes.temperingglass.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * <p>
- *
- * </p>
- *
- * @author zhoush
- * @since 2024-04-07
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class GlassInfo implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 鐜荤拑淇℃伅琛╥d
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 娴佺▼鍗�
- */
- private String flowcardId;
-
- /**
- * 娴佺▼鍗$幓鐠冪被鍨�
- */
- private Integer glassType;
-
- /**
- * 瀹�
- */
- private Double width;
-
- /**
- * 楂�
- */
- private Double height;
-
- /**
- * 鍘氬害
- */
- private Double thickness;
-
- /**
- * 鑶滅郴
- */
- private Integer filmsid;
-
- /**
- * 纾ㄥ墠瀹�
- */
- private Double edgWidth;
-
- /**
- * 纾ㄥ墠楂�
- */
- private Double edgHeight;
-
- /**
- * 鏄惁閰嶇墖
- */
- private Integer ismultiple;
-
- /**
- * 閰嶇墖鏈�澶у
- */
- private Double maxWidth;
-
- /**
- * 閰嶇墖鏈�澶ч珮
- */
- private Double maxHeight;
-
- /**
- * 閽㈠寲鏄惁鎺ュ彈妯斁
- */
- private Integer ishorizontal;
-
- /**
- * 鍘熺墖椤哄簭
- */
- private Integer patternSequence;
-
- /**
- * 閽㈠寲鐗堝浘id
- */
- private Integer temperingLayoutId;
-
- /**
- * 閽㈠寲鐗堝浘鐗囧簭
- */
- private Integer temperingFeedSequence;
-
- /**
- * x鍧愭爣
- */
- private Integer xCoordinate;
-
- /**
- * y鍧愭爣
- */
- private Integer yCoordinate;
-
- /**
- * 鏃嬭浆瑙掑害锛堥�嗘椂閽堬級
- */
- private Integer angle;
-
- /**
- * 宸ョ▼鍙�
- */
- private Long engineerId;
-
- /**
- * 鐢熶骇瑙勫垯id
- */
- private Integer ruleId;
-
-
-}
diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/temperingglass/service/TemperingService.java b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/temperingglass/service/TemperingService.java
index f122d7d..bd7cb05 100644
--- a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/temperingglass/service/TemperingService.java
+++ b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/temperingglass/service/TemperingService.java
@@ -25,8 +25,8 @@
// }
//鍙戦�佸潗鏍囦俊鎭�
public void SendCoordinate(short glassX, short glassY) {
- s7control.WriteWord("DB100.10", glassX);
- s7control.WriteWord("DB100.10", glassY);
+ s7control.writeWord("DB100.10", glassX);
+ s7control.writeWord("DB100.10", glassY);
}
//鍒ゆ柇鏄惁鍙互鍙戦�佽繘鐐変俊鍙�
@@ -41,12 +41,12 @@
//鍙戦�佽繘鐐変俊鍙�
public void SendIntoGlass(short start) {
- s7control.WriteWord("DB100.10", start);
+ s7control.writeWord("DB100.10", start);
}
//鎺ュ彈瀹屾垚瀛楀洖澶嶇‘璁ゅ瓧
public void SendIntoGlass() {
- s7control.WriteWord("DB100.10", (short) 1);
+ s7control.writeWord("DB100.10", (short) 1);
}
//鏄剧ず绛夊緟涓殑鐗堝浘
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml b/hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml
index f447221..c9fd5bc 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml
@@ -30,7 +30,6 @@
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
-
</dependencies>
<properties>
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/AppRunnerConfig.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/AppRunnerConfig.java
index ddac7f5..252ad6f 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/AppRunnerConfig.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/AppRunnerConfig.java
@@ -20,7 +20,7 @@
@Override
public void run(ApplicationArguments args) throws Exception {
log.info("鍚姩瀹屾垚");
- S7object.getinstance().start();
+ //S7object.getinstance().start();
}
}
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
index 9ce9047..fba11e1 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
@@ -1,12 +1,10 @@
package com.mes;
-import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@@ -23,11 +21,8 @@
@EnableScheduling
public class UnLoadGlassApplication {
-
public static void main(String[] args) {
- SpringApplication springApplication = new SpringApplication(UnLoadGlassApplication.class);
- ConfigurableApplicationContext applicationContext = springApplication.run(args);
- WebSocketServer.setApplicationContext(applicationContext);
+ SpringApplication.run(UnLoadGlassApplication.class, args);
}
}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java
index 92f56b5..15b3372 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java
@@ -51,7 +51,7 @@
e.printStackTrace();
}
- byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength());
+ byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
PlcMesObject.setPlcParameterList(getplcvlues);
}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
index 3cd3349..e5bf336 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
@@ -1,23 +1,12 @@
package com.mes.downglassinfo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.downglassinfo.entity.DownGlassInfo;
-import com.mes.downglassinfo.entity.DownGlassTask;
import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
import com.mes.downglassinfo.service.DownGlassInfoService;
-import com.mes.downglassinfo.service.DownGlassTaskService;
-import com.mes.downworkstation.entity.DownWorkstation;
-import com.mes.downworkstation.mapper.DownWorkstationMapper;
-import com.mes.downworkstation.service.DownWorkstationService;
-import com.mes.downworkstation.service.DownWorkstationTaskService;
-import com.mes.tools.WebSocketServer;
-import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
-
-import java.util.List;
@Service
public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService {
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassTaskServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassTaskServiceImpl.java
index df1f641..d145b2c 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassTaskServiceImpl.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassTaskServiceImpl.java
@@ -29,7 +29,7 @@
@Override
public List<DownGlassTask> getUnloadingTaskState() {
QueryWrapper<DownGlassTask> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("task_stauts", 0);
+ queryWrapper.eq("task_stauts", 0).eq("task_type", 2).or().eq("task_stauts", 3);
return baseMapper.selectList(queryWrapper);
}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
index 173056a..ba78936 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
@@ -2,6 +2,7 @@
import com.github.yulichang.base.MPJBaseService;
import com.mes.downstorage.entity.DownStorageCageDetails;
+import com.mes.glassinfo.entity.GlassInfo;
import java.util.List;
import java.util.Map;
@@ -52,4 +53,10 @@
*/
List<DownStorageCageDetails> CacheOut1(int start, int end);
+
+
+ /**
+ * @return 鐩撮�氭煡璇�
+ */
+ List<GlassInfo> DirectConnection();
}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
index f94df84..225e002 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
@@ -160,6 +160,27 @@
//
// }
+ @Override
+ public List<GlassInfo> DirectConnection(){
+ LambdaQueryWrapper<GlassInfo> queryWrapper2 = Wrappers.lambdaQuery();
+ queryWrapper2.select(GlassInfo::getFlowCardId,
+ GlassInfo::getGlassId,
+ GlassInfo::getTemperingLayoutId,
+ GlassInfo::getTemperingFeedSequence)
+ .notInSql(GlassInfo::getGlassId, "SELECT glass_id FROM down_glass_info")
+ .orderByAsc(GlassInfo::getTemperingLayoutId)
+ .orderByDesc(GlassInfo::getTemperingFeedSequence)
+ .last("LIMIT 1");
+
+ // 鏌ヨ GlassInfo 琛�
+ log.info("鐩撮�氭煡璇�");
+ return glassInfoMapper.selectList(queryWrapper2);
+
+ };
+
+
+
+
@Override
public List<DownStorageCageDetails> CacheOut1(int start, int end) {
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
index d6f8f74..40f9793 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
@@ -149,7 +149,7 @@
}
}
- @ApiOperation("鑾峰彇宸ヤ綅鏄剧ず鍥�1")
+ @ApiOperation("鑾峰彇宸ヤ綅鏄剧ず鍥�2")
@GetMapping("/getwo2")
public ResponseEntity<Map<String, Object>> getw2o() {
Map<String, Object> responseData = new HashMap<>();
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
deleted file mode 100644
index 56172d8..0000000
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package com.mes.glassinfo.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.io.Serializable;
-
-/**
- * <p>
- *
- * </p>
- *
- * @author zhoush
- * @since 2024-03-27
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class GlassInfo implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 鐜荤拑淇℃伅琛╥d
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 娴佺▼鍗�
- */
- @TableField("flow_card_Id")
- private String flowCardId;
-
- /**
- * 娴佺▼鍗$幓鐠冪被鍨�
- */
- private Integer glassType;
-
- /**
- * 瀹�
- */
- private Double width;
-
- /**
- * 楂�
- */
- private Double height;
-
- /**
- * 鍘氬害
- */
- private Double thickness;
-
- /**
- * 鑶滅郴
- */
- private String filmsid;
-
- /**
- * 纾ㄥ墠瀹�
- */
- private Double edgWidth;
-
- /**
- * 纾ㄥ墠楂�
- */
- private Double edgHeight;
-
- /**
- * 鏄惁閰嶇墖
- */
- private Integer ismultiple;
-
- /**
- * 閰嶇墖鏈�澶у
- */
- private Double maxWidth;
-
- /**
- * 閰嶇墖鏈�澶ч珮
- */
- private Double maxHeight;
-
- /**
- * 閽㈠寲鏄惁鎺ュ彈妯斁
- */
- private Integer ishorizontal;
-
- /**
- * 鍘熺墖椤哄簭
- */
- private Integer patternSequence;
-
- /**
- * 閽㈠寲鐗堝浘id
- */
- private Integer temperingLayoutId;
-
- /**
- * 閽㈠寲鐗堝浘鐗囧簭
- */
- private Integer temperingFeedSequence;
-
- /**
- * x鍧愭爣
- */
- private Integer xCoordinate;
-
- /**
- * y鍧愭爣
- */
- private Integer yCoordinate;
-
- /**
- * 鏃嬭浆瑙掑害锛堥�嗘椂閽堬級
- */
- private Integer angle;
-
- /**
- * 宸ョ▼鍙�
- */
- private String engineerId;
-
- /**
- * 鐢熶骇瑙勫垯id
- */
- private Integer ruleId;
- /**
- * 鐜荤拑id
- */
- private String glassId;
-}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
index 69b61b3..8be3a8d 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
@@ -1,34 +1,23 @@
package com.mes.job;
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.mes.common.S7object;
-import com.mes.common.config.Const;
-import com.mes.device.PlcParameterObject;
import com.mes.downglassinfo.entity.DownGlassInfo;
-import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
+import com.mes.downglassinfo.entity.DownGlassTask;
import com.mes.downglassinfo.service.DownGlassInfoService;
-import com.mes.downstorage.entity.DownStorageCage;
+import com.mes.downglassinfo.service.DownGlassTaskService;
import com.mes.downstorage.entity.DownStorageCageDetails;
import com.mes.downstorage.service.DownStorageCageDetailsService;
import com.mes.downstorage.service.DownStorageCageService;
import com.mes.downworkstation.entity.DownWorkstation;
-import com.mes.downworkstation.entity.DownWorkstationTask;
import com.mes.downworkstation.service.DownWorkstationService;
import com.mes.downworkstation.service.DownWorkstationTaskService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
-import com.mes.downglassinfo.entity.DownGlassTask;
-import com.mes.downglassinfo.service.DownGlassTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
-import java.util.Date;
import java.util.List;
/**
@@ -63,7 +52,7 @@
// @Value("${mes.threshold}")
private int threshold;
- //@Scheduled(fixedDelay = 1000)
+ // @Scheduled(fixedDelay = 1000)
public void plcdownGlassTask() {
// PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
// String taskRequestTypeValue = plcParameterObject.getPlcParameter("A06_request_word").getValue();
@@ -74,14 +63,14 @@
// String G06RobotTaskRequestWord = plcParameterObject.getPlcParameter("G06RobotTaskRequestWord").getAddress();
- String taskRequestTypeValue ="3";
+ String taskRequestTypeValue ="0";
String glassIdeValue ="NG24041101C002-2-6-1-6";
String confirmationWrodValue ="1";
String outGlassstate="1";
String confirmationWrodAddress="1";
- String G11RobotTaskRequestWord ="1";
- String G06RobotTaskRequestWord ="1";
- String G13RobotTaskRequestWord ="1";
+ String G11RobotTaskRequestWord ="0";
+ String G06RobotTaskRequestWord ="0";
+ String G13RobotTaskRequestWord ="0";
log.info("1銆佽幏鍙栧埌鐨勮姹傚瓧涓猴細{}锛岃幏鍙栧埌鐨勬壂鎻廔D涓猴細{}锛岃幏鍙栧埌鐨勭‘璁ゅ瓧涓猴細{}锛岃幏鍙栧埌鐨勫嚭鐗囩姸鎬佷负锛歿}",
taskRequestTypeValue, glassIdeValue, confirmationWrodValue, outGlassstate);
@@ -127,6 +116,8 @@
+
+
}
/**
@@ -144,9 +135,19 @@
}
log.info("2銆佽幏鍙栧埌鐨勭幓鐠冧俊鎭负{}", glassInfo);
-// if(glassInfo.getFlowCardId()=){
-//
-// }
+ if (glassInfo.getGlassId().equals(downStorageCageDetailsService.DirectConnection()) ) {
+ //鐩撮��
+ log.info("3銆佸鏋滃綋鍓嶇幓鐠冨睘浜庣増鍥緄d鍜岀墖搴忕殑椤哄簭鍒欑洿閫氾紝鎵ц涓嬬墖浠诲姟");
+ DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, glassInfo.getFlowCardId()));
+ int WorkstationId=downWorkstation.getWorkstationId();
+ DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, "0", String.valueOf(WorkstationId), "3");
+ downGlassTaskService.insertCacheTask(downGlassTask);
+
+ }else{
+
+ log.info("4銆佸鏋滀笉灞炰簬鐗堝浘id鍜岀墖搴忕殑椤哄簭鎵ц杩涚墖浠诲姟");
+
+
//娣诲姞杩涚墖浠诲姟 鏌ユ壘绌烘牸
List<DownStorageCageDetails> list = downStorageCageService.selectCacheEmpty();
if(list.size()>0){
@@ -154,8 +155,8 @@
- log.info("3銆佹煡璇㈠崸寮忕悊鐗囩閲岄潰鐨勭┖鏍�:{}", list);
- log.info("4銆佸皢鐜荤拑淇℃伅鎻掑叆鍗у紡鐞嗙墖绗�,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
+ log.info("5銆佹煡璇㈠崸寮忕悊鐗囩閲岄潰鐨勭┖鏍�:{}", list);
+ log.info("6銆佸皢鐜荤拑淇℃伅鎻掑叆鍗у紡鐞嗙墖绗�,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
DownStorageCageDetails details = new DownStorageCageDetails();
BeanUtils.copyProperties(glassInfo, details);
details.setState(1);
@@ -163,17 +164,19 @@
details.setSlot(item.getSlot());
details.setDeviceId(item.getDeviceId());
downStorageCageDetailsService.save(details);
- log.info("5銆佺幓鐠冧俊鎭凡瀛樺叆鐞嗙墖绗艰鎯呰〃锛岀幓鐠冧俊鎭负{}", details);
+ log.info("7銆佺幓鐠冧俊鎭凡瀛樺叆鐞嗙墖绗艰鎯呰〃锛岀幓鐠冧俊鎭负{}", details);
DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, "0", item.getSlot() + "", "1");
//娣诲姞杩涚墖浠诲姟
- log.info("6銆佺敓鎴愯繘鐗囦换鍔′俊鎭瓨鍏ヤ换鍔¤〃{}", downGlassTask);
+ log.info("8銆佺敓鎴愯繘鐗囦换鍔′俊鎭瓨鍏ヤ换鍔¤〃{}", downGlassTask);
downGlassTaskService.insertCacheTask(downGlassTask);
}
+
+
+
+ }
+ log.info("9銆佸彂閫佺‘璁ゅ瓧瀹屾垚");
//S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1);
- log.info("7銆佸彂閫佺‘璁ゅ瓧瀹屾垚");
-
-
}
/**
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
new file mode 100644
index 0000000..308599c
--- /dev/null
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
@@ -0,0 +1,68 @@
+package com.mes.job;
+
+import cn.hutool.json.JSONObject;
+import com.mes.downworkstation.entity.DownWorkstation;
+import com.mes.downworkstation.service.DownWorkstationService;
+import com.mes.tools.WebSocketServer;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Component
+public class Downpush {
+
+
+ @Autowired
+ private DownWorkstationService downWorkstationService;
+ @Scheduled(fixedDelay = 1000)
+ public void Downpush() {
+
+
+ JSONObject jsonObject = new JSONObject();
+ JSONObject jsonObject2 = new JSONObject();
+ JSONObject jsonObject3 = new JSONObject();
+
+ List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,6);
+ List<Map<String, Object>> glassinfodata = downWorkstationService.getTotalGlassDimensionsByWorkstation(1,3);
+ List<Map<String, Object>> glassinfodata2 = downWorkstationService.getTotalGlassDimensionsByWorkstation(4,6);
+ jsonObject.append("params",data);
+ jsonObject2.append("glassinfo",glassinfodata);
+ jsonObject3.append("glassinfo2",glassinfodata2);
+ log.info(jsonObject.toString());
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
+ ArrayList<WebSocketServer> sendwServer2 = WebSocketServer.sessionMap.get("unloadglass2");
+ ArrayList<WebSocketServer> sendwServer3 = WebSocketServer.sessionMap.get("unloadglass3");
+ // log.info(sendwServer.toString());
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+
+ if (webserver != null&&webserver.session.isOpen()) {
+ webserver.sendMessage(jsonObject.toString());
+ }
+ }
+ }
+ if (sendwServer2 != null) {
+ for (WebSocketServer webserver : sendwServer2) {
+
+ if (webserver != null&&webserver.session.isOpen()) {
+ webserver.sendMessage(jsonObject2.toString());
+ }
+ }
+ }
+ if (sendwServer3 != null) {
+ for (WebSocketServer webserver : sendwServer3) {
+
+ if (webserver != null&&webserver.session.isOpen()) {
+ webserver.sendMessage(jsonObject3.toString());
+ }
+ }
+ }
+
+ }
+}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/WebSocketServer.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/WebSocketServer.java
deleted file mode 100644
index fcd2a10..0000000
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/WebSocketServer.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package com.mes.tools;
-
-import cn.hutool.json.JSONObject;
-import cn.hutool.json.JSONUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.stereotype.Component;
-
-import javax.websocket.*;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-@ServerEndpoint(value = "/api/talk/{username}")
-@Component("webSocketServer")
-public class WebSocketServer {
-
- // @Autowired
- // HomeMapper homeMapper;
-
- public static ConfigurableApplicationContext applicationContext;
-
- // 瑙e喅鏃犳硶娉ㄥ叆mapper闂 //浣跨敤鏂规硶
- // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class);
- public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) {
- WebSocketServer.applicationContext = configurableApplicationContext;
- }
-
- private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
- private List<String> messages;
- /**
- * 璁板綍褰撳墠鍦ㄧ嚎杩炴帴鏁�
- */
- public static final Map<String, ArrayList<WebSocketServer>> sessionMap = new ConcurrentHashMap<>();
-
- String username;
- Session session;
-
- public WebSocketServer() {
- this.messages = new ArrayList<>();
- }
-
- /**
- * 杩炴帴寤虹珛鎴愬姛璋冪敤鐨勬柟娉�
- */
- @OnOpen
- public void onOpen(Session session, @PathParam("username") String username) {
- this.username = username;
- this.session = session;
- List<WebSocketServer> webSocketServers = sessionMap.get(username);
- if (webSocketServers == null) {
- ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>();
- arrayListwebserver.add(this);
- sessionMap.put(username, arrayListwebserver);
- } else {
- webSocketServers.add(this);
- }
-
- log.info("鏈夋柊鐢ㄦ埛鍔犲叆锛寀sername={}, 褰撳墠鍦ㄧ嚎浜烘暟涓猴細{}", username, sessionMap.get(username).size());
-
- // JSONObject result = new JSONObject();
- // JSONArray array = new JSONArray();
- // result.set("users", array);
- // for (Object key : sessionMap.keySet()) {
- // JSONObject jsonObject = new JSONObject();
- // jsonObject.set("username", key);
- // array.add(jsonObject);
- // }
-
- // sendAllMessage(JSONUtil.toJsonStr(result)); // 鍚庡彴鍙戦�佹秷鎭粰鎵�鏈夌殑瀹㈡埛绔�
- }
-
- /**
- * 杩炴帴鍏抽棴璋冪敤鐨勬柟娉�
- */
- @OnClose
- public void onClose(Session session, @PathParam("username") String username) {
- List<WebSocketServer> webSocketServers = sessionMap.get(username);
- ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>();
- if (webSocketServers.size() > 1) {
- for (WebSocketServer webSocketServer : webSocketServers) {
- if (webSocketServer != this) {
- arrayListwebserver.add(webSocketServer);
- }
- }
- sessionMap.put(username, arrayListwebserver);
- log.info("绉婚櫎username={}涓�鍚嶇敤鎴穝ession, {}鐨勫綋鍓嶅湪绾夸汉鏁颁负锛歿}", username, username, sessionMap.get(username).size());
- } else {
- sessionMap.remove(username);
- log.info("绉婚櫎username={}涓�鍚嶇敤鎴穝ession, {}杩炴帴鍏抽棴, 褰撳墠杩炴帴鏁颁负锛歿}", username, username, sessionMap.size());
- }
-
- }
-
- /**
- * 鏀跺埌瀹㈡埛绔秷鎭悗璋冪敤鐨勬柟娉�
- * 鍚庡彴鏀跺埌瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
- * onMessage 鏄竴涓秷鎭殑涓浆绔�
- * 鎺ュ彈 娴忚鍣ㄧ socket.send 鍙戦�佽繃鏉ョ殑 json鏁版嵁
- *
- * @param message 瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
- */
- @OnMessage
- public void onMessage(String message, Session session, @PathParam("username") String username) {
- log.info("鏈嶅姟绔敹鍒扮敤鎴穟sername={}鐨勬秷鎭�:{}", username, message);
- JSONObject obj = JSONUtil.parseObj(message);
- String text = obj.getStr("data");
-
- JSONObject jsonObject = new JSONObject();
- jsonObject.set("message", text);
- this.messages.add(text);
- this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject)
-
- }
-
- @OnError
- public void onError(Session session, Throwable error) {
- log.error("鍙戠敓閿欒");
- error.printStackTrace();
- }
-
- /**
- * 鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔�
- */
- public void sendMessage(String message) {
- try {
- // log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
- this.session.getBasicRemote().sendText(message);
- } catch (Exception e) {
- log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
- }
- }
-
- // /**
- // * 鏈嶅姟绔彂閫佹秷鎭粰鎵�鏈夊鎴风
- // */
- // public void sendAllMessage(String message) {
- // try {
- // for (WebSocketServer webSocketServer : sessionMap.values()) {
- // // log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
- // webSocketServer.sendMessage(message);
- // }
- // } catch (Exception e) {
- // log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
- // }
- // }
-
- public List<String> getMessages() {
- return messages;
-
- }
-
- public void clearMessages() {
- messages.clear();
- }
-
-
-}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
index 90f92f5..5d44c2f 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
@@ -6,6 +6,8 @@
active: prod
application:
name: unLoadGlass
+
+
mybatis-plus:
mapper-locations: classpath*:mapper/*.xml
configuration:
--
Gitblit v1.8.0