Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
# Conflicts:
# springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
增加A01终止/继续 A02终止/继续 存片等待延迟
| | |
| | | "value": 0 |
| | | } |
| | | ] |
| | | , [ |
| | | { |
| | | , |
| | | [ |
| | | |
| | | { |
| | | "button": { |
| | | "name": "急停后中止/继续选择", |
| | | "name": "A01终止/继续", |
| | | "value":0, |
| | | "address":"DB10.0", |
| | | "type":"66" |
| | | } |
| | | } |
| | | }], |
| | | |
| | | |
| | | ] |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "A02终止/继续", |
| | | "value":0, |
| | | "address":"DB10.0", |
| | | "type":"66" |
| | | } |
| | | }], |
| | | [ |
| | | |
| | | |
| | | |
| | | { |
| | | "name": "存片等待延时", |
| | | "read": 666, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | |
| | | |
| | | ] |
| | | |
| | | ] |
| | |
| | | "A02所在格子": "A02 Current Grid",
|
| | | "B01所在格子": "B01 Current Grid",
|
| | | "B02所在格子": "B02 Current Grid",
|
| | | "急停后中止/继续选择": "Abort/ResumeTasks"
|
| | | "急停后中止/继续选择": "Abort/ResumeTasks",
|
| | | "A01终止/继续": "A01Abort/ResumeTasks",
|
| | | "A02终止/继续": "A02Abort/ResumeTasks",
|
| | | "存片等待延时": "Storage wait delay"
|
| | | |
| | | },
|
| | | "langPositioning1": {
|
| | | "格子间距": "GridSpacing",
|
| | |
| | | },
|
| | | "A01行走伺服回零":"A01 SERVE TRAVEL Home",
|
| | | "A02行走伺服回零":"A02 SERVE TRAVEL Home"
|
| | | |
| | |
|
| | | |
| | |
|
| | | } |
| | |
| | | "There is no such order": "没有此订单的玻璃",
|
| | | "There are currently tasks": "当前有任务",
|
| | | "There is no such glass": "没有此玻璃",
|
| | | "There is no such grid": "没有空闲格子",
|
| | | "There is no such slot": "没有空闲格子",
|
| | | "No delete allowed": "不能删除",
|
| | | "No out allowed": "不能出片",
|
| | | "Are you sure to perform this operation ?": "确定执行此操作?",
|
| | |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("Action") }}</router-link --> |
| | | |
| | | |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link |
| | |
| | | :span="6" |
| | | v-for="(dataGroup, groupIndex) in jsonData" |
| | | :key="groupIndex" |
| | | |
| | | style="margin-bottom: -20px;" |
| | | style="margin-bottom: -20px" |
| | | > |
| | | <el-card class="json-block" style="width: 300px; margin-bottom: 2px"> |
| | | <el-card class="json-block" style="width: 300px; margin-bottom: 2px;height:200px" :height="groupIndex === 12 ? '190px' : '170px'" > |
| | | <div |
| | | class="button-row" |
| | | style="display: flex; justify-content: space-between" |
| | |
| | | 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', |
| | | id: |
| | | item.button.value === 1 && item.button.name === 'Clear ID', |
| | | }" |
| | | >{{ item.button.name }}</el-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', |
| | | id: item.button.value === 1 && item.button.name === '清除ID', |
| | | }" |
| | | >{{ item.button.name }}</el-button |
| | | > |
| | |
| | | <span |
| | | class="name" |
| | | v-if="groupIndex === 12" |
| | | style="width: 250px" |
| | | style="width: 350px" |
| | | >{{ item.name }}</span |
| | | > |
| | | <span class="name" v-else style="width: 150px">{{ |
| | | item.name |
| | | }}</span> |
| | | |
| | | <el-input |
| | | v-if="item.type === '0' && groupIndex==15" |
| | | v-model="item.value" |
| | | @keyup.enter.native="timeout" |
| | | style="width: 300px" |
| | | class="input-box2" |
| | | ></el-input> |
| | | <el-input |
| | | v-if="item.type === '0'" |
| | | v-else-if="item.type === '0' " |
| | | v-model="item.value" |
| | | readonly="readonly" |
| | | style="width: 300px" |
| | |
| | | |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | if (dataGroup[itemIndex].button.value === 1) { |
| | | // 如果当前按钮的值是 0,将其设为 1 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 0); |
| | | } else { |
| | | // 否则将其设为 0 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | } |
| | | }, |
| | | // 如果当前按钮的值是 0,将其设为 1 |
| | | this.$set(dataGroup[itemIndex].button, "value", 0); |
| | | } else { |
| | | // 否则将其设为 0 |
| | | this.$set(dataGroup[itemIndex].button, "value", 1); |
| | | } |
| | | }, |
| | | //范围 0-100 |
| | | timeout(){ |
| | | |
| | | |
| | | const data3 = []; |
| | | const resetButtonValues3 = [this.jsonData[15][0].value]; |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data3.push(resetButtonValues3.flat()); |
| | | data3.unshift([],[]); |
| | | // 在 data3 数组前面添加两个空数组 |
| | | |
| | | // 创建 jsonObject3 对象,并添加 data3 属性 |
| | | const jsonObject3 = { data: data3 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString3 = JSON.stringify(jsonObject3); |
| | | console.log("Storage wait delay:", jsonString3); |
| | | socket?.send(jsonString3); |
| | | // setTimeout(()=> |
| | | // window.location.reload(),2000 |
| | | // ) |
| | | |
| | | }, |
| | | |
| | | |
| | | |
| | | submitDataToBackend(currentButtonName) { |
| | | if (currentButtonName === "清除ID" || currentButtonName === "Clear ID") { |
| | | const data2 = []; |
| | |
| | | } |
| | | |
| | | if ( |
| | | currentButtonName === "Abort/ResumeTasks" || |
| | | currentButtonName === "急停后中止/继续选择" |
| | | currentButtonName === "A01Abort/ResumeTasks" || |
| | | currentButtonName === "A01终止/继续" || |
| | | currentButtonName === "A02Abort/ResumeTasks" || |
| | | currentButtonName === "A02终止/继续" |
| | | ) { |
| | | const data3 = []; |
| | | const resetButtonValues3 = [this.jsonData[13][0].button.value]; |
| | | const resetButtonValues3 = [this.jsonData[13][0].button.value,this.jsonData[14][0].button.value]; |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data3.push(resetButtonValues3.flat()); |
| | |
| | | // window.location.reload(),2000 |
| | | // ) |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | | initWebSocket() { |
| | | let viewname = "Parameter2"; |
| | | |
| | |
| | | socket.onopen = function () { |
| | | console.log("websocket已打开"); |
| | | }; |
| | | let isMouseInInputBox = false; // 标记鼠标是否在输入框内 |
| | | |
| | | const inputBox = document.querySelectorAll('.input-box2'); |
| | | inputBox.forEach(box => { |
| | | box.addEventListener('mouseenter', () => { |
| | | isMouseInInputBox = true; |
| | | }); |
| | | box.addEventListener('mouseleave', () => { |
| | | isMouseInInputBox = false; |
| | | }); |
| | | }); |
| | | // 收到消息 |
| | | socket.onmessage = (msg) => { |
| | | if (!msg.data) { |
| | |
| | | |
| | | const parms = obj.params; |
| | | |
| | | // console.log(obj); |
| | | //console.log(obj); |
| | | |
| | | // const handleMouseMove = throttle(function(event) { |
| | | // const inputBox = document.querySelectorAll('.id'); |
| | | // const target = event.target; |
| | | |
| | | if (parms ) { |
| | | //急停按钮 |
| | | jsonData2[13][0].button.value = obj.jiting[0][0]; |
| | | if (parms && !isMouseInInputBox) { |
| | | //急停按钮 |
| | | jsonData2[13][0].button.value = obj.jiting[0][0]; |
| | | jsonData2[14][0].button.value = obj.jiting[0][1]; |
| | | |
| | | |
| | | //清除id |
| | | |
| | | |
| | | |
| | | //清除id |
| | | |
| | | 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 === "3") { |
| | | obj.button.value = parms[0][i]; |
| | | // console.log(obj.button.value); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //ID |
| | | const specialChars = /[^\w\s]/g; // 正则表达式匹配非字母、数字、下划线和空格的字符 |
| | | |
| | | 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 === "0") { |
| | | if (parms[1] && parms[1][i]) { |
| | | obj.value = parms[1][i].replace(specialChars, ""); |
| | | // console.log(obj.value); |
| | | } |
| | | if (obj.name === "ID2") { |
| | | obj.value = parms[1][7].replace(specialChars, ""); // 将ID2对应的值赋为parms[1][7] |
| | | } |
| | | |
| | | if (obj.name === "A02ID") { |
| | | obj.value = parms[1][8].replace(specialChars, ""); |
| | | } |
| | | if (obj.name === "B01ID") { |
| | | obj.value = parms[1][9].replace(specialChars, ""); |
| | | } |
| | | if (obj.name === "B02ID") { |
| | | obj.value = parms[1][10].replace(specialChars, ""); |
| | | 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 === "3") { |
| | | obj.button.value = parms[0][i]; |
| | | // console.log(obj.button.value); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //手动状态 |
| | | 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 = parms[2][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 |
| | | const specialChars = /[^\w\s]/g; // 正则表达式匹配非字母、数字、下划线和空格的字符 |
| | | |
| | | 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 === "0") { |
| | | if (parms[1] && parms[1][i]) { |
| | | obj.value = parms[1][i].replace(specialChars, ""); |
| | | // console.log(obj.value); |
| | | } |
| | | if (obj.name === "ID2") { |
| | | obj.value = parms[1][7].replace(specialChars, ""); // 将ID2对应的值赋为parms[1][7] |
| | | } |
| | | |
| | | if (obj.name === "A02ID") { |
| | | obj.value = parms[1][8].replace(specialChars, ""); |
| | | } |
| | | if (obj.name === "B01ID") { |
| | | obj.value = parms[1][9].replace(specialChars, ""); |
| | | } |
| | | if (obj.name === "B02ID") { |
| | | obj.value = parms[1][10].replace(specialChars, ""); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //扫描枪扫码的ID |
| | | |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 66) { |
| | | subItem.value = parms[3][0].replace(specialChars, ""); |
| | | //手动状态 |
| | | 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 = parms[2][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) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 66) { |
| | | subItem.value = parms[3][0].replace(specialChars, ""); |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 666) { |
| | | subItem.value = parms[3][1].replace(specialChars, ""); |
| | | } |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 666) { |
| | | subItem.value = parms[3][1].replace(specialChars, ""); |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | | //A01当前格子 |
| | | let lastParmsArray = parms[parms.length - 1]; |
| | | //A01当前格子 |
| | | let lastParmsArray = parms[parms.length - 1]; |
| | | |
| | | let lastParmsIndex = 0; |
| | | let lastParmsIndex = 0; |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | for (let j = 0; j < jsonData2[i].length; j++) { |
| | | if (jsonData2[i][j].read === 333) { |
| | | jsonData2[i][j].value = lastParmsArray[lastParmsIndex]; |
| | | lastParmsIndex++; |
| | | if (lastParmsIndex === lastParmsArray.length) { |
| | | lastParmsIndex = 0; |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | for (let j = 0; j < jsonData2[i].length; j++) { |
| | | if (jsonData2[i][j].read === 333) { |
| | | jsonData2[i][j].value = lastParmsArray[lastParmsIndex]; |
| | | lastParmsIndex++; |
| | | if (lastParmsIndex === lastParmsArray.length) { |
| | | lastParmsIndex = 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | jsonData2[15][0].value = obj.timeout[0]; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // console.log(jsonData2); |
| | |
| | | .id { |
| | | background-color: green; |
| | | } |
| | | |
| | | </style> |
| | |
| | |
|
| | | <el-pagination :style="'margin-top:-2px'" @size-change="handleSizeChanges"
|
| | | @current-change="handleCurrentChanges" :pager-count="7" :current-page="currentPages"
|
| | | :page-sizes="[21, 42, 84, 420]" :page-size="pagesizes" layout="total, sizes, prev, pager, next, jumper"
|
| | | :page-sizes="[42, 84, 126, 420]" :page-size="pagesizes" layout="total, sizes, prev, pager, next, jumper"
|
| | | :total="cageinfo.length > 0 ? cageinfo.length : null" background style="float: right; margin-top: 20px">
|
| | | </el-pagination>
|
| | |
|
| | |
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column prop="sequence" :label="$t('Sequence')"></el-table-column>
|
| | | <el-table-column prop="position" :label="$t('Position')" style="font-size: 20px;">
|
| | | <el-table-column :min-width="300" prop="position" :label="$t('Position')" style="font-size: 20px;">
|
| | | <template slot-scope='scope'>
|
| | | {{ scope.row.position == 1 ? "▄▄▄" : "▋" }}
|
| | | <!-- {{ scope.row.position == 1 ? "<>▄▄▄" : "▋" }} -->
|
| | | <div :style="'width:'+(scope.row.position==1?'300':'100') +'px;height:'+(scope.row.position==1?'100':'300') +'px;background-Color:gray;'">
|
| | | <!-- <div :style="'width:100px;height:300px;background-Color:red;'"></div> -->
|
| | | </div>
|
| | | <!-- {{ scope.row.position == 1 ? "<div></div>" : "<div></div>" }} -->
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column prop="position" :label="$t('Flip')">
|
| | |
| | |
|
| | | <el-dialog :visible.sync="dialogFormCountDown" :title="$t('Approximately resettable time')" top="5vh">
|
| | | <div :style="'font-size: ' + PromptSize + 'px;text-align: center;'">
|
| | | <!-- {{ this.CountDowns }} -->
|
| | | {{ this.CountDowns }}
|
| | | </div>
|
| | | </el-dialog>
|
| | |
| | | pagesize: 15, //每页默认显示的数据
|
| | | pageCount: 0,
|
| | | currentPages: 1, //默认初始页
|
| | | pagesizes: 21, //每页默认显示的数据
|
| | | pagesizes: 42, //每页默认显示的数据
|
| | | pageCounts: 0,
|
| | | OutSlice: [],
|
| | | AluminumFrame: [],
|
| | |
| | | OutingQueue: true,
|
| | | OrderInfo: true,
|
| | | CageDetails: true,
|
| | | CountDowns: "EMERGENCY STOP",
|
| | | CountDowns: "EMERGENCY \r\n STOP",
|
| | | D01RequestState: false,
|
| | | EmergencyStop: false,
|
| | | PromptSize: 250
|
| | | PromptSize: 250,
|
| | | reset:false
|
| | | };
|
| | | },
|
| | | created() {
|
| | | this.load();
|
| | |
|
| | | this.init();
|
| | | }
|
| | | ,
|
| | |
| | | }
|
| | | //是否急停
|
| | | this.EmergencyStop = obj.emergencystop[0];
|
| | | console.log(this.EmergencyStop);
|
| | |
|
| | | //复位倒计时
|
| | | if ((obj.countdown[0] == true && this.CountDowns == 0) || this.EmergencyStop == true) {
|
| | | this.CountDown();
|
| | | }
|
| | | //复位完成信号
|
| | | this.reset=obj.reset[0];
|
| | | //是否有进片请求
|
| | | console.log(obj.D01RequestState[0]);
|
| | | this.D01RequestState = obj.D01RequestState[0];
|
| | |
|
| | | //是否允许出片
|
| | |
| | | this.cageinfo = res.data.cageinfo;
|
| | | });
|
| | | }
|
| | |
|
| | |
|
| | | this.$forceUpdate();
|
| | |
|
| | | }.bind(this);
|
| | |
| | | });
|
| | |
|
| | | });
|
| | | //加载小车位置信息
|
| | | Loadcarlist().then(res => {
|
| | | this.carlist = res.data.carlist;
|
| | | });
|
| | | //加载笼子使用情况数据
|
| | | home().then(res => {
|
| | | this.tableData = res.data.list;
|
| | |
| | | SelectAlarmmgInfo().then(res => {
|
| | | this.alarm = res.data.alarmmg;
|
| | | });
|
| | | //加载小车位置信息
|
| | | Loadcarlist().then(res => {
|
| | | this.carlist = res.data.carlist;
|
| | | });
|
| | | |
| | | //加载确认密码
|
| | | SelectPassword().then(res => {
|
| | | this.password = res.data.password;
|
| | |
| | | this.$message.error(this.$t('There is no such glass'));
|
| | | }
|
| | | else if (res.data.message2 == 400) {
|
| | | this.$message.error(this.$t('There is no such grid'));
|
| | | this.$message.error(this.$t('There is no such slot'));
|
| | | }
|
| | | });
|
| | | } else {
|
| | |
| | | this.form5 = {};
|
| | | this.$message.success(this.$t('Operation successful'));
|
| | | } else {
|
| | | alert(1);
|
| | | this.$message.error(this.$t('This glass ID already exists in the sorting cage'));
|
| | | }
|
| | | });
|
| | |
| | | rowIndex = column;
|
| | | let style = "";
|
| | | if (columnIndex === 8) {
|
| | | style = "font-size:25px;text-align: center;";
|
| | | style = "font-size:200px;text-align: center;height:200px;";
|
| | | }
|
| | | if (columnIndex === 9 && row.flip == 1) {
|
| | | style = "background-Color:yellow;";
|
| | |
| | | if (this.EmergencyStop == true) {
|
| | | clearInterval(timer);
|
| | | this.PromptSize = 250;
|
| | | this.CountDowns = "EMERGENCY STOP";
|
| | | this.CountDowns = "EMERGENCY \n STOP";
|
| | | } else {
|
| | | if (count > 0) {
|
| | | this.PromptSize = 500;
|
| | |
| | | }
|
| | | else {
|
| | | this.PromptSize = 250;
|
| | | this.CountDowns = "Waiting for reset";
|
| | | |
| | | // if(复位完成==true){
|
| | | // clearInterval(timer);
|
| | | // this.dialogFormCountDown = false;
|
| | | // }
|
| | | this.CountDowns = "Waiting \n for \n reset";
|
| | | if(this.reset==true){
|
| | | clearInterval(timer);
|
| | | this.dialogFormCountDown = false;
|
| | | }
|
| | | }
|
| | | }
|
| | | },
|
| | |
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | public void WriteWordsToPLC(JSONArray jsonArray, String address,int index) {
|
| | | if (jsonArray.getJSONArray(index).size() > 0) {
|
| | | Object value = jsonArray.getJSONArray(index).get(0);
|
| | |
| | | }
|
| | |
|
| | |
|
| | | public void Writetime(JSONArray jsonArray, String address,int index) {
|
| | | if (jsonArray.getJSONArray(index).size() > 0) {
|
| | | Object value = jsonArray.getJSONArray(index).get(0);
|
| | | if (value != null && !value.toString().equals("null")) {
|
| | | try {
|
| | | long cleanedValue = Long.parseLong(value.toString().replaceAll("[^0-9-]", ""));
|
| | |
|
| | | S7control.getinstance().writetime(address, cleanedValue);
|
| | | System.out.println("messageValue:" + Arrays.asList(cleanedValue) + " written to PLC at address " + address);
|
| | | } catch (NumberFormatException e) {
|
| | | // 如果无法解析为 short 类型,则忽略该部分
|
| | | System.err.println("Could not parse value: " + value);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | //写入String
|
| | | public void writeStringToPLC(JSONArray messageArray, String addresses, int index) {
|
| | | try {
|
| | |
| | | private JdbcConnections jdbcConnections; |
| | | private SpianMapper spianMapper; |
| | | private SpianService spianService; |
| | | |
| | | int aaa; |
| | | @Override |
| | | public void run() { |
| | | boolean inglassbegin = false; |
| | | boolean outglassbegin = false; |
| | | |
| | | while (this != null) { |
| | | try { |
| | | |
| | | Thread.sleep(1000); |
| | | Thread.sleep(100); |
| | | } catch (InterruptedException e) { |
| | | // \\ TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 获取prc进片请求数据 |
| | | List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 获取进片车状态 |
| | | List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 获取进片车任务是否启动 |
| | | |
| | | boolean B01backs = spianService.listbool("DB106.60");// b01汇报 |
| | | |
| | | boolean B02backs = spianService.listbool("DB106.62");// b02汇报 |
| | | StringBuilder B01glassid = spianService.queGlassid("DB103.184", 14);// BO1的玻璃id |
| | | StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02的玻璃id |
| | | int aaa=1; |
| | | |
| | | // 当进片小车完成任务时 |
| | | if (B01backs == true) { |
| | | // 当B01小车汇报完成时更改玻璃状态 为1 |
| | | spianService.overtask(B01glassid.toString());// 完成任务 |
| | | S7control.getinstance().WriteWord("DB106.60", (short) 0);// 恢复B01小车应答改为0 |
| | | System.out.println("汇报时B01|第"+aaa+"次"+ B01glassid); |
| | | boolean yingda = spianService.listbool("DB106.60");// b01汇报 |
| | | System.out.println("汇报时B01|第"+aaa+"次"+ B01glassid+"应答"+yingda); |
| | | aaa+=1; |
| | | } |
| | | |
| | |
| | | spianService.overtask(B02glassid.toString());// 完成任务 |
| | | S7control.getinstance().WriteWord("DB106.62", (short) 0);// 恢复B02小车应答改为0 |
| | | System.out.println("汇报时B02|" + B02glassid); |
| | | boolean yingda = spianService.listbool("DB106.62");// b01汇报 |
| | | System.out.println("汇报时B01|第"+aaa+"次"+ B02glassid+"应答"+yingda); |
| | | } |
| | | |
| | | // 获取DO1数据 |
| | |
| | | |
| | | //急停按钮 |
| | | List<String> niuanaddressList3 = Arrays.asList(config.getProperty("Parameter2.stop").split(",")); |
| | | List<String> timeout = Arrays.asList(config.getProperty("Parameter2.timeout").split(",")); |
| | | String timeout2 = config.getProperty("Parameter2.timeout"); |
| | | |
| | | |
| | | Long readtimeout = S7control.getinstance().readtime(timeout2); |
| | | List<Boolean> anniuread = S7control.getinstance().readBits(niuanaddressList3); |
| | | |
| | | |
| | |
| | | jsonObject.append("params", data3); |
| | | jsonObject.append("params", data4); |
| | | jsonObject.append("jiting", anniuparams); |
| | | jsonObject.append("timeout", readtimeout); |
| | | |
| | | |
| | | // WebSocketServer sendwServer = WebSocketServer.getWebSocketServer("Parameter2"); |
| | |
| | | customS7Control.writeBitToPLC(messageArray, addressList0, 0); |
| | | //急停 |
| | | customS7Control.writeBitToPLC(messageArray, niuanaddressList3, 1); |
| | | //存片等待延迟 |
| | | customS7Control.Writetime(messageArray, timeout2, 2); |
| | | |
| | | // 清空消息列表 |
| | | webserver.clearMessages(); |
| | | } |
| | |
| | | while (this != null) {
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | | |
| | |
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | // 是否需要人工确认上片玻璃
|
| | | jsonObject.append("isConfirm", isConfirm);
|
| | |
|
| | | //获取进片请求状态
|
| | | // 获取进片请求状态
|
| | | List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
|
| | | boolean D01RequestState = D01Request.contains((short)1);
|
| | | boolean D01RequestState = D01Request.contains((short) 1);
|
| | | // boolean D01RequestState =true;
|
| | | jsonObject.append("D01RequestState", D01RequestState);
|
| | |
|
| | | //复位倒计时
|
| | | // 复位倒计时
|
| | | // 地址104.9.6
|
| | | List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
|
| | | for (Boolean countdowns : countdown) {
|
| | | jsonObject.append("countdown", countdowns);
|
| | | }
|
| | | // jsonObject.append("countdown", true);
|
| | | // 复位完成信号
|
| | | List<Boolean> resets = S7control.getinstance().ReadBits("DB103.284", 1);
|
| | | for (Boolean reset : resets) {
|
| | | jsonObject.append("reset", reset);
|
| | | }
|
| | |
|
| | | //是否急停
|
| | | // 是否急停
|
| | | List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
|
| | | for (Boolean emergencystop : emergencystops) {
|
| | | jsonObject.append("emergencystop", emergencystop);
|
New file |
| | |
| | | package com.example.springboot.component; |
| | | |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | import com.example.springboot.service.SpianService; |
| | | |
| | | public class Plclog extends Thread { |
| | | |
| | | boolean b01 = false; |
| | | boolean b02 = false; |
| | | private SpianService spianService; |
| | | private SpianMapper spianMapper; |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(10); |
| | | } catch (InterruptedException e) { |
| | | // \\ TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class); |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | |
| | | boolean B01backs = spianService.listbool("DB106.60");// b01汇报 |
| | | boolean B02backs = spianService.listbool("DB106.62");// b01汇报 |
| | | if (b01 != B01backs) { |
| | | if (B01backs == true) { |
| | | spianMapper.insertlog("BO1:1"); |
| | | } else { |
| | | spianMapper.insertlog("BO1:0"); |
| | | } |
| | | b01 = B01backs; |
| | | } |
| | | |
| | | if (b02 != B02backs) { |
| | | if (B02backs == true) { |
| | | spianMapper.insertlog("BO2:1"); |
| | | } else { |
| | | spianMapper.insertlog("BO2:0"); |
| | | } |
| | | b02 = B02backs; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | return s7PLC.readTime(address); |
| | | } |
| | | |
| | | 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+", ""); // 使用正则表达式提取数字部分 |
| | | return Integer.parseInt(numberStr); |
| | |
| | | public Result UpdateTask(Integer types, Integer shelfrack, String glassid) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | homeMapper.UpdateTask(types, glassid); |
| | | StorageCage glass = homeMapper.SelectGlassInfo(glassid); |
| | | // StorageCage glass = homeMapper.SelectGlassInfo(glassid); |
| | | if (types == 0) { |
| | | homeMapper.UpdateCageTask1(glassid); |
| | | // S7control.getinstance().WriteWord("DB105.16", (short) 0); |
| | | } else { |
| | | spianMapper.UpdataOutCage1(glass.getGlassWidth(), glass.getCage(), glass.getCell()); |
| | | homeMapper.UpdateCageTask2(glassid); |
| | | // spianMapper.UpdataOutCage1(glass.getGlassWidth(), glass.getCage(), glass.getCell()); |
| | | homeMapper.DeleteByGlassID(glassid); |
| | | // S7control.getinstance().WriteWord("DB105.18", (short) 0); |
| | | } |
| | | map.put("message3", "200"); |
| | |
| | | } else { |
| | | map.put("message2", "300"); |
| | | } |
| | | |
| | | } else { |
| | | map.put("message2", "400"); |
| | | } |
| | |
| | | @Update("update storage_cage set state=1 where glass_id=#{glassid} and state=2") |
| | | void UpdateCageTask1(@Param("glassid") String glassid); |
| | | |
| | | // 手动完成出片任务修改笼子数据 |
| | | @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null where glass_id=#{glassid} and state=3") |
| | | void UpdateCageTask2(@Param("glassid") String glassid); |
| | | |
| | | //获取报警信息 |
| | | @Select("select id,content,timeon as timeons,endTime from alarmmg where endTime is null") |
| | | List<alarmmg> SelectAlarmmgInfo(); |
| | |
| | | @Select("select * from storage_cage where position(#{cage} in ifnull(glass_id,\"\"))") |
| | | List<StorageCage> SelectCageInfo(String cage); |
| | | |
| | | // 手动完成出片任务修改笼子数据 |
| | | @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,listid=null,boxid=null where glass_id=#{glassid}") |
| | | void DeleteByGlassID(String glassid); |
| | | |
| | |
| | | |
| | | public interface SpianMapper { |
| | | // 判断相邻笼子是否有空格 |
| | | @Select("select COUNT(if(a.state1=0,cell,null))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) and disabled=0 GROUP BY cage ORDER BY cell desc LIMIT 1") |
| | | @Select("select COUNT(if(a.state1=0,cell,0))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) and disabled=0 GROUP BY cage ORDER BY cell desc LIMIT 1") |
| | | int selectCage(int cage1); |
| | | |
| | | // @Select("(select*from storage_cage as a where a.state=0 and cage%2=0 ORDER BY |
| | |
| | | StorageCage selectCage1(int cage1, int cell, double width); |
| | | |
| | | // 判断笼子内玻璃数 |
| | | @Select("select COUNT(tier)as tier from storage_cage where cage=#{cage} and cell=#{cell} and state!=0;") |
| | | @Select("select COUNT(tier)as tier from storage_cage where cage=#{cage} and cell=#{cell} and state=1;") |
| | | int selectsum(int cage, int cell); |
| | | |
| | | // 完成进片中的玻璃状态 |
| | |
| | | StorageCage selectGlassCage(int cage, double width, int cage1, int cage2); |
| | | |
| | | // 删除笼子信息(出片) |
| | | @Update("update storage_cage as a set state=#{state},glass_id=null,order_id=null,glasswidth=0,a.glassheight=null,a.glasswidthmm=null,a.glassheightmm=null,a.listid=null,a.boxid=null where glass_id=#{glassid} and state=3;") |
| | | @Update("update storage_cage as a set state=#{state},glass_id=null,order_id=null,glasswidth=null,a.glassheight=null,a.glasswidthmm=null,a.glassheightmm=null,a.listid=null,a.boxid=null where glass_id=#{glassid} and state=3;") |
| | | void UpdataGlassCage(String glassid, int state); |
| | | |
| | | // 改变玻璃状态为出片中 |
| | |
| | | void UpdataOutCage1(double width, int cage, int cell); |
| | | |
| | | // 调拨更换笼子信息 |
| | | @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=#{tier})as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid where a.id=#{id1}") |
| | | @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=#{tier})as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=2,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid where a.id=#{id1}") |
| | | void UpdateDBCage(int id1, int cage, int cell, int tier); |
| | | |
| | | // @Insert("insert into user(name, date, address, user_no) values (#{name}, |
| | |
| | | // 把该进片的玻璃更新到出片队列 |
| | | @Select("update out_slice set state=0 where glassId=#{glassId} and state=3") |
| | | void UpdateAddQueue(String glassId); |
| | | } |
| | | //新增日志表格 |
| | | @Insert("INSERT INTO `canadames`.`log`( `text`,time) VALUES (#{logtxt},now());") |
| | | void insertlog(String logtxt); |
| | | } |
| | |
| | | if(storageCage!=null){ |
| | | spianMapper.UpdataOutCage1(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell()); |
| | | } |
| | | homeMapper.UpdateCageTask2(glassid); |
| | | homeMapper.DeleteByGlassID(glassid); |
| | | S7control.getinstance().WriteWord("DB105.12", (short) 0); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | |
| | | cage1 = storageCage2.getCage(); |
| | | // 判断该笼子号相邻最大的空格数 |
| | | int cages = spianMapper.selectCage(cage1); |
| | | if(cages==0){ |
| | | return (400); |
| | | } |
| | | StorageCage cages1; |
| | | // 判断是否是第二片需要加间隔物 |
| | | prctier = spianMapper.selectsum(cage1, storageCage2.getCell());// 传给prc的格子内玻璃数 |
| | |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, 1);// 新增任务 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid, 3);// 更改笼子表的玻璃状态 |
| | | spianMapper.OverOutSlice(glassid, 2);// 完成出片队列任务 |
| | | spianMapper.OverOutSlice(glassid, 1);// 更新出片队列任务 |
| | | System.out.println("出片任务|" + datas); |
| | | outmesid(glassid, "DB105.34");// 派发出片ID |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | |
| | | datas.add((short) 1); |
| | | // 更换玻璃的笼子 |
| | | String glassids = spianMapper.SelectGlassid(cage, cell); // 获取被调拨的玻璃id |
| | | spianMapper.UpdataGlassCageState(glassids, 3);// 更改笼子表的玻璃状态 |
| | | spianMapper.UpdateDBCage(ids, cage, cell, 2);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | //spianMapper.UpdataGlassCageState(glassids, 3);// 更改笼子表的玻璃状态 |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassid, 2);// 新增调度任务 |
| | | // spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务 |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassids, 2);// 新增调度任务 |
| | | // 传输mes数据,坐标,数据 |
| | | System.out.println("出片任务|" + datas); |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | String glassids = spianMapper.SelectGlassid(cage, cell); // 获取被调拨的玻璃id |
| | | spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassid, 2);// 新增调度任务 |
| | | spianMapper.UpdataGlassCageState(glassids, 3);// 更改笼子表的玻璃状态 |
| | | spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassids, 2);// 新增调度任务 |
| | | // spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务 |
| | | spianMapper.UpdateDBCage(ids, cage, cell, 2);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | //spianMapper.UpdataGlassCageState(glassids, 3);// 更改笼子表的玻璃状态 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | // 传输mes数据,坐标,数据 |
| | | System.out.println("出片任务|" + datas); |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | |
| | | |
| | | // 根据玻璃id完成在进行中的任务 |
| | | public void overtask(String glassid) { |
| | | spianMapper.UpdateCageOver(glassid, 0);// 更改笼子表出片状态 |
| | | spianMapper.UpdatetaskOut(glassid); // 完成上一次出片或者进片任务 |
| | | |
| | | spianMapper.UpdatetaskOut(glassid);// 完成上一次 出片或者进片任务 |
| | | spianMapper.OverOutSlice(glassid, 2);// 完成出片队列任务 |
| | | spianMapper.UpdataGlassCage(glassid, 0);// 清除出片格子玻璃信息 |
| | | spianMapper.UpdateCageadd(glassid,1); |
| | | spianMapper.UpdateCageOver(glassid, 0);// 更改笼子表出片状态 |
| | | spianMapper.UpdateCageadd(glassid,1);// 更改笼子表进片状态 |
| | | String barcode = spianMapper.SelectBarcode(glassid);// 获取该玻璃的铝框id |
| | | spianMapper.UpdateAddQueue(glassid);// 把进片的玻璃更新到出片队列中 |
| | | if (barcode != null) { |
| | |
| | | #扫码枪
|
| | | Parameter2.scanner=DB103.256,DB103.270
|
| | | #急停
|
| | | Parameter2.stop=DB101.10.4
|
| | | Parameter2.stop=DB101.10.4,DB101.11.2
|
| | |
|
| | | Parameter2.timeout=DB100.194
|
| | | #当前格子
|
| | | Parameter2.Currentcell=DB103.32,DB103.34,DB103.36,DB103.40
|
| | |
|