Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
# Conflicts:
# CanadaMes-ui/src/views/Electrical/Parameter2.vue
# CanadaMes-ui/src/views/home/index.vue
# springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
| | |
| | | {
|
| | | |
| | | "ip": "192.168.10.21",
|
| | | "systemTitle": "Login System",
|
| | | "usernamePlaceholder": "Please enter username",
|
| | | "passwordPlaceholder": "Please enter password",
|
| | |
| | | "B01手动格子": "B01 Target grid(Manual)",
|
| | | "B01定位速度": "B01 TRAVEL POS Velocity manual",
|
| | | "B01当前格子": "B01 Current Grid",
|
| | | "B01启动": "Start",
|
| | | "B01启动": "B01 Start",
|
| | | "复位": "Reset",
|
| | | "回零": "Zero",
|
| | | "未回零": "NotZero",
|
| | | "B02手动格子": "B02 Target grid(Manual)",
|
| | | "B02定位速度": "B02 TRAVEL POS Velocity manual",
|
| | | "B02当前格子": "B02 Current Grid",
|
| | | "B02启动": "Start",
|
| | | "B02启动": "B02 Start",
|
| | | "复位": "Reset",
|
| | | "A01实时位置": "A01 tavel Actual Position",
|
| | | "A02实时位置": "A02 tavel Actual Position",
|
| | |
| | | {
|
| | | "ip": "192.168.10.21",
|
| | | "systemTitle": "登录系统",
|
| | | "usernamePlaceholder": "请输入用户名",
|
| | | "passwordPlaceholder": "请输入密码",
|
| | |
| | | } else { |
| | | //console.log("您的浏览器支持WebSocket"); |
| | | |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | if (socket != null) { |
| | | socket.close(); |
| | | socket = null; |
| | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | if (socket != null) { |
| | | socket.close(); |
| | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | if (socket != null) { |
| | | socket.close(); |
| | |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
|
| | | <el-button v-if="item.button && language === 'en-US' && item.state != 0" :name="item.button.name"
|
| | | v-model="item.button.value"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0 }"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0,'greenbutton': item.button.name !== 'NotZero' && item.button.name !== 'Fault' && item.button.value === 1 }"
|
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
|
| | | item.button.name }}</el-button>
|
| | | <el-button v-if="item.button && language === 'zh-CN' && item.state != 0" :name="item.button.name"
|
| | | v-model="item.button.value"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1, 'error-button2': item.button.name === '未回零' && item.button.value === 0 }"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1, 'error-button2': item.button.name === '未回零' && item.button.value === 0,'greenbutton': item.button.name !== '未回零' && item.button.name !== '故障' && item.button.value === 1 }"
|
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
|
| | | item.button.name }}</el-button>
|
| | | </div>
|
| | |
| | | updateButtonValue (dataGroup, itemIndex) {
|
| | | // 将当前按钮的值设为1
|
| | |
|
| | | this.$set(dataGroup[itemIndex].button, 'value', 1);
|
| | | if (dataGroup[itemIndex].button.value === 0) {
|
| | | // 如果当前按钮的值是 0,将其设为 1
|
| | | this.$set(dataGroup[itemIndex].button, 'value', 1);
|
| | | } else {
|
| | | // 否则将其设为 0
|
| | | this.$set(dataGroup[itemIndex].button, 'value', 0);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
| | | if (typeof WebSocket === "undefined") {
|
| | | console.log("您的浏览器不支持WebSocket");
|
| | | } else {
|
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | |
|
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | if (socket != null) {
|
| | | socket.close();
|
| | | socket = null;
|
| | |
| | | .error-button2 {
|
| | | background-color: red;
|
| | | }
|
| | | .greenbutton{
|
| | |
|
| | | background-color: green;
|
| | | }
|
| | | </style> |
| | |
| | | <div class="button-row" style="display: flex; justify-content: space-between;">
|
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
|
| | | <el-button v-if="item.button && language === 'en-US'" :name="item.button.name" v-model="item.button.value"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0 }"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0,'greenbutton': item.button.name !== 'NotZero' && item.button.name !== 'Fault' && item.button.value === 1 }"
|
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
|
| | | item.button.name }}</el-button>
|
| | | <el-button v-if="item.button && language === 'zh-CN'" :name="item.button.name" v-model="item.button.value"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1, 'error-button2': item.button.name === '未回零' && item.button.value === 0 }"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1, 'error-button2': item.button.name === '未回零' && item.button.value === 0,'greenbutton': item.button.name !== '未回零' && item.button.name !== '故障' && item.button.value === 1 }"
|
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
|
| | | item.button.name }}</el-button>
|
| | | </div>
|
| | |
| | | updateButtonValue (dataGroup, itemIndex) {
|
| | | // 将当前按钮的值设为1
|
| | |
|
| | | if (dataGroup[itemIndex].button.value === 1) {
|
| | | if (dataGroup[itemIndex].button.value === 0) {
|
| | | // 如果当前按钮的值是 0,将其设为 1
|
| | | this.$set(dataGroup[itemIndex].button, 'value', 0);
|
| | | this.$set(dataGroup[itemIndex].button, 'value', 1);
|
| | | } else {
|
| | | // 否则将其设为 0
|
| | | this.$set(dataGroup[itemIndex].button, 'value', 1);
|
| | | this.$set(dataGroup[itemIndex].button, 'value', 0);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | if (typeof WebSocket === "undefined") {
|
| | | console.log("您的浏览器不支持WebSocket");
|
| | | } else {
|
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | |
|
| | | if (socket != null) {
|
| | | socket.close();
|
| | |
| | | .error-button2 {
|
| | | background-color: red;
|
| | | }
|
| | | .greenbutton{
|
| | |
|
| | | background-color: green;
|
| | | }
|
| | | </style> |
| | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | if (socket != null) { |
| | | socket.close(); |
| | |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button && language==='en-US'" :name="item.button.name" v-model="item.button.value" class="action-button" |
| | | @click="updateButtonValue(dataGroup, itemIndex);submitDataToBackend(item.button.name)" |
| | | :class="{ 'green-button': (item.button.value === 0 && item.button.name !== 'Clear ID' ) ,'red-button': item.button.value === 2 && (item.button.name !== 'Clear ID' ) ,'yellow-button': item.button.value === 1 && (item.button.name !== 'Clear ID' ) }">{{ item.button.name }}</el-button> |
| | | :class="{ 'green-button': (item.button.value === 0 && item.button.name !== 'Clear ID' ) ,'red-button': item.button.value === 2 && (item.button.name !== 'Clear ID' ) ,'yellow-button': item.button.value === 1 && (item.button.name !== 'Clear ID' ),'id': item.button.value === 1 && (item.button.name == 'Clear ID' ) }">{{ item.button.name }}</el-button> |
| | | |
| | | |
| | | <el-button v-if="item.button && language==='zh-CN'" :name="item.button.name" v-model="item.button.value" class="action-button" |
| | | @click="updateButtonValue(dataGroup, itemIndex);submitDataToBackend(item.button.name)" |
| | | :class="{ 'green-button': (item.button.value === 0 && item.button.name !== '清除ID' ) ,'red-button': item.button.value === 2 && (item.button.name !== '清除ID' ) ,'yellow-button': item.button.value === 1 && (item.button.name !== '清除ID' ) }">{{ item.button.name }}</el-button> |
| | | :class="{ 'green-button': (item.button.value === 0 && item.button.name !== '清除ID' ) ,'red-button': item.button.value === 2 && (item.button.name !== '清除ID' ) ,'yellow-button': item.button.value === 1 && (item.button.name !== '清除ID' ),'id': item.button.value === 1 && (item.button.name == '清除ID' ) }">{{ item.button.name }}</el-button> |
| | | |
| | | </div> |
| | | </div> |
| | |
| | | <script> |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | import data from '../../configuration/parameter2' |
| | | import { throttle } from 'lodash'; |
| | | let socket; |
| | | |
| | | // window.onload=function(){ |
| | |
| | | }, |
| | | |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | if (dataGroup[itemIndex].button.value === 1) { |
| | | if (dataGroup[itemIndex].button.value === 0) { |
| | | // 如果当前按钮的值是 0,将其设为 1 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 0); |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | } else { |
| | | // 否则将其设为 0 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | this.$set(dataGroup[itemIndex].button, 'value', 0); |
| | | } |
| | | }, |
| | | submitDataToBackend(currentButtonName) { |
| | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + "192.168.10.102:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | if (socket != null) { |
| | | socket.close(); |
| | |
| | | // const xiaoche = obj.params[3]; |
| | | |
| | | // console.log(obj); |
| | | |
| | | |
| | | |
| | | const handleMouseMove = throttle(function(event) { |
| | | const inputBox = document.querySelectorAll('.action-button'); |
| | | const target = event.target; |
| | | |
| | | if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) { |
| | | //清除id |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | |
| | | |
| | | |
| | | } |
| | | //改变状态文字 |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | if (obj.type === '4' && obj.button.value===1) { |
| | | if ( obj.button.name.includes("状态")&& this.language==="zh-CN") { |
| | | obj.button.name =obj.button.name.replace("手动","自动") ; |
| | | } |
| | | if ( obj.button.name.includes("Status")) { |
| | | obj.button.name =obj.button.name.replace("Manual","Auto") ; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | //扫描枪扫码的ID |
| | | |
| | | jsonData2.forEach((item) => { |
| | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | // console.log(jsonData2); |
| | | |
| | | }, 50); |
| | | |
| | | document.addEventListener('mouseover', handleMouseMove); |
| | | |
| | | }; |
| | | |
| | |
| | | .yellow-button{ |
| | | background-color: blue; |
| | | } |
| | | .id{ |
| | | |
| | | background-color: green; |
| | | } |
| | | |
| | | </style> |
| | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | if (socket != null) { |
| | | socket.close(); |
| | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | if (socket != null) { |
| | | socket.close(); |
| | |
| | | </el-row> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button && language === 'en-US' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1,'error-button2': item.button.name === 'NotZero' && item.button.value === 0}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | <el-button v-if="item.button && language === 'zh-CN' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1,'error-button2': item.button.name === '未回零' && item.button.value === 0}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | <el-button v-if="item.button && language === 'en-US' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1,'error-button2': item.button.name === 'NotZero' && item.button.value === 0,'fuwei': item.button.name === 'Reset' && item.button.value === 1,'qidong': item.button.name === 'A01 Semi-Auto' && item.button.value === 1,'qidong2': item.button.name === 'A02 Semi-Auto' && item.button.value === 1}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | <el-button v-if="item.button && language === 'zh-CN' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1,'error-button2': item.button.name === '未回零' && item.button.value === 0,'fuwei': item.button.name === '复位' && item.button.value === 1,'qidong': item.button.name === 'A01半自动' && item.button.value === 1,'qidong2': item.button.name === 'A02半自动' && item.button.value === 1 }" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | export default { |
| | | name: "ServoManualone", |
| | | mixins: [LanguageMixin], |
| | | |
| | | |
| | | data() { |
| | | return { |
| | | jsonData: data , |
| | | language:this.$i18n.locale, |
| | | zhi:"1", |
| | | zhi2:"1" |
| | | // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | |
| | | |
| | | |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | // 将其他按钮的值设为0 |
| | | // dataGroup.forEach((item, index) => { |
| | | // if (index !== itemIndex && item.button) { |
| | | // this.$set(item.button, 'value', 0); |
| | | // } |
| | | // }); |
| | | if (dataGroup[itemIndex].button.value === 1) { |
| | | // 如果当前按钮的值是 0,将其设为 1 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 0); |
| | | } else { |
| | | // 否则将其设为 0 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | } |
| | | }, |
| | | submitDataToBackend(currentButtonName) { |
| | | if (currentButtonName === 'A01半自动启动' ||currentButtonName === 'A01 Semi-Auto Start') { |
| | |
| | | data.push(values); |
| | | |
| | | } |
| | | data.push([]); |
| | | data.push([],[], [],); |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | |
| | | } |
| | | data2.unshift([]); |
| | | |
| | | data2.push([], [], []); |
| | | data2.push([], []); |
| | | |
| | | for (let i = 1; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read == 8888).map(item => { |
| | |
| | | const values2 = inputData.map(item => item.value); |
| | | |
| | | data2.push(values2); |
| | | data2.push([], [],[], []); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | const jsonObject = { data:data2 }; |
| | |
| | | |
| | | // 在 data2 数组前面添加两个空数组 |
| | | data2.unshift([], []); |
| | | data2.push([], [], [], [], []); |
| | | |
| | | // 创建 jsonObject2 对象,并添加 data2 属性 |
| | | const jsonObject2 = { data: data2 }; |
| | |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | setTimeout(()=> |
| | | window.location.reload(),2000 |
| | | ) |
| | | // setTimeout(()=> |
| | | // window.location.reload(),2000 |
| | | // ) |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | // 在 data3 数组前面添加两个空数组 |
| | | data3.unshift([], [], []); |
| | | data3.push([], [], [], []); |
| | | |
| | | // 创建 jsonObject2 对象,并添加 data3 属性 |
| | | // 创建 jsonObject3 对象,并添加 data3 属性 |
| | | const jsonObject3 = { data: data3 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString3 = JSON.stringify(jsonObject3); |
| | | console.log('回零:', jsonString3); |
| | | socket?.send(jsonString3); |
| | | setTimeout(()=> |
| | | window.location.reload(),2000 |
| | | ) |
| | | // setTimeout(()=> |
| | | // window.location.reload(),2000 |
| | | // ) |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | if (currentButtonName === 'A01半自动' || currentButtonName === 'A01 Semi-Auto' ) { |
| | | const elements = document.getElementsByClassName('special-class'); |
| | | const data = []; |
| | | |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | | elements[i].style.display = ''; // 显示元素 |
| | | this.zhi=1; |
| | | // if(this.jsonData[0].button.name==='A01半自动' || this.jsonData[0].button.name === 'A01 Semi-Auto'){ |
| | | // this.jsonData[0].button.value=1 |
| | | // } |
| | | |
| | | |
| | | for (let i = 0; i < this.jsonData.length; i++) { |
| | | let arr = this.jsonData[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "A01半自动" || obj2.button.name === "A01 Semi-Auto")) { |
| | | obj2.button.value = 1; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | }else{ |
| | | elements[i].style.display = 'none'; |
| | | this.zhi=0; |
| | | // if(this.jsonData[0].button.name==='A01半自动' || this.jsonData[0].button.name === 'A01 Semi-Auto'){ |
| | | // this.jsonData[0].button.value=0 |
| | | // } |
| | | |
| | | for (let i = 0; i < this.jsonData.length; i++) { |
| | | let arr = this.jsonData[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "A01半自动" || obj2.button.name === "A01 Semi-Auto")) { |
| | | obj2.button.value = 0; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | data.push([this.zhi]); |
| | | |
| | | data.unshift([],[],[],[],[],[]); |
| | | data.push([]); |
| | | |
| | | |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | if (currentButtonName === 'A02半自动' || currentButtonName === 'A02 Semi-Auto' ) { |
| | | const elements = document.getElementsByClassName('special-class2'); |
| | | |
| | | const data = []; |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | | elements[i].style.display = ''; // 显示元素 |
| | | this.zhi2=1; |
| | | for (let i = 0; i < this.jsonData.length; i++) { |
| | | let arr = this.jsonData[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "A02半自动" || obj2.button.name === "A02 Semi-Auto")) { |
| | | obj2.button.value = 1; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | }else{ |
| | | elements[i].style.display = 'none'; |
| | | this.zhi2=0; |
| | | for (let i = 0; i < this.jsonData.length; i++) { |
| | | let arr = this.jsonData[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "A02半自动" || obj2.button.name === "A02 Semi-Auto")) { |
| | | obj2.button.value = 0; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | data.push([this.zhi2]); |
| | | |
| | | data.unshift([],[],[],[],[],[],[]); |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | let socketUrl = "ws://" +this.$t('ip')+ ":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | |
| | | if (socket != null) { |
| | | socket.close(); |
| | |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "故障" || obj2.button.name === "Fault")) { |
| | | obj2.button.value = obj.guzhang[0][i]; |
| | | // console.log(obj2.button.value) |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "复位" || obj2.button.name === "Reset")) { |
| | | obj2.button.value = obj.fuwei[0][i]; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | |
| | | .error-button2 { |
| | | background-color: red; |
| | | } |
| | | .fuwei { |
| | | background-color: green; |
| | | } |
| | | |
| | | .qidong { |
| | | background-color: green; |
| | | } |
| | | |
| | | .qidong2 { |
| | | background-color: green; |
| | | } |
| | | |
| | | |
| | | </style> |
| | |
| | | } else {
|
| | | //console.log("您的浏览器支持WebSocket");
|
| | |
|
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | if (socket != null) {
|
| | | socket.close();
|
| | | socket = null;
|
| | |
| | | } else {
|
| | | //console.log("您的浏览器支持WebSocket");
|
| | |
|
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | if (socket != null) {
|
| | | socket.close();
|
| | | socket = null;
|
| | |
| | | } else { |
| | | //console.log("您的浏览器支持WebSocket"); |
| | | |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | if (socket != null) { |
| | | socket.close(); |
| | | socket = null; |
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | .blocks {
|
| | | transform: scale(1, 1);
|
| | | }
|
| | |
|
| | |
|
| | | .el-dialog {
|
| | | width: 90%;
|
| | | }
|
| | |
| | | console.log("您的浏览器不支持WebSocket");
|
| | | } else {
|
| | | //console.log("您的浏览器支持WebSocket");
|
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | if (socket != null) {
|
| | | socket.close();
|
| | | socket = null;
|
| | |
| | | }
|
| | | if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 1) {
|
| | | this.form3 = obj.form3[0];
|
| | |
|
| | | } else {
|
| | | this.form3 = {};
|
| | | }
|
| | |
| | | },
|
| | | load() {
|
| | | //加载笼子使用情况数据
|
| | | let cookies = document.cookie;
|
| | | var cooks = cookies.split(";")[0];
|
| | | var value = cooks.substring(cooks.indexOf("=") + 1);
|
| | | console.log(value);
|
| | | // let cookie=cookies.split(';'); |
| | | // console.log()
|
| | | // console.log(cookies.get('name'));
|
| | | home().then(res => {
|
| | | this.tableData = res.data.list;
|
| | | });
|
| | |
| | | //判断玻璃是否超出范围
|
| | | Sizerange(Glass) {
|
| | | if ((Glass.glassheight < 380 || Glass.glasswidth < 390 || Glass.glassheight > 1810 || Glass.glasswidth > 2760) || (Glass.glassheight < 390 || Glass.glasswidth < 380 || Glass.glassheight > 2760 || Glass.glasswidth > 1810)) {
|
| | | if (this.disabled == false) {
|
| | | // if (this.disabled == false) {
|
| | | this.disabled = true;
|
| | | this.$message.error(this.$t('The glass size is not within the range'));
|
| | | // this.$message.error(this.$t('The glass size is not within the range'));
|
| | | this.$alert(this.$t('The glass size is not within the range'), this.$t('confirm'), {
|
| | | confirmButtonText: this.$t('Yes'),
|
| | | type:'info',
|
| | | callback: action => {
|
| | | this.$message({
|
| | | type: 'info',
|
| | | message: this.DeleteBarcodeGlass()
|
| | | });
|
| | | action: action
|
| | | }).then(
|
| | | this.DeleteBarcodeGlass()
|
| | | );
|
| | | }
|
| | | });
|
| | | }
|
| | | // }
|
| | | // this.$message(this.$t('The glass size is not within the range'), this.$t('confirm'), {
|
| | | // // confirmwidth: 7000,
|
| | | // // height: 8000,
|
| | |
| | | // message: this.$t('Operation canceled')
|
| | | // });
|
| | | // });
|
| | | // }
|
| | | this.disabled1 = true;
|
| | | } else {
|
| | | // if(isConfirmStates==true){
|
| | | // this.InsertQueueGlass();
|
| | | // }
|
| | | this.disabled1 = false;
|
| | | }
|
| | |
|
| | | },
|
| | | DeleteBarcodeGlass(){
|
| | | this.form5={};
|
| | | // }
|
| | | this.disabled1 = true;
|
| | | } else {
|
| | | this.disabled1 = false;
|
| | | }
|
| | | },
|
| | | DeleteBarcodeGlass(){
|
| | | this.form5={};
|
| | | }
|
| | | }
|
| | | }
|
| | | </script> |
| | |
| | | loginFormRules: { |
| | | // 验证用户名是否合法 |
| | | username: [ |
| | | {required: true, message: '请输入用户名', trigger: 'blur'}, |
| | | {min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur'} |
| | | {required: true, message: this.$t('usernameRequired'), trigger: 'blur'}, |
| | | {min: 5, max: 15, message: this.$t('usernameLength'), trigger: 'blur'} |
| | | ], |
| | | // 验证密码是否合法 |
| | | password: [ |
| | | {required: true, message: '请输入密码', trigger: 'blur'}, |
| | | {min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur'} |
| | | {required: true, message: this.$t('passwordRequired'), trigger: 'blur'}, |
| | | {min: 5, max: 15, message: this.$t('passwordLength'), trigger: 'blur'} |
| | | ] |
| | | } |
| | | } |
| | |
| | | registerForm: {}, |
| | | registerRules: { |
| | | username: [ |
| | | {required: true, message: '请输入用户名', trigger: 'blur'}, |
| | | {min: 5, max: 15, message: '长度在 5 到 5 个字符', trigger: 'blur'} |
| | | {required: true, message: this.$t('usernameRequired'), trigger: 'blur'}, |
| | | {min: 5, max: 15, message: this.$t('usernameLength'), trigger: 'blur'} |
| | | ], |
| | | password1: [ |
| | | {required: true, message: '请输入密码', trigger: 'blur'}, |
| | | {min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur'}, |
| | | {required: true, message: this.$t('passwordRequired'), trigger: 'blur'}, |
| | | {min: 5, max: 15, message: this.$t('passwordLength'), trigger: 'blur'}, |
| | | {validator: validatePassword, trigger: "blur"} |
| | | ], |
| | | password: [ |
| | | {required: true, message: '请输入密码', trigger: 'blur'}, |
| | | {min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur'}, |
| | | {required: true, message: this.$t('passwordRequired'), trigger: 'blur'}, |
| | | {min: 5, max: 15, message: this.$t('passwordLength'), trigger: 'blur'}, |
| | | {validator: validatePassword, trigger: "blur"} |
| | | ], |
| | | email: [ |
| | | {required: false, message: '请输入邮箱', trigger: 'blur'}, |
| | | {type: 'email', message: '请输入正确格式的邮箱地址', trigger: 'blur'} |
| | | {required: false, message: this.$t('langEmailPlaceholder'), trigger: 'blur'}, |
| | | {type: 'email', message: this.$t('langEmailPlaceholder'), trigger: 'blur'} |
| | | ] |
| | | } |
| | | } |
| | |
| | | } |
| | | if (!sValue.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses1, sValue); |
| | | List<String> A01start = new ArrayList<>(); |
| | | A01start.add("DB101.2.2"); |
| | | Boolean[] a01values7 = { true}; |
| | | List<Boolean> a01startval = new ArrayList<>(Arrays.asList(a01values7)); |
| | | S7control.getinstance().WriteBit(A01start, a01startval); |
| | | System.out.println("Values " + sValue + " written to PLC at address " + waddresses1); |
| | | } |
| | | } |
| | |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses2, sValue2); |
| | | List<String> A02start = new ArrayList<>(); |
| | | A02start.add("DB101.2.3"); |
| | | Boolean[] a02values7 = { true}; |
| | | List<Boolean> a01startval = new ArrayList<>(Arrays.asList(a02values7)); |
| | | S7control.getinstance().WriteBit(A02start, a01startval); |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses2); |
| | | } |
| | | } |
| | |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses3, sValue2); |
| | | List<String> B01start = new ArrayList<>(); |
| | | B01start.add("DB101.2.4"); |
| | | Boolean[]B01values7 = { true}; |
| | | List<Boolean> B01startval = new ArrayList<>(Arrays.asList(B01values7)); |
| | | S7control.getinstance().WriteBit(B01start, B01startval); |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses3); |
| | | } |
| | | } |
| | |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses4, sValue2); |
| | | List<String> B02start = new ArrayList<>(); |
| | | B02start.add("DB101.2.5"); |
| | | Boolean[] B02values7 = { true}; |
| | | List<Boolean> B02startval = new ArrayList<>(Arrays.asList(B02values7)); |
| | | S7control.getinstance().WriteBit(B02start, B02startval); |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses4); |
| | | } |
| | | } |
| | |
| | | }
|
| | | if (!sValue.isEmpty()) {
|
| | | S7control.getinstance().WriteWord(waddresses1, sValue);
|
| | | List<String> A01start = new ArrayList<>();
|
| | | A01start.add("DB101.2.0");
|
| | | Boolean[] a01values7 = { true};
|
| | | List<Boolean> a01startval = new ArrayList<>(Arrays.asList(a01values7));
|
| | | S7control.getinstance().WriteBit(A01start, a01startval);
|
| | | System.out.println("Values " + sValue + " written to PLC at address " + waddresses1);
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | if (!sValue2.isEmpty()) {
|
| | | S7control.getinstance().WriteWord(waddresses2, sValue2);
|
| | | List<String> A02start = new ArrayList<>();
|
| | | A02start.add("DB101.2.1");
|
| | | Boolean[] a02values7 = { true};
|
| | | List<Boolean> a01startval = new ArrayList<>(Arrays.asList(a02values7));
|
| | | S7control.getinstance().WriteBit(A02start, a01startval);
|
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses2);
|
| | | }
|
| | | }
|
| | |
| | | import java.io.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | public class PlcParameter2 extends Thread { |
| | |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(500); |
| | | Thread.sleep(1000); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | // 手动状态地址 |
| | | List<String> addressList1 = new ArrayList<>(); |
| | | |
| | | addressList1.add("DB103.44");//D01 |
| | |
| | | List<String> paramlist = S7control.getinstance().readStrings(addressList1); |
| | | |
| | | |
| | | |
| | | //清除ID地址 |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("DB103.0"); |
| | | addresses.add("DB103.2"); |
| | |
| | | addresses.add("DB103.6"); |
| | | List<Short> data = S7control.getinstance().readWords(addresses); |
| | | |
| | | |
| | | //id |
| | | List<String> addressList0 = new ArrayList<>(); |
| | | |
| | | addressList0.add("DB101.9.2"); |
| | |
| | | addresses4.add("DB103.56"); |
| | | addresses4.add("DB103.60"); |
| | | |
| | | List<Short> data4 = S7control.getinstance().readWords(addresses4); |
| | | List<Short> data4 = S7control.getinstance().readWords(addresses4); |
| | | |
| | | // |
| | | // List<Long> TIME2 = Collections.singletonList(S7control.getinstance().readtime("DB100.194")); |
| | | // System.out.println("addressList:" + TIME2); |
| | | |
| | | |
| | | // |
| | | |
| | | |
| | | |
| | | |
| | | // String[] values6 = { ".x1 ","x2 ","x3",";;x4","x5","x6","x7","x8","x9","x10","x11"}; |
| | | // List<String> paramlist = new ArrayList<>(Arrays.asList(values6)); |
| | | // Short[] values1 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
| | |
| | | } |
| | | |
| | | // 将布尔列表写入 PLC |
| | | S7control.getinstance().WriteBit(addressList, messageBooleans); |
| | | // S7control.getinstance().WriteBit(addressList, messageBooleans); |
| | | System.out.println("messageValues:" + messageBooleans); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | |
| | | // Integer Plccount = this.count;
|
| | |
|
| | | // System.out.println(stt);
|
| | | //存片格 出片格读取
|
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.42", 23);
|
| | | // System.out.println(arraylist);
|
| | | // Short[] 存片 = { 1 };
|
| | |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Positioning1");
|
| | | if (webSocketServer != null) {
|
| | | List<String> messages = webSocketServer.getMessages();
|
| | |
|
| | | //存片格 出片格地址
|
| | | String addressList3 = "DB100.42";
|
| | |
|
| | | if (!messages.isEmpty()) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | // 写入第yi个地址
|
| | | // 写入存片格 出片格位置设定数据
|
| | | if (!mergedList.isEmpty()) {
|
| | | S7control.getinstance().WriteWord(addressList3, mergedList);
|
| | | System.out.println("messageValue:" + mergedList + " written to PLC at address " + addressList3);
|
| | |
| | | // Integer Plccount = this.count;
|
| | |
|
| | | // System.out.println(stt);
|
| | | //B01格位置 地址读取
|
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.88", 10);
|
| | |
|
| | | // Short[] values1 = { 1,2, 3, 4, 5 , 11, 12,13,14,15};
|
| | |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Positioning2");
|
| | | if (webSocketServer != null) {
|
| | | List<String> messages = webSocketServer.getMessages();
|
| | |
|
| | | //B01 B02 地址
|
| | | String addressList3 = "DB100.88";
|
| | |
|
| | | if (!messages.isEmpty()) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | // 写入第yi个地址
|
| | | // 写入b01 b02地址
|
| | | if (!mergedList.isEmpty()) {
|
| | | S7control.getinstance().WriteWord(addressList3, mergedList);
|
| | | System.out.println("messageValue:" + mergedList + " written to PLC at address " + addressList3);
|
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | //A01组合中地址表集合 |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("DB103.32"); |
| | | addresses.add("DB100.144"); |
| | |
| | | // int insertIndex = 2; |
| | | // insertDataToList(arraylist, rangeAddress, insertIndex); |
| | | |
| | | |
| | | //A02组合中地址表集合 |
| | | List<String> addresses2 = new ArrayList<>(); |
| | | addresses2.add("DB103.26"); |
| | | addresses2.add("DB100.188"); |
| | |
| | | // int insertIndex2 = 4; |
| | | // insertDataToList(arraylist2, rangeAddress2, insertIndex2); |
| | | // System.out.println(arraylist2); |
| | | |
| | | //A01翻转地址 |
| | | List<String> addresses3 = new ArrayList<>(); |
| | | addresses3.add("DB103.42"); |
| | | List<Short> arraylist3 = S7control.getinstance().readWords(addresses3); |
| | | |
| | | |
| | | //A02翻转地址 |
| | | List<String> addresses4 = new ArrayList<>(); |
| | | addresses4.add("DB103.46"); |
| | | List<Short> arraylist4 = S7control.getinstance().readWords(addresses4); |
| | | |
| | | //B01组合中地址 |
| | | List<Short> arraylist5 = S7control.getinstance().ReadWord("DB103.27", 2); |
| | | //B02组合地址 |
| | | List<Short> arraylist6 = S7control.getinstance().ReadWord("DB103.29", 2); |
| | | |
| | | // 所有故障按钮地址 |
| | | List<String> addresses7 = new ArrayList<>(); |
| | | addresses7.add("DB104.1.4"); |
| | | addresses7.add("DB104.1.5"); |
| | |
| | | addresses7.add("DB104.1.7"); |
| | | List<Boolean> arraylist7 = S7control.getinstance().readBits(addresses7); |
| | | |
| | | |
| | | // 所有故障按钮转换为1和0 |
| | | short[] params2 = new short[arraylist7.size()]; |
| | | for (int i = 0; i < arraylist7.size(); i++) { |
| | | boolean value = arraylist7.get(i); |
| | | params2[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | |
| | | |
| | | // 所有复位按钮地址 |
| | | List<String> Reset = new ArrayList<>(); |
| | | Reset.add("DB101.4.0"); |
| | | Reset.add("DB101.4.3"); |
| | | Reset.add("DB101.3.6"); |
| | | Reset.add("DB101.4.1"); |
| | | Reset.add("DB101.4.4"); |
| | | Reset.add("DB101.4.6"); |
| | | List<Boolean> Reset1 = S7control.getinstance().readBits(Reset); |
| | | |
| | | // 所有故障按钮转换为1和0 |
| | | short[] rReset = new short[Reset1.size()]; |
| | | for (int i = 0; i < Reset1.size(); i++) { |
| | | boolean value = Reset1.get(i); |
| | | rReset[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | |
| | | // 所有未回零按钮地址 |
| | | List<String> addresses8 = new ArrayList<>(); |
| | | addresses8.add("DB104.9.0"); |
| | | addresses8.add("DB104.9.1"); |
| | |
| | | params[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | |
| | | |
| | | // 进片id地址 |
| | | StringBuilder queueid1 = queGlassid("DB100.148", 14); |
| | | // 存片id地址 |
| | | StringBuilder queueid2 = queGlassid("DB100.162", 14); |
| | | |
| | | |
| | |
| | | jsonObject.append("weihuiling", params); |
| | | jsonObject.append("jinpianid", queueid1); |
| | | jsonObject.append("qupianid", queueid2); |
| | | jsonObject.append("fuwei", rReset); |
| | | |
| | | |
| | | |
| | |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("ServoManualone"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | // A01组合地址 |
| | | List<String> waddresses1 = new ArrayList<>(); |
| | | waddresses1.add("DB103.32"); |
| | | waddresses1.add("DB100.144"); |
| | |
| | | waddresses1.add("DB100.180"); |
| | | waddresses1.add("DB100.182"); |
| | | |
| | | // A02组合地址 |
| | | List<String> waddresses2 = new ArrayList<>(); |
| | | waddresses2.add("DB103.26"); |
| | | waddresses2.add("DB100.188"); |
| | |
| | | waddresses2.add("DB100.146"); |
| | | // waddresses2.add("DB100.162-175"); |
| | | |
| | | |
| | | // 复位按钮地址 |
| | | List<String> waddresses3 = new ArrayList<>(); |
| | | waddresses3.add("DB101.4.0"); |
| | | waddresses3.add("DB101.4.3"); |
| | |
| | | waddresses3.add("DB101.4.4"); |
| | | waddresses3.add("DB101.4.6"); |
| | | |
| | | |
| | | //回零按钮地址 |
| | | List<String> waddresses4 = new ArrayList<>(); |
| | | waddresses4.add("DB101.3.7"); |
| | | waddresses4.add("DB101.4.2"); |
| | | waddresses4.add("DB101.4.5"); |
| | | waddresses4.add("DB101.4.7"); |
| | | |
| | | |
| | | |
| | | |
| | | String waddresses5="DB100.148"; |
| | |
| | | |
| | | |
| | | |
| | | // 写入第一个地址 |
| | | if (messageArray.getJSONArray(0).size() > 0) { |
| | | // 写入AO1组合 |
| | | if (messageArray.getJSONArray(0).size() > 0 ) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(0); |
| | | List<Short> sValue = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | |
| | | } |
| | | } |
| | | if (!sValue.isEmpty()) { |
| | | |
| | | |
| | | |
| | | S7control.getinstance().WriteWord(waddresses1, sValue); |
| | | List<String> A01start = new ArrayList<>(); |
| | | A01start.add("DB101.5.0"); |
| | | Boolean[] a01values7 = { true}; |
| | | List<Boolean> a01startval = new ArrayList<>(Arrays.asList(a01values7)); |
| | | S7control.getinstance().WriteBit(A01start, a01startval); |
| | | System.out.println("Values " + sValue + " written to PLC at address " + waddresses1); |
| | | } |
| | | } |
| | | |
| | | |
| | | //// 写入AO2组合 |
| | | if (messageArray.getJSONArray(1).size() > 0) { |
| | | JSONArray jsonArray2 = messageArray.getJSONArray(1); |
| | | List<Short> sValue2 = new ArrayList<>(); |
| | |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses2, sValue2); |
| | | List<String> A02start = new ArrayList<>(); |
| | | A02start.add("DB101.5.1"); |
| | | Boolean[] a02values7 = {true}; |
| | | List<Boolean> a02startval = new ArrayList<>(Arrays.asList(a02values7)); |
| | | S7control.getinstance().WriteBit(A02start, a02startval); |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses2); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 复位按钮写入 |
| | | if (messageArray.getJSONArray(2).size() > 0) { |
| | | JSONArray jsonArray3 = messageArray.getJSONArray(2); |
| | | List<Boolean> sValue3 = new ArrayList<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //回零按钮写入 |
| | | if (messageArray.getJSONArray(3).size() > 0) { |
| | | JSONArray jsonArray4 = messageArray.getJSONArray(3); |
| | | List<Boolean> sValue4 = new ArrayList<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //进片ID写入 |
| | | if (messageArray.getJSONArray(4).size() > 0) { |
| | | // JSONArray jsonArray5 = messageArray.getJSONArray(4); |
| | | String jsonArray5 = String.valueOf(messageArray.getJSONArray(4)); |
| | |
| | | System.out.println("Values " + jsonArray5 + " written to PLC at address " + waddresses5); |
| | | } |
| | | } |
| | | |
| | | // 存片ID写入 |
| | | if (messageArray.getJSONArray(5).size() > 0) { |
| | | JSONArray jsonArray6 = messageArray.getJSONArray(5); |
| | | |
| | |
| | | System.out.println("Values " + value2 + " written to PLC at address " + waddresses6); |
| | | } |
| | | } |
| | | if (messageArray.getJSONArray(6).size() > 0) { |
| | | JSONArray jsonArray4 = messageArray.getJSONArray(6); |
| | | List<Boolean> sValueb4 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray4.size(); i++) { |
| | | Object value = jsonArray4.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | boolean val = "1".equals(cleanedValue.trim()); |
| | | sValueb4.add(val); |
| | | System.out.println("messageValue: " + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 boolean 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValueb4.isEmpty()) { |
| | | |
| | | List<String> A01Bstart = new ArrayList<>(); |
| | | A01Bstart.add("DB101.11.0"); |
| | | // Boolean[] a01values7 = {true}; |
| | | // List<Boolean> a01Bstartval = new ArrayList<>(Arrays.asList(a01values7)); |
| | | S7control.getinstance().WriteBit(A01Bstart, sValueb4); |
| | | System.out.println("Values " + sValueb4 + " written to PLC at address " + A01Bstart); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | if (messageArray.getJSONArray(7).size() > 0) { |
| | | JSONArray jsonArray4 = messageArray.getJSONArray(7); |
| | | List<Boolean> sValueb5 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray4.size(); i++) { |
| | | Object value = jsonArray4.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | boolean val = "1".equals(cleanedValue.trim()); |
| | | sValueb5.add(val); |
| | | System.out.println("messageValue: " + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 boolean 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValueb5.isEmpty()) { |
| | | |
| | | List<String> A02Bstart = new ArrayList<>(); |
| | | A02Bstart.add("DB101.11.1"); |
| | | // Boolean[] a01values7 = {true}; |
| | | // List<Boolean> a01Bstartval = new ArrayList<>(Arrays.asList(a01values7)); |
| | | S7control.getinstance().WriteBit(A02Bstart, sValueb5); |
| | | System.out.println("Values " + sValueb5 + " written to PLC at address " + A02Bstart); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // if (messageArray.getJSONArray(6).size() > 0) { |
| | | // JSONArray jsonArray6 = messageArray.getJSONArray(6); |
| | | // |
| | | // if (!jsonArray6.isEmpty()) { |
| | | // String value2 = (String) jsonArray6.get(0); |
| | | // List<String> A01Bstart = new ArrayList<>(); |
| | | // A01Bstart.add("DB101.11.0"); |
| | | // Boolean[] a01values7 = {true}; |
| | | // List<Boolean> a01Bstartval = new ArrayList<>(Arrays.asList(a01values7)); |
| | | // S7control.getinstance().WriteBit(A01Bstart, a01Bstartval); |
| | | // System.out.println("Values " + value2 + " written to PLC at address " + waddresses6); |
| | | // } |
| | | // } |
| | | |
| | | // if (messageArray.getJSONArray(7).size() > 0) { |
| | | // JSONArray jsonArray6 = messageArray.getJSONArray(7); |
| | | // |
| | | // if (!jsonArray6.isEmpty()) { |
| | | // String value2 = (String) jsonArray6.get(0); |
| | | // List<String> A02Bstart = new ArrayList<>(); |
| | | // A02Bstart.add("DB101.11.1"); |
| | | // Boolean[] a02values7 = {true}; |
| | | // List<Boolean> a02Bstartval = new ArrayList<>(Arrays.asList(a02values7)); |
| | | // S7control.getinstance().WriteBit(A02Bstart, a02Bstartval); |
| | | // System.out.println("Values " + value2 + " written to PLC at address " + waddresses6); |
| | | // } |
| | | // } |
| | | |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | |
| | | // Integer Plccount = this.count; |
| | | // System.out.println(PlcAddress); |
| | | |
| | | //读取状态数据 |
| | | List<Short> plclist = S7control.getinstance().ReadWord("DB103.0", 44); |
| | | // Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0, |
| | | // 1, 0, }; |
| | |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.sql.Time; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public void outmesid(String data, String addr) { |
| | | // System.out.println("outmesid: " + data); |
| | |
| | | return data; |
| | | } |
| | | |
| | | public Long readtime(String address) { |
| | | if (s7PLC==null) |
| | | return null; |
| | | return s7PLC.readTime(address); |
| | | } |
| | | |
| | | private int extractAddressNumber(String address) { |
| | | String numberStr = address.replaceAll("\\D+", ""); // 使用正则表达式提取数字部分 |
| | | return Integer.parseInt(numberStr); |
| | |
| | | List<String> addresslist = GetAddressList(address, count, 1); |
| | | return s7PLC.readBoolean(addresslist); |
| | | } |
| | | |
| | | |
| | | |
| | | private List<String> GetAddressList(String address, int count, int addedbit) { |
| | | List<String> addresslist = new ArrayList<String>(); |
| | |
| | | // |
| | | System.out.println("启动完成"); |
| | | |
| | | // new PlcHold().start(); |
| | | |
| | | |
| | | new Plchome().start(); |
| | | // |
| | | new PlcHold().start(); |
| | | // |
| | | // |
| | | new Plchome().start(); |
| | | // // |
| | | new PlcParameter().start(); |
| | | // |
| | | // new Plcalarm().start(); |
| | |
| | | |
| | | } |
| | | |
| | | public Short selectAll2() { // 多片上片 |
| | | int cage1; |
| | | int cells; |
| | | int ids; |
| | | int prcid; |
| | | int tiers; |
| | | int prctier; |
| | | double width; |
| | | double minwidth = 0; |
| | | List<String> adddresslist = new ArrayList<>(); |
| | | adddresslist.add("DB105.0");// 进片车起始位置 |
| | | adddresslist.add("DB105.2");// 进片车目标位置 |
| | | adddresslist.add("DB105.4");// 进片笼玻璃数 |
| | | adddresslist.add("DB105.12");// 进片车启动 1为启动 |
| | | List<Short> datas = new ArrayList<>(); |
| | | |
| | | // 获取多片序列玻璃宽度 |
| | | StorageCage queGlass = spianMapper.SelectQueueWidth(); |
| | | double widths = queGlass.getWidth(); |
| | | String orderids = queGlass.getOrderId(); |
| | | int num = spianMapper.SelectQueOrder(); |
| | | if (num == 1) { |
| | | |
| | | // 获取订单相关度最高的笼子排序 |
| | | List<StorageCage> storageCage = spianMapper.selectAll(orderids); |
| | | if (storageCage == null) { |
| | | return (400); |
| | | } |
| | | for (StorageCage storageCage2 : storageCage) { |
| | | // 保存订单优先顺序笼子号 |
| | | cage1 = storageCage2.getCage(); |
| | | // 判断该笼子号相邻最大的空格数 |
| | | int cages = spianMapper.selectCage(cage1); |
| | | StorageCage cages1; |
| | | // 判断是否有合适完整空格 |
| | | cages1 = spianMapper.selectqueCage1(cage1, storageCage2.getCell(), widths); |
| | | // 判断选中笼子是否有合适宽度空格 |
| | | // 有合适空格时进片 |
| | | if (cages1 != null && cages >= 1) { |
| | | ids = cages1.getId();// 数据库ID |
| | | cells = cages1.getCell();// 格子号 |
| | | prcid = cages1.getPrcId();// 传给prc的目标地id |
| | | String glassid=""; |
| | | // 数据库修改笼子表新增一条玻璃 |
| | | for (int i = 2; i > 0; i--) { |
| | | north_glass_buffer1 qglass = spianMapper.SelectQueueGlass(i); |
| | | width = qglass.getglasslengthmm();// 格子剩余宽度 |
| | | glassid=qglass.getbarcode(); |
| | | spianMapper.UpdataAddqueCage(qglass.getordernumber(), qglass.getbarcode(), width, cage1, cells, i,1); |
| | | spianMapper.UpdataAddCage1(width, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, qglass.getbarcode().toString());// 新增任务 |
| | | } |
| | | // 执行进片 |
| | | datas.add((short) 1000); |
| | | datas.add((short) prcid); |
| | | datas.add((short) 0); |
| | | datas.add((short) 1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | outmesid(glassid,"DB105.20"); |
| | | return (200); |
| | | |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | for (int i = 2; i > 0; i--) { |
| | | north_glass_buffer1 qglass = spianMapper.SelectQueueGlass(i); |
| | | String orderid = qglass.getordernumber().toString(); |
| | | String glassid = qglass.getbarcode(); |
| | | widths = qglass.getglasslengthmm(); |
| | | List<StorageCage> storageCage = spianMapper.selectAll(orderid); |
| | | if (storageCage == null) { |
| | | return (400); |
| | | } |
| | | for (StorageCage storageCage2 : storageCage) { |
| | | // 保存订单优先顺序笼子号 |
| | | cage1 = storageCage2.getCage(); |
| | | // 判断该笼子号相邻最大的空格数 |
| | | int cages = spianMapper.selectCage(cage1); |
| | | StorageCage cages1; |
| | | // 判断是否是第二片需要加间隔物 |
| | | prctier = spianMapper.selectsum(cage1, storageCage2.getCell());// 传给prc的格子内玻璃数 |
| | | if (prctier > 0) { |
| | | cages1 = spianMapper.selectCage1(cage1, storageCage2.getCell(), widths + 400); |
| | | } else { |
| | | cages1 = spianMapper.selectCage1(cage1, storageCage2.getCell(), widths); |
| | | } |
| | | // 判断选中笼子是否有合适宽度空格 |
| | | // 有合适空格时进片 |
| | | if (cages1 != null && cages >= 1) { |
| | | ids = cages1.getId();// 数据库ID |
| | | tiers = cages1.getTier();// 内外片 |
| | | cells = cages1.getCell();// 格子号 |
| | | prcid = cages1.getPrcId();// 传给prc的目标地id |
| | | width = cages1.getWidth();// 格子剩余宽度 |
| | | widths = qglass.getglasslengthmm(); |
| | | |
| | | // 执行进片 |
| | | datas.add((short) 1000); |
| | | datas.add((short) prcid); |
| | | datas.add((short) prctier); |
| | | datas.add((short) 1); |
| | | // 数据库修改笼子表新增一条玻璃 |
| | | spianMapper.UpdataAddCage(orderid, glassid, widths, cage1, cells, ids, 2); |
| | | spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 新增任务 |
| | | outmesid(glassid,"DB105.20");//派发进片id |
| | | // S7control.getinstance().WriteWord(adddresslist, datas); |
| | | break; |
| | | // S7control.getinstance().WriteByte("DB105.16",glassid); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | return (400); |
| | | |
| | | } |
| | | |
| | | // 按订单出片 |
| | | public Result selectout(String orderid) { |
| | | |
| | | // spianMapper.UpdatetaskOut(); //完成上一次出片或者调度任务,改到plchold里,出片或调度任务完成立即改变结束任务; |
| | | // 定义PRC数据传送数组 |
| | | List<String> adddresslist = new ArrayList<>(); |
| | | adddresslist.add("DB105.10");// 出片车起始位置 |
| | | adddresslist.add("DB105.12");// 出片车目标位置 |
| | | adddresslist.add("DB105.14");// 出片笼玻璃数 |
| | | adddresslist.add("DB105.18");// 出片车启动 1为启动 |
| | | List<Short> datas = new ArrayList<>(); |
| | | // 获取优先出片的位置 |
| | | StorageCage cageout = spianMapper.selectOut(orderid); |
| | | if (cageout == null) { |
| | | return Result.success("200"); |
| | | } |
| | | // 判断是否同一格内都为同一订单 |
| | | |
| | | int orders = Integer.valueOf(cageout.getOrderId()).intValue(); |
| | | |
| | | int cage = cageout.getCage(); // 储存出片位置,笼子格子几号玻璃 |
| | | int cell = cageout.getCell();// 出片格号 |
| | | int tier = cageout.getTier();// 出片内外片 |
| | | int prcid = cageout.getPrcId();// prcid |
| | | String glassid = cageout.getGlassId(); |
| | | int prcid2; |
| | | int ids; |
| | | int cages; |
| | | int cells; |
| | | double glasswidth = cageout.getGlassWidth(); |
| | | // 当一格内都为同一订单时 |
| | | |
| | | if (orders == 2) { |
| | | datas.add((short) prcid); |
| | | datas.add((short) 1000); |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | spianMapper.UpdatequeOut(cage, cell); |
| | | return Result.success("200"); |
| | | } else { |
| | | // 判断是否除此格子内还有其他格子有单独的订单玻璃 |
| | | StorageCage pd = spianMapper.SelectQueout(orderid,cage, cell); |
| | | // 判断玻璃内外片 |
| | | if (tier == 2) { |
| | | |
| | | // 判断玻璃可直接出片时 |
| | | // 修改数据库笼子表(出片) |
| | | datas.add((short) prcid); |
| | | datas.add((short) 1000); |
| | | datas.add((short) 1); |
| | | datas.add((short) 1); |
| | | |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态 |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, orderid);// 新增任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | outmesid(glassid,"DB105.34");// 派发出片ID |
| | | if (pd != null) { |
| | | cage = pd.getCage(); |
| | | cell = pd.getCage(); |
| | | // 清除本格数据出片 |
| | | spianMapper.UpdatequeOut(cage, cell); |
| | | return Result.success("200"); |
| | | } |
| | | return Result.success(datas);// 结束 |
| | | } else { |
| | | // 获取格子的玻璃数量 |
| | | int state = spianMapper.selectGlassState(cage, cell); |
| | | // 判断内片是否需要调拨 |
| | | if (state == 1) { |
| | | // spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0); |
| | | datas.add((short) prcid); |
| | | datas.add((short) 1000); |
| | | datas.add((short) 1); |
| | | datas.add((short) 1); |
| | | spianMapper.Inserttask(1, 0,prcid, 1000, orderid);// 新增任务 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态 |
| | | //S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | //outmesid(glassid);// 派发出片ID |
| | | if (pd != null) { |
| | | cage = pd.getCage(); |
| | | cell = pd.getCage(); |
| | | // 清除本格数据出片 |
| | | spianMapper.UpdatequeOut(cage, cell); |
| | | return Result.success("200"); |
| | | } |
| | | return Result.success(datas);// 结束 |
| | | |
| | | } else { |
| | | // 玻璃需要调拨时,判断属于哪个半区的笼子 |
| | | if (cage < 6) { |
| | | StorageCage cagecell = spianMapper.selectGlassCage(cage, glasswidth, 0, 6); |
| | | if (cagecell == null) { |
| | | return Result.success(cagecell); |
| | | } |
| | | // 获取调拨位置进行调拨 |
| | | prcid2 = cagecell.getPrcId();// 调拨目标位PRCID |
| | | ids = cagecell.getId();// 调拨目标位ID |
| | | cages = cagecell.getCage();// 调拨目标位笼子 |
| | | cells = cagecell.getCell();// 调拨目标位格子 |
| | | |
| | | // 填入调拨数据 |
| | | datas.add((short) prcid);// 调拨外片起始位置 |
| | | datas.add((short) prcid2); |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | // 更换玻璃的笼子 |
| | | String glassids = spianMapper.SelectGlassid(cage, cell); // 获取被调拨的玻璃id |
| | | spianMapper.UpdateDBCage(ids, cage, cell,2);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态 |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, orderid);// 新增调度任务 |
| | | // 传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | System.out.println(datas); |
| | | outmesid(glassids,"DB105.34");// 派发调拨玻璃ID |
| | | return Result.success(cagecell); // 结束 |
| | | |
| | | } else {// 笼子号大于5时 |
| | | StorageCage cagecell = spianMapper.selectGlassCage(cage, glasswidth, 5, 11); |
| | | if (cagecell == null) { |
| | | return Result.success(cagecell); |
| | | } |
| | | // 获取调拨位置进行调拨 |
| | | prcid2 = cagecell.getPrcId();// 调拨目标位prcID |
| | | ids = cagecell.getId();// 调拨目标位ID |
| | | cages = cagecell.getCage();// 调拨目标位笼子 |
| | | cells = cagecell.getCell();// 调拨目标位格子 |
| | | // 填入调拨数据 |
| | | datas.add((short) prcid); |
| | | datas.add((short) prcid2); |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | String glassids = spianMapper.SelectGlassid(cage, cell); // 获取被调拨的玻璃id |
| | | spianMapper.UpdateDBCage(ids, cage, cell,2);// 将原格子数据更新到新格子里 |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, orderid);// 新增调度任务 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态 |
| | | // 传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | |
| | | outmesid(glassids,"DB105.34");// 派发调拨玻璃ID |
| | | return Result.success(cagecell); // 结束 |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public Short selectout2(String glassid) { |
| | | // 定义PRC数据传送数组 |