Merge branch 'master' of http://10.153.19.150:10101/r/CanadaMes
| | |
| | | "js-cookie": "^3.0.1", |
| | | "less": "^3.12.2", |
| | | "less-loader": "^6.2.0", |
| | | "moment": "^2.29.4", |
| | | "vue": "^2.6.11", |
| | | "vue-i18n": "^8.26.5", |
| | | "vue-router": "^3.3.4", |
| | |
| | | }, |
| | | "bin": { |
| | | "mkdirp": "bin/cmd.js" |
| | | } |
| | | }, |
| | | "node_modules/moment": { |
| | | "version": "2.29.4", |
| | | "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", |
| | | "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", |
| | | "engines": { |
| | | "node": "*" |
| | | } |
| | | }, |
| | | "node_modules/move-concurrently": { |
| | |
| | | "minimist": "^1.2.5" |
| | | } |
| | | }, |
| | | "moment": { |
| | | "version": "2.29.4", |
| | | "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", |
| | | "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" |
| | | }, |
| | | "move-concurrently": { |
| | | "version": "1.0.1", |
| | | "resolved": "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz", |
| | |
| | | "js-cookie": "^3.0.1", |
| | | "less": "^3.12.2", |
| | | "less-loader": "^6.2.0", |
| | | "moment": "^2.29.4", |
| | | "vue": "^2.6.11", |
| | | "vue-i18n": "^8.26.5", |
| | | "vue-router": "^3.3.4", |
| | |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function setTime (shijian1, shijian2) { |
| | | return request({ |
| | | url: '/alarm/stTime?shijian1=' + shijian1 + '&shijian2=' + shijian2, |
| | | method: 'get', |
| | | data: "" |
| | | }) |
| | | } |
| | |
| | | "B02 OUT DEC error": "B02 OUT DEC error",
|
| | | "B02 OUT pos error": "B02 OUT pos error"
|
| | | },
|
| | | "Electrical": "Electrical",
|
| | | "Parameter": "Parameter",
|
| | | "Action": "Action",
|
| | | "Sign": "Sign",
|
| | |
| | | "exit": "退出",
|
| | | "changePassword": "修改密码",
|
| | | "resetPassword": "重置密码",
|
| | |
|
| | | "home": "主页",
|
| | | "role": "角色",
|
| | | "langRoleManagement": "角色管理",
|
| | |
| | | "B02 OUT DEC error": "B02 OUT DEC 错误",
|
| | | "B02 OUT pos error": "B02 OUT pos 错误"
|
| | | },
|
| | | "Electrical": "设备管理",
|
| | | "Parameter": "参数下发",
|
| | | "Action": "开关控制",
|
| | | "Sign": "IO状态",
|
| | | "State": "State",
|
| | | "Alarm": "报警信息",
|
| | | "Distribute": "下发"
|
| | | } |
| | | }
|
| | |
|
| | |
| | | background-color="#222f3e" text-color="#fff" active-text-color="#ffd04b" |
| | | :collapse="isCollapse" :unique-opened="true" |
| | | :collapse-transition="false" :router="true"> |
| | | <el-menu-item index="/" @click="goToHome"> |
| | | <!-- <el-menu-item index="/" @click="goToHome"> |
| | | <template slot="title"> |
| | | <!--图标--> |
| | | |
| | | <i class="el-icon-menu"></i> |
| | | <!--文本--> |
| | | |
| | | <span>{{ $t('home') }}</span> |
| | | </template> |
| | | </el-menu-item> |
| | | </el-menu-item> --> |
| | | <!--一级菜单--> |
| | | <el-submenu :index="item.id.toString()" v-for="item in menuList" :key="item.id"> |
| | | <!--一级菜单模板区域--> |
| | |
| | | <span>{{ item.name }}</span> |
| | | </template> |
| | | <!--二级菜单--> |
| | | |
| | | <el-menu-item :index="'/'+menu.router" |
| | | v-for="menu in item.menuLists" :key="menu.id" |
| | | @click="addTag(menu.router)"> |
| | |
| | | <el-menu :default-active="activePath1" class="el-menu-demo" mode="horizontal" |
| | | background-color="#576574" text-color="#fff" active-text-color="#ffd04b"> |
| | | <div class="header-left"> |
| | | <el-button :icon="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" @click="toggleCollapse" style="height:30px"></el-button> |
| | | <el-button :icon="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" @click="toggleCollapse" style="height:30px;"></el-button> |
| | | </div> |
| | | <div class="tagContainer"> |
| | | <tag v-for="(tag, index) in tags" :key="index" :tag="tag" @removeTag="removeTag(index)" @switchTag="switchTag(index)"></tag> |
| | | <!-- <el-button icon="el-icon-circle-close" class="close-all-btn" @click="removeAllTags"></el-button> --> |
| | | </div> |
| | | <div class="tagContainer" style="display: flex;"> |
| | | <tag v-for="(tag, index) in tags" :key="index" :tag="tag" @removeTag="removeTag(index)" @switchTag="switchTag(index)"></tag> |
| | | </div> |
| | | <template> |
| | | <el-submenu index="1" class="custom-submenu"> |
| | | <el-submenu index="1" class="custom-submenu" > |
| | | <template slot="title"> |
| | | <el-avatar src="../assets/emi.png" style="width:30px;height:30px;margin-top:2px;"></el-avatar> |
| | | <el-avatar src="../assets/emi.png" style="width:20px;height:20px;margin-top:30px;background-color: white;"></el-avatar> |
| | | </template> |
| | | <el-menu-item index="1-1" @click="logout">{{ $t('exit') }}</el-menu-item> |
| | | <el-menu-item index="1-2" @click="showChangePasswordDialog">{{ $t('changePassword') }}</el-menu-item> |
| | |
| | | ...mapState('tags', ['tags']) |
| | | }, |
| | | methods: { |
| | | |
| | | logout: function () { |
| | | removeToken() |
| | | this.$router.push('/login') |
| | |
| | | this.$store.commit('tags/addTag', tag); |
| | | } |
| | | }, |
| | | |
| | | |
| | | removeTag(index) { |
| | | this.$store.commit('tags/removeTag', index); // 从 Vuex Store 中移除标签 |
| | |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |
| | | |
| | | .el-menu--horizontal > .el-submenu .el-submenu__title { |
| | | height: 45px !important; |
| | | } |
| | | .custom-submenu { |
| | | |
| | | |
| | | height: 90px !important; |
| | | } |
| | | |
| | | |
| | | .header-container { |
| | | |
| | |
| | | |
| | | .header-left { |
| | | margin-right: auto; |
| | | width:30px; |
| | | |
| | | } |
| | | .el-aside { |
| | |
| | |
|
| | | .tag i {
|
| | | margin-left: 5px;
|
| | | font-size: 12px;
|
| | | font-size: 5px;
|
| | | cursor: pointer;
|
| | | }
|
| | | </style> |
| | |
| | | <template>
|
| | | <div class="app">
|
| | | <!--面包屑导航区域-->
|
| | | <!-- 面包屑导航区域 -->
|
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
|
| | | <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
|
| | | <el-button type="text">{{ $t('Distribute') }}</el-button>
|
| | | <el-button type="text">Electrical</el-button>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link>
|
| | | </el-breadcrumb>
|
| | | |
| | | <div>Parameter</div>
|
| | |
|
| | | <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="messagepack.data">
|
| | | |
| | | <el-form label-width="100px" style="display: flex; flex-wrap: wrap;" :model="messagepack.data">
|
| | | <div id="btn_div">
|
| | | <el-button type="primary" @click="send()">{{ $t('Distribute') }}</el-button>
|
| | | <el-button type="primary" @click="send()" id="xiafa" :disabled="isButtonDisabled">下发参数</el-button>
|
| | | |
| | | </div>
|
| | | <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
|
| | | <el-input style="width: 280px;" class="in_mc" v-model="item.name" readonly></el-input>
|
| | | <el-input v-model.number="item.value" style="width: 80px;"
|
| | | @input="handleChange(index, $event.target.value)"></el-input>
|
| | | </div>
|
| | | <el-input style="width: 280px; border:none;" class="in_mc" v-model="item.name" readonly></el-input> |
| | | <span style="margin-right: 5px; width: 50px;">{{ item.value }}</span>
|
| | | <span style="margin-right: 5px; font-size: 14px;">|</span>
|
| | | <input v-model="item.value2" type="number" style="width: 30px; margin-right: 5px; margin-top: 5px; font-size: 16px;">
|
| | | </div>
|
| | | </el-form>
|
| | | </div>
|
| | | </template>
|
| | | |
| | | <script>
|
| | |
|
| | | import LanguageMixin from '../../lang/LanguageMixin'
|
| | | <script>
|
| | | let socket;
|
| | |
|
| | | export default {
|
| | | name: "Parameter",
|
| | | mixins: [LanguageMixin],
|
| | | data () {
|
| | | data() {
|
| | | return {
|
| | | record: {
|
| | | params: [100, 200, 10, 10, 10, 10],
|
| | | xyData: [
|
| | | { name: "conveyor Velocity(Auto FAST)", value: 0 },
|
| | | { name: "conveyor Velocity(Auto SLOW)", value: 0 },
|
| | | { name: "conveyor Velocity(Manual)", value: 0 },
|
| | | { name: "A01 A02 TURN JOG Velocity", value: 0 },
|
| | | { name: "A01 A02 TRAVEL JOG Velocity", value: 0 },
|
| | | { name: "B01 B02 TRAVEL JOG Velocity", value: 0 },
|
| | | { name: "A01 A02 TURN POS Velocity AUTO", value: 0 },
|
| | | { name: "A01 A02 TURN POS Velocity manual", value: 0 },
|
| | | { name: "A01 A02 TRAVEL POS Velocity AUTO", value: 0 },
|
| | | { name: "A01 A02 TRAVEL POS Velocity manual", value: 0 },
|
| | | { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 0 },
|
| | | { name: "B01 B02 TRAVEL POS Velocity manual", value: 0 }
|
| | | { name: "conveyor Velocity(Auto FAST)", value: 0, value2: 0 },
|
| | | { name: "conveyor Velocity(Auto SLOW)", value: 0, value2: 0 },
|
| | | { name: "conveyor Velocity(Manual)", value: 0 ,value2: 0 },
|
| | | { name: "A01 A02 TURN JOG Velocity", value: 0, value2: 0 },
|
| | | { name: "A01 A02 TRAVEL JOG Velocity", value: 0, value2: 0 },
|
| | | { name: "B01 B02 TRAVEL JOG Velocity", value: 0, value2: 0 },
|
| | | { name: "A01 A02 TURN POS Velocity AUTO", value: 0, value2: 0 },
|
| | | { name: "A01 A02 TURN POS Velocity manual", value: 0, value2: 0 },
|
| | | { name: "A01 A02 TRAVEL POS Velocity AUTO", value: 0, value2: 0 },
|
| | | { name: "A01 A02 TRAVEL POS Velocity manual", value: 0, value2: 0 },
|
| | | { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 0, value2: 0 },
|
| | | { name: "B01 B02 TRAVEL POS Velocity manual", value: 0, value2: 0 }
|
| | | ],
|
| | | canshu: []
|
| | | },
|
| | |
| | | }
|
| | | };
|
| | | },
|
| | | created () {
|
| | | |
| | | |
| | | created() {
|
| | | this.initWebSocket();
|
| | | this.isButtonDisabled = true;
|
| | | },
|
| | | methods: {
|
| | | initWebSocket () {
|
| | | initWebSocket() {
|
| | | let viewname = "Parameter";
|
| | |
|
| | | |
| | | if (typeof WebSocket === "undefined") {
|
| | | console.log("您的浏览器不支持WebSocket");
|
| | | } else {
|
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | |
|
| | | |
| | | if (socket != null) {
|
| | | socket.close();
|
| | | socket = null;
|
| | | }
|
| | |
|
| | | |
| | | // 开启一个websocket服务
|
| | | socket = new WebSocket(socketUrl);
|
| | |
|
| | | |
| | | // 打开事件
|
| | | socket.onopen = function () {
|
| | | console.log("websocket已打开");
|
| | | };
|
| | |
|
| | | |
| | | // 收到消息
|
| | | socket.onmessage = (msg) => {
|
| | | if (!msg.data) {
|
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑
|
| | | }
|
| | | if (!msg.data) {
|
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑
|
| | | }
|
| | |
|
| | | let obj = JSON.parse(msg.data);
|
| | | this.record.params[0] = obj.params[0];
|
| | | let obj = JSON.parse(msg.data);
|
| | | this.record.params[0] = obj.params[0];
|
| | | this.record.state = obj.state[0];
|
| | |
|
| | | for (let a = 0; a <= this.record.params[0].length - 1; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | } else {
|
| | | this.record.xyData[a].value = this.record.params[0][a];
|
| | | }
|
| | | }
|
| | | let isButtonDisabled = this.record.state.includes(1); |
| | | // 判断state中是否存在1
|
| | | console.log(isButtonDisabled)
|
| | | this.isButtonDisabled = isButtonDisabled; // 将判断结果保存到变量isButtonDisabled中
|
| | |
|
| | | console.log(this.record.xyData);
|
| | | this.$forceUpdate();
|
| | | };
|
| | | for (let a = 0; a <= this.record.params[0].length - 1; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | } else {
|
| | | this.record.xyData[a].value = this.record.params[0][a];
|
| | | }
|
| | | }
|
| | |
|
| | | console.log(this.record.xyData);
|
| | | this.$forceUpdate();
|
| | | };
|
| | | |
| | | // 关闭事件
|
| | | socket.onclose = function () {
|
| | | console.log("websocket已关闭");
|
| | | };
|
| | |
|
| | | |
| | | // 发生错误事件
|
| | | socket.onerror = function () {
|
| | | console.log("websocket发生了错误");
|
| | | };
|
| | | }
|
| | | },
|
| | | send () {
|
| | | this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value)); // 转换为整数数组
|
| | | send() {
|
| | | this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value2)); // 转换为整数数组
|
| | | console.log(this.messagepack);
|
| | | socket?.send(JSON.stringify(this.messagepack));
|
| | | },
|
| | | handleChange (index, value) {
|
| | | handleChange(index, value) {
|
| | | this.record.xyData[index].value = value;
|
| | | }
|
| | | }
|
| | | };
|
| | | </script>
|
| | | |
| | |
|
| | | <style>
|
| | | .kuai_div {
|
| | | width: 30%;
|
| | | width: calc(100% / 3);
|
| | | margin-bottom: 15px;
|
| | | }
|
| | |
|
| | | .el-input {
|
| | | border: none;
|
| | | }
|
| | |
|
| | | .el-input__inner {
|
| | | border: 1px solid black;
|
| | | }
|
| | | .in_mc{
|
| | |
|
| | | .in_mc .el-input__inner {
|
| | | border: none;
|
| | | border:none;
|
| | | }
|
| | |
|
| | |
|
| | | #btn_div {
|
| | | width: 100%;
|
| | |
| | | #btn_div .el-button {
|
| | | float: right;
|
| | | }
|
| | | </style> |
| | | input[type="number"]::-webkit-inner-spin-button,
|
| | | input[type="number"]::-webkit-outer-spin-button {
|
| | | -webkit-appearance: none;
|
| | | margin: 0;
|
| | | }
|
| | |
|
| | | input[type="number"] {
|
| | | -moz-appearance: textfield; /* Firefox中禁用上下箭头 */
|
| | | }
|
| | | </style>
|
| | |
| | | <!--面包屑导航区域-->
|
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
|
| | | <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
|
| | | <el-button type="text">Electrical</el-button>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link>
|
| | | <el-button type="text">{{ $t('Electrical') }}</el-button>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">{{ $t('Parameter') }}</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">{{ $t('Action') }}</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">{{ $t('Sign') }}</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text">{{ $t('State') }}</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">{{ $t('Alarm') }}</router-link>
|
| | | </el-breadcrumb>
|
| | | <div>Sign</div>
|
| | | <div style="padding-right: 30px;display: flex;flex-wrap: wrap;" class="neir">
|
| | |
| | | </template>
|
| | |
|
| | | <script >
|
| | | import LanguageMixin from '../../lang/LanguageMixin'
|
| | | let socket;
|
| | | export default {
|
| | | name: "Sign",
|
| | | mixins: [LanguageMixin],
|
| | | data () {
|
| | | return {
|
| | | record: {
|
| | |
| | | let obj = JSON.parse(msg.data);
|
| | | //this.$set(this.record.params, 0, obj.params[0]);
|
| | | this.record.params[0] = obj.sig[0];
|
| | | for (let a = 0; a <= this.record.params.length; a++) {
|
| | | for (let a = 0; a <= this.record.xyData[0] - 1; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | } else {
|
| | |
| | | <!--面包屑导航区域-->
|
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
|
| | | <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
|
| | | <el-button type="text">Electrical</el-button>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link>
|
| | | <el-button type="text">{{ $t('Electrical') }}</el-button>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">{{ $t('Parameter') }}</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">{{ $t('Action') }}</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">{{ $t('Sign') }}</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text">{{ $t('State') }}</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">{{ $t('Alarm') }}</router-link>
|
| | | </el-breadcrumb>
|
| | | <div>State</div>
|
| | |
|
| | |
|
| | | <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="messagepack.data">
|
| | | <div id="btn_div">
|
| | | <el-button type="primary" @click="send()">Distribute</el-button>
|
| | | <!-- <button @click="send()">测试发送</button> -->
|
| | | </div>
|
| | |
|
| | | <div class="kuai_div" v-for="item in this.record.xyData" :key="item.name">
|
| | | <el-input style="width: 280px;" class="in_mc" v-model="item.name"></el-input>
|
| | | <el-input v-model="item.value" style="width: 80px;"></el-input>
|
| | | <el-input v-model.number="item.value" style="width: 80px;"></el-input>
|
| | | </div>
|
| | |
|
| | |
|
| | |
| | | </template>
|
| | |
|
| | | <script >
|
| | |
|
| | | import LanguageMixin from '../../lang/LanguageMixin'
|
| | | let socket;
|
| | | export default {
|
| | | name: "State",
|
| | | mixins: [LanguageMixin],
|
| | | data () {
|
| | | return {
|
| | | record: {
|
| | | params: [0, 0, 0, 0, 0, 0, 0, 0, 0,],
|
| | | params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
|
| | | xyData: [
|
| | | { name: 'D01.State', value: 0 },
|
| | | { name: 'D02.State', value: 0 },
|
| | |
| | | { name: 'D05.State', value: 0 },
|
| | | { name: 'D06.State', value: 0 },
|
| | | ],
|
| | | canshu: [
|
| | | 'D01.State',
|
| | | 'D02.State',
|
| | | 'B01.State',
|
| | | 'B02.State',
|
| | | 'A01.State',
|
| | | 'A02.State',
|
| | | 'D03.State',
|
| | | 'D04.State',
|
| | | 'D05.State',
|
| | | 'D06.State',
|
| | | ],
|
| | | // canshu: [
|
| | | // 'D01.State',
|
| | | // 'D02.State',
|
| | | // 'B01.State',
|
| | | // 'B02.State',
|
| | | // 'A01.State',
|
| | | // 'A02.State',
|
| | | // 'D03.State',
|
| | | // 'D04.State',
|
| | | // 'D05.State',
|
| | | // 'D06.State',
|
| | | // ],
|
| | |
|
| | | },
|
| | |
|
| | |
| | | //console.log("收到数据====" + msg.data);
|
| | | let obj = JSON.parse(msg.data);
|
| | | this.record.params[0] = obj.sta[0];
|
| | | for (let a = 0; a <= this.record.params.length; a++) {
|
| | | //this.record.xyData[a] = [this.record.params[0][a], this.record.canshu[a]];
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | for (let a = 0; a <= this.record.xyData[0].length - 1; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | } else {
|
| | | this.record.xyData[a].value = this.record.params[0][a];
|
| | | }
|
| | |
|
| | | }
|
| | | this.$forceUpdate();
|
| | | console.log(this.record.xyData);
|
| | | //console.log(this.record.params[0])
|
| | | // console.log(this.records.canshu);
|
| | |
|
| | | }.bind(this);
|
| | | //关闭事件
|
| | |
| | | }
|
| | | },
|
| | | send () {
|
| | | this.messagepack.data = { taskname: "前端到后台" };
|
| | | socket?.send(JSON.stringify(this.messagepack)); // 将组装好的json发送给服务端,由服务端进行转发
|
| | | this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value)); // 转换为整数数组
|
| | | console.log(this.messagepack);
|
| | | socket?.send(JSON.stringify(this.messagepack));
|
| | | },
|
| | | handleChange (index, value) {
|
| | | this.record.xyData[index].value = value;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <!--面包屑导航区域--> |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link> |
| | | <el-button type="text">Electrical</el-button> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link> |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link> |
| | | <el-button type="text">{{ $t('Electrical') }}</el-button> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">{{ $t('Parameter') }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">{{ $t('Action') }}</router-link> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">{{ $t('Sign') }}</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text">{{ $t('State') }}</router-link> |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">{{ $t('Alarm') }}</router-link> |
| | | </el-breadcrumb> |
| | | <div>Alarm</div> |
| | | <!-- <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }"> |
| | | <div class="kuai_div" v-for="item in this.record.xyData" :key="item[1]"> |
| | | <el-input v-model="item[1]" style="width: 240px;" class="in_mc"></el-input> |
| | | <el-switch v-model="item[0]" active-value="0" inactive-value="1"></el-switch> |
| | | </div> |
| | | </el-form> --> |
| | | <div class="block"> |
| | | <span class="demonstration">时间:</span> |
| | | <el-date-picker v-model="shijian1" type="datetime" placeholder="选择日期时间" align="right" |
| | | :picker-options="pickerOptions"> |
| | | </el-date-picker> |
| | | ~ |
| | | <el-date-picker v-model="shijian2" type="datetime" placeholder="选择日期时间" align="right" |
| | | :picker-options="pickerOptions"> |
| | | </el-date-picker> |
| | | <el-button type="primary" @click="selectTime()">查询</el-button> |
| | | </div> |
| | | |
| | | <el-table :data="localizedRoles" style="width: 100%;" height="590"> |
| | | <el-table :data="localizedRoles" style="width: 100%;" height="550"> |
| | | <el-table-column prop="id" label="id" width="80"> |
| | | </el-table-column> |
| | | <el-table-column prop="content" label="content"> |
| | |
| | | </template> |
| | | |
| | | <script > |
| | | import { setAll } from "../../api/alarm"; |
| | | import { setAll, setTime } from "../../api/alarm"; |
| | | |
| | | import moment from 'moment'; |
| | | //setTime |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | let socket; |
| | | export default { |
| | |
| | | |
| | | }, |
| | | roles: [], |
| | | |
| | | localizedRoles: [], |
| | | |
| | | messagepack: { |
| | | data: { taskname: "" } |
| | | }, |
| | |
| | | data: "1", |
| | | pageSize: 10 |
| | | }, |
| | | pickerOptions: { |
| | | shortcuts: [{ |
| | | text: '今天', |
| | | onClick (picker) { |
| | | picker.$emit('pick', new Date()); |
| | | } |
| | | }, { |
| | | text: '昨天', |
| | | onClick (picker) { |
| | | const date = new Date(); |
| | | date.setTime(date.getTime() - 3600 * 1000 * 24); |
| | | picker.$emit('pick', date); |
| | | } |
| | | }, { |
| | | text: '一周前', |
| | | onClick (picker) { |
| | | const date = new Date(); |
| | | date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); |
| | | picker.$emit('pick', date); |
| | | } |
| | | }], |
| | | |
| | | }, |
| | | shijian1: "", |
| | | shijian2: "", |
| | | } |
| | | |
| | | |
| | | }, |
| | | created () { |
| | | this.init(); |
| | | this.load(); |
| | | |
| | | |
| | | if (this.shijian1 == "" || this.shijian2 == "") { |
| | | this.load(); |
| | | } |
| | | else { |
| | | this.selectTime(); |
| | | } |
| | | |
| | | }, |
| | | methods: { |
| | | |
| | | load () { |
| | | setAll().then(res => { |
| | | this.roles = res.data.list; |
| | |
| | | } else { |
| | | this.localizedRoles = [...this.roles]; |
| | | } |
| | | console.log(this.localizedRoles); |
| | | //console.log(this.localizedRoles); |
| | | }); |
| | | |
| | | }, |
| | | selectTime () { |
| | | let sj1 = moment(this.shijian1).format('YYYY-MM-DD%20HH:mm'); |
| | | let sj2 = moment(this.shijian2).format('YYYY-MM-DD%20HH:mm') |
| | | |
| | | setTime(sj1, sj2).then(res => { |
| | | this.roles = res.data.list; |
| | | const language = this.$i18n.locale; |
| | | if (language === 'zh-CN') { |
| | | this.replaceChineseWithEnglish(); |
| | | } else { |
| | | this.localizedRoles = [...this.roles]; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | replaceChineseWithEnglish () { |
| | | const translation = this.$t('translation'); |
| | | this.localizedRoles = this.roles.map(role => ({ |
| | |
| | | content: translation[role.content] || role.content |
| | | })); |
| | | }, |
| | | |
| | | init () { |
| | | let viewname = "alarm"; |
| | | |
| | |
| | | |
| | | this.record.params[0] = obj.arm; |
| | | //每次请求更新数据 |
| | | this.load(); |
| | | if (this.shijian1 == "" || this.shijian2 == "") { |
| | | this.load(); |
| | | } |
| | | else { |
| | | this.selectTime(); |
| | | } |
| | | this.$forceUpdate(); |
| | | }.bind(this); |
| | | //关闭事件 |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="角色" prop="roleId"> |
| | | <el-select filterable v-model="addUserForm.roleId" placeholder="请选择"> |
| | | <el-form-item :label="$t('role')" prop="roleId"> |
| | | <el-select filterable v-model="addUserForm.roleId" :placeholder="$t('langSelect')" > |
| | | <el-option v-for="item in roleList" |
| | | :key="item.id" |
| | | :value="item.id" |
| | |
| | | <el-input v-model="editUserForm.username" disabled></el-input> |
| | | </el-form-item> |
| | | <el-form-item :label="$t('role')" prop="roleId"> |
| | | <el-select filterable v-model="editUserForm.roleId" placeholder="请选择"> |
| | | <el-select filterable v-model="editUserForm.roleId" :placeholder="$t('langSelect')" > |
| | | <el-option v-for="item in roleList" |
| | | :key="item.id" |
| | | :value="item.id" |
| | |
| | | if (!valid) return; |
| | | |
| | | saveOrUpdate(this.editUserForm).then(() => { |
| | | this.$message.success("修改用户成功"); |
| | | const 修改用户成功 = this.$t('修改用户成功'); |
| | | this.$message.success(修改用户成功); |
| | | // 隐藏添加分类对话框 |
| | | this.editDialogVisible = false; |
| | | // 重新获取分类列表 |
| | |
| | | package com.example.springboot.component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.websocket.Session; |
| | | |
| | | import com.example.springboot.controller.SpianController; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | |
| | | while (this != null) { |
| | | try { |
| | | |
| | | Thread.sleep(10000); |
| | | Thread.sleep(500); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | List<Boolean> bitlist = S7control.getinstance().ReadBits("DB2.0.0", 100); |
| | | |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.6", 1); |
| | | |
| | | |
| | | //判断进片请求 |
| | | // List<Short> datas1List=S7control.getinstance().ReadWord("DB106.24", 1); |
| | | // List<Short> datas1ListState=S7control.getinstance().ReadWord("DB106.8", 1); |
| | | SpianController spianController=new SpianController(); |
| | | List<Short> datas1List1=new ArrayList<>(); |
| | | List<Short> datas1List2=new ArrayList<>(); |
| | | datas1List1.add((short)1); |
| | | datas1List2.add((short)0); |
| | | //获取prc进片请求数据 |
| | | boolean exist = datas1List1.contains((short)1); |
| | | boolean exist1 = datas1List2.contains((short)0); |
| | | //进片请求为1时 |
| | | if(exist=true){ |
| | | //当进片车空闲时 |
| | | if(exist=true){ |
| | | List<Short> datas1ListID=S7control.getinstance().ReadWord("DB106.26", 13); |
| | | //获取玻璃id |
| | | for(Short list1:datas1ListID) |
| | | spianController.selectAll(list1); |
| | | } |
| | | //System.out.println(exist); |
| | | |
| | | } |
| | | //获取进片id |
| | | // List<Short> datas1ListID=S7control.getinstance().ReadWord("DB106.26", 13); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 查询数据库 |
| | | // 推送到前端 |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | public class PlcParameter extends Thread { |
| | | private static final int SEND_INTERVAL = 10000; |
| | | private static final int WRITE_INTERVAL = 100; |
| | | |
| | | @Override |
| | | |
| | | public void run() { |
| | | try { |
| | | // 发送一次消息 |
| | | sendMessages(); |
| | | |
| | | // 延迟一段时间 |
| | | Thread.sleep(SEND_INTERVAL); |
| | | |
| | | while (true) { |
| | | // 写入PLC |
| | | writeToPlc(); |
| | | Thread.sleep(WRITE_INTERVAL); |
| | | |
| | | // 发送消息 |
| | | sendMessages(); |
| | | Thread.sleep(SEND_INTERVAL); |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private void sendMessages() { |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | if (sendwServer != null) { |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12); |
| | | List<Short> state = S7control.getinstance().ReadWord("DB103.DBW0", 10); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0} |
| | | jsonObject.append("params", new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}); |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | } |
| | | jsonObject.append("params", new short[]{1111,121, 3232, 0, 1, 0, 1, 0, 1, 0, 1, 0}); |
| | | jsonObject.append("state", new short[]{0, 1, 0, 0, 0, 0, 0,0, 0, 0}); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | private void writeToPlc() { |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | |
| | | String addressList = "DB100.DBW0"; |
| | | String addressList = "DB100.DBW0"; |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | System.out.println("messages:" + messages); |
| | | String[] parts = lastMessage.split(","); |
| | | List<Short> messageValues = new ArrayList<>(); |
| | | for (String part : parts) { |
| | | try { |
| | | // 使用正则表达式清除非数字字符 |
| | | String cleanedPart = part.replaceAll("[^0-9-]", ""); |
| | | short value = Short.parseShort(cleanedPart.trim()); |
| | | messageValues.add(value); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | e.printStackTrace(); |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | System.out.println("messages:" + messages); |
| | | String[] parts = lastMessage.split(","); |
| | | List<Short> messageValues = new ArrayList<>(); |
| | | for (String part : parts) { |
| | | try { |
| | | // 使用正则表达式清除非数字字符 |
| | | String cleanedPart = part.replaceAll("[^0-9-]", ""); |
| | | short value = Short.parseShort(cleanedPart.trim()); |
| | | messageValues.add(value); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 将消息值写入 PLC |
| | | S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | // 将消息值写入 PLC |
| | | S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import cn.hutool.json.JSONObject;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | |
|
| | | public class Plcaction extends Thread {
|
| | | private static final long SEND_INTERVAL = 2000; // 发送消息的时间间隔
|
| | | private static final long WRITE_INTERVAL = 100; // 写入PLC的时间间隔
|
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | try {
|
| | | // 发送一次消息
|
| | | sendMessages();
|
| | |
|
| | | // 延迟一段时间
|
| | | Thread.sleep(SEND_INTERVAL);
|
| | |
|
| | | while (true) {
|
| | | // 写入PLC
|
| | | writeToPlc();
|
| | | Thread.sleep(WRITE_INTERVAL);
|
| | |
|
| | | // 发送消息
|
| | | sendMessages();
|
| | | Thread.sleep(SEND_INTERVAL);
|
| | | while (this != null) {
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | // List<Boolean> paramlist = S7control.getinstance().ReadBits("DB100.DBW", 12);
|
| | | ////
|
| | | // JSONObject jsonObject = new JSONObject();
|
| | | // jsonObject.append("params", new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0});
|
| | |
|
| | | private void sendMessages() {
|
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
|
| | | if (sendwServer != null) {
|
| | | // List<Boolean> paramlist = S7control.getinstance().ReadBits("DB100.DBW", 12);
|
| | | Boolean[] values = {false, true,false, true,false, true,false, true,false, true,false, true,false, true,false, true,false, true,false, true,false, true};
|
| | | List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
|
| | | if (paramlist == null) {
|
| | |
|
| | | List<Boolean> paramlist = S7control.getinstance().ReadBits("DB100.DBW", 12);
|
| | | // new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
| | | // 1, 0}
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | jsonObject.append("params",
|
| | | new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 });
|
| | | } else {
|
| | | short[] params = new short[paramlist.size()];
|
| | |
|
| | | sendwServer.sendMessage(jsonObject.toString());
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void writeToPlc() {
|
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
|
| | | if (webSocketServer != null) {
|
| | | List<String> messages = webSocketServer.getMessages();
|
| | |
|
| | | String addressList = "DB100.DBW0";
|
| | |
|
| | | if (!messages.isEmpty()) {
|
| | | // 将最后一个消息转换为整数类型的列表
|
| | | String lastMessage = messages.get(messages.size() - 1);
|
| | | System.out.println("messages:" + messages);
|
| | | String[] parts = lastMessage.split(",");
|
| | | List<Integer> messageValues = new ArrayList<>();
|
| | | for (String part : parts) {
|
| | | try {
|
| | | // 使用正则表达式清除非数字字符
|
| | | String cleanedPart = part.replaceAll("[^0-9-]", "");
|
| | | Integer value = Integer.parseInt(cleanedPart.trim());
|
| | | messageValues.add(value);
|
| | | } catch (NumberFormatException e) {
|
| | | // 如果无法解析为整数类型,则忽略该部分
|
| | | e.printStackTrace();
|
| | | }
|
| | | for (int i = 0; i < paramlist.size(); i++) {
|
| | | boolean value = paramlist.get(i);
|
| | | params[i] = value ? (short) 1 : (short) 0;
|
| | | }
|
| | |
|
| | | // 将消息值转换为布尔列表
|
| | | List<Boolean> messageBooleans = new ArrayList<>();
|
| | | for (Integer value : messageValues) {
|
| | | messageBooleans.add(value == 0 ? true : false);
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | jsonObject.append("params", params);
|
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
|
| | | if (sendwServer != null) {
|
| | | sendwServer.sendMessage(jsonObject.toString());
|
| | | }
|
| | | }
|
| | |
|
| | | // 将布尔列表写入 PLC
|
| | | S7control.getinstance().WriteBit(addressList, messageBooleans);
|
| | | System.out.println("messageValues:" + messageBooleans);
|
| | | System.out.println("addressList:" + addressList);
|
| | |
|
| | | // 清空消息列表
|
| | | webSocketServer.clearMessages();
|
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
|
| | | if (webSocketServer != null) {
|
| | |
|
| | | List<String> messages = webSocketServer.getMessages();
|
| | |
|
| | | String addressList = "DB100.DBW0";
|
| | |
|
| | | if (!messages.isEmpty()) {
|
| | | // 将最后一个消息转换为整数类型的列表
|
| | | String lastMessage = messages.get(messages.size() - 1);
|
| | | System.out.println("messages:" + messages);
|
| | | String[] parts = lastMessage.split(",");
|
| | | List<Integer> messageValues = new ArrayList<>();
|
| | | for (String part : parts) {
|
| | | try {
|
| | | // 使用正则表达式清除非数字字符
|
| | | String cleanedPart = part.replaceAll("[^0-9-]", "");
|
| | | Integer value = Integer.parseInt(cleanedPart.trim());
|
| | | messageValues.add(value);
|
| | | } catch (NumberFormatException e) {
|
| | | // 如果无法解析为整数类型,则忽略该部分
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | // 将消息值转换为布尔列表
|
| | | List<Boolean> messageBooleans = new ArrayList<>();
|
| | | for (Integer value : messageValues) {
|
| | | messageBooleans.add(value == 0 ? true : false);
|
| | | }
|
| | |
|
| | | // 将布尔列表写入 PLC
|
| | | S7control.getinstance().WriteBit(addressList, messageBooleans);
|
| | | System.out.println("messageValues:" + messageBooleans);
|
| | | System.out.println("addressList:" + addressList);
|
| | | // 清空消息列表
|
| | | webSocketServer.clearMessages();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private List<Boolean> paramList() {
|
| | | // 获取参数列表的逻辑
|
| | |
|
| | | return new ArrayList<>(); // 假设返回空列表
|
| | | }
|
| | | } |
| | | }
|
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12); |
| | | |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // // jsonObject.append("params", paramlist); |
| | | // jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| | | // 11, }); |
| | | // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | // if (sendwServer != null) { |
| | | // sendwServer.sendMessage(jsonObject.toString()); |
| | | // } |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.DBx0.0", 40); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | |
| | | jsonObject.append("arm", |
| | | new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, |
| | | 1, 0, 1, 0, 1, 0, 1, 0, 1, }); |
| | | jsonObject.append("params", plclist); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("alarm"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | Short[] shuzu1 = { |
| | | 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, |
| | | 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | }; |
| | | Short[] shuzu1 = plclist.toArray(new Short[0]); |
| | | // Short[] shuzu1 = { |
| | | // 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
| | | // 1, 0, 1, 0, 0, |
| | | // 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | // }; |
| | | |
| | | String[] shuzu = { |
| | | "D01 VFD error", |
| | |
| | | // alarmMapper.updatealarm(shuzu[i]); |
| | | } |
| | | } |
| | | |
| | | // 写 |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | |
| | | String addressList = "DB100.DBW0"; |
| | | // addressList.add("DB100.DBW0"); |
| | | // addressList.add("DB100.DBW2"); |
| | | // addressList.add("DB100.DBW4"); |
| | | // addressList.add("DB100.DBW6"); |
| | | // addressList.add("DB100.DBW8"); |
| | | // addressList.add("DB100.DBW10"); |
| | | // addressList.add("DB100.DBW12"); |
| | | // addressList.add("DB100.DBW14"); |
| | | // addressList.add("DB100.DBW16"); |
| | | // addressList.add("DB100.DBW18"); |
| | | // addressList.add("DB100.DBW20"); |
| | | // addressList.add("DB100.DBW22"); |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | System.out.println("messages:" + messages); |
| | | String[] parts = lastMessage.split(","); |
| | | List<Short> messageValues = new ArrayList<>(); |
| | | for (String part : parts) { |
| | | try { |
| | | // 使用正则表达式清除非数字字符 |
| | | String cleanedPart = part.replaceAll("[^0-9-]", ""); |
| | | short value = Short.parseShort(cleanedPart.trim()); |
| | | messageValues.add(value); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 将消息值写入 PLC |
| | | // S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12); |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.DBX0.0", 58); |
| | | |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // // jsonObject.append("params", paramlist); |
| | | // jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| | | // 11, }); |
| | | // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | // if (sendwServer != null) { |
| | | // sendwServer.sendMessage(jsonObject.toString()); |
| | | // } |
| | | |
| | | JSONObject jsonObject3 = new JSONObject(); |
| | | jsonObject3.append("sig", |
| | | new short[] { 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
| | | 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, }); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject3.append("sig", |
| | | // new short[] { 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | // 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
| | | // 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | // }); |
| | | jsonObject.append("sig", plclist); |
| | | WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign"); |
| | | if (sendwServer3 != null) { |
| | | sendwServer3.sendMessage(jsonObject3.toString()); |
| | | sendwServer3.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Sign"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | |
| | | String addressList = "DB100.DBW0"; |
| | | // addressList.add("DB100.DBW0"); |
| | | // addressList.add("DB100.DBW2"); |
| | | // addressList.add("DB100.DBW4"); |
| | | // addressList.add("DB100.DBW6"); |
| | | // addressList.add("DB100.DBW8"); |
| | | // addressList.add("DB100.DBW10"); |
| | | // addressList.add("DB100.DBW12"); |
| | | // addressList.add("DB100.DBW14"); |
| | | // addressList.add("DB100.DBW16"); |
| | | // addressList.add("DB100.DBW18"); |
| | | // addressList.add("DB100.DBW20"); |
| | | // addressList.add("DB100.DBW22"); |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | System.out.println("messages:" + messages); |
| | | String[] parts = lastMessage.split(","); |
| | | List<Short> messageValues = new ArrayList<>(); |
| | | for (String part : parts) { |
| | | try { |
| | | // 使用正则表达式清除非数字字符 |
| | | String cleanedPart = part.replaceAll("[^0-9-]", ""); |
| | | short value = Short.parseShort(cleanedPart.trim()); |
| | | messageValues.add(value); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 将消息值写入 PLC |
| | | // S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12); |
| | | |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // // jsonObject.append("params", paramlist); |
| | | // jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| | | // 11, }); |
| | | // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | // if (sendwServer != null) { |
| | | // sendwServer.sendMessage(jsonObject.toString()); |
| | | // } |
| | | List<Short> plclist = S7control.getinstance().ReadWord("DB103.DBW0", 10); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sta", |
| | | new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, |
| | | 1, }); |
| | | // jsonObject.append("sta", |
| | | // new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, }); |
| | | jsonObject.append("sta", plclist); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("State"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("State"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | |
| | | String addressList = "DB100.DBW0"; |
| | | // addressList.add("DB100.DBW0"); |
| | | // addressList.add("DB100.DBW2"); |
| | | // addressList.add("DB100.DBW4"); |
| | | // addressList.add("DB100.DBW6"); |
| | | // addressList.add("DB100.DBW8"); |
| | | // addressList.add("DB100.DBW10"); |
| | | // addressList.add("DB100.DBW12"); |
| | | // addressList.add("DB100.DBW14"); |
| | | // addressList.add("DB100.DBW16"); |
| | | // addressList.add("DB100.DBW18"); |
| | | // addressList.add("DB100.DBW20"); |
| | | // addressList.add("DB100.DBW22"); |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | System.out.println("messages:" + messages); |
| | | String[] parts = lastMessage.split(","); |
| | | List<Short> messageValues = new ArrayList<>(); |
| | | for (String part : parts) { |
| | | try { |
| | | // 使用正则表达式清除非数字字符 |
| | | String cleanedPart = part.replaceAll("[^0-9-]", ""); |
| | | short value = Short.parseShort(cleanedPart.trim()); |
| | | messageValues.add(value); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 将消息值写入 PLC |
| | | // S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.example.springboot.entity.alarmmg; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | import com.example.springboot.service.AlarmService; |
| | | import com.microsoft.schemas.office.office.STInsetMode; |
| | | |
| | | @RestController |
| | | @RequestMapping("/alarm") |
| | |
| | | |
| | | @GetMapping("/load") |
| | | public Result selectAll() { |
| | | List<alarmmg> storageCagelist = alarmMapper.selectAll(); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<alarmmg> storageCagelist = alarmMapper.selectAll(); |
| | | map.put("list", storageCagelist); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/stTime") |
| | | public Result selecttime(String shijian1, String shijian2) { |
| | | System.out.println("++++++"); |
| | | System.out.println(shijian1); |
| | | |
| | | if (shijian1 != "" || shijian2 != "") { |
| | | String sj1 = shijian1.replace("#20", " "); |
| | | String sj2 = shijian2.replace("#20", " "); |
| | | List<alarmmg> storageCagelist = alarmMapper.selecttime(sj1, sj2); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", storageCagelist); |
| | | return Result.success(map); |
| | | } else { |
| | | List<alarmmg> storageCagelist = alarmMapper.selectAll(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", storageCagelist); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | }else{ |
| | | map.put("message2","200"); |
| | | //调用伍上片函数 |
| | | |
| | | } |
| | | return Result.success(map); |
| | | } |
| | |
| | | package com.example.springboot.controller; |
| | | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | import com.example.springboot.service.SpianService; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | @RestController |
| | |
| | | |
| | | @Autowired |
| | | SpianMapper spianMapper; |
| | | |
| | | |
| | | @Autowired |
| | | SpianService spianservice; |
| | | //出片任务 |
| | | @GetMapping("/all2") |
| | | public Result selectdd(String orderid){ |
| | | //获取优先出片的位置 |
| | | StorageCage cageout=spianMapper.selectOut(orderid); |
| | | int cage =cageout.getCage(); //储存出片位置,笼子格子几号玻璃 |
| | | int cell =cageout.getCell(); |
| | | int tier =cageout.getTier(); |
| | | double glasswidth=cageout.getGlassWidth(); |
| | | //判断玻璃内外片 |
| | | if(tier==2){ |
| | | //判断玻璃可直接出片时 |
| | | return Result.success("执行出片"); |
| | | } |
| | | else{ |
| | | //获取格子的玻璃数量 |
| | | int state= spianMapper.selectGlassState(cage,cell); |
| | | //判断内片是否需要调拨 |
| | | if(state==0){ |
| | | return Result.success("状态为0,直接出片"); |
| | | }else{ |
| | | //玻璃需要调拨时,判断属于哪个半区的笼子 |
| | | if(cage<6){ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,0,6); |
| | | //获取调拨位置进行调拨 |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | //判断调拨结束后再次出片 |
| | | }else{ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,5,11); |
| | | //获取调拨位置进行调拨 |
| | | StorageCage ca=cagecell; |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | //判断调拨结束后再次出片 |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | public void selectdd(String orderid){ |
| | | SpianService service=new SpianService(); |
| | | service.selectadd(orderid); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/all") |
| | | //进片任务,传订单id |
| | | //按订单优先进片 |
| | | public Result selectAll(String orderid){ |
| | | //return spianMapper.selectAll(); |
| | | int cage1; |
| | | //String orderid="A001"; |
| | | //获取订单相关度最高的笼子排序 |
| | | List<StorageCage> storageCage=spianMapper.selectAll(orderid); |
| | | for (StorageCage storageCage2 : storageCage) { |
| | | //保存订单优先顺序笼子号 |
| | | cage1=storageCage2.getCage(); |
| | | //判断该笼子号相邻最大的空格数 |
| | | int cages=spianMapper.selectCage(cage1); |
| | | //判断选中笼子是否有空格 |
| | | StorageCage cages1=spianMapper.selectCage1(cage1); |
| | | //有合适空格时进片 |
| | | if(cages>1 &&cages1.getTier()!=null){ |
| | | //执行进片 |
| | | return Result.success(cages1); |
| | | }else{ |
| | | //返回不可进片 |
| | | } |
| | | |
| | | |
| | | } |
| | | return Result.success("不可进片"); |
| | | public void selectAll(Short glassid){ |
| | | SpianService service=new SpianService(); |
| | | service.selectAll(glassid); |
| | | |
| | | } |
| | | |
| | | |
| | | @PostMapping("/save") |
| | | public Result save(@RequestBody StorageCage spian){ |
| | | spianservice.Save(spian); |
| | | return Result.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | @Mapper |
| | | public interface AlarmMapper { |
| | | @Select("SELECT * FROM alarmmg") |
| | | @Select("SELECT * FROM alarmmg where endTime is not null and to_days(timeon)=to_days(now())") |
| | | List<alarmmg> selectAll(); |
| | | |
| | | @Select("SELECT count(*) FROM alarmmg where endTime is null and content=#{content}") |
| | |
| | | |
| | | @Insert("UPDATE `canadames`.`alarmmg` set endTime= now() where endTime is null and content=#{content}") |
| | | void updatealarm(String content); |
| | | |
| | | @Select("SELECT * FROM alarmmg where timeon between #{sj1} and #{sj2}") |
| | | List<alarmmg> selecttime(String sj1, String sj2); |
| | | } |
| | |
| | | |
| | | public interface SpianMapper { |
| | | //判断相邻笼子是否有空格 |
| | | @Select("select COUNT(if(a.state1=0,cell,null))as cell 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(#{cage1}<6,a.cage>0 and a.cage<6,a.cage>5) GROUP BY cage ORDER BY cell desc LIMIT 1") |
| | | @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(#{cage1}<6,a.cage>0 and a.cage<6,a.cage>5) 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 id LIMIT 1)union (select a.* from storage_cage a inner join (select cage,if(shu2=1,shu3,shu5) as gezi from ( select cage, count(case when state1=1 and state2=0 then cell else null end)as shu1, count(case when state1=0 then cell else null end) as shu2, min(case when state1=1 and state2=0 then cell else null end) as shu3, min(case when state1=0 then cell else null end) as shu4, min(case when state1=0 or state2=0 then cell else null end) as shu5 from (select *,max(state) as state1,min(state) as state2 from storage_cage group by cage,cell) as a where cage%2!=0 GROUP BY cage HAVING shu2>1 or (shu2=1 and shu1>0) ) as sss limit 1)as b on a.cage=b.cage and a.cell=b.gezi and a.state=0 order by tier limit 1) ORDER BY id LIMIT 1;") |
| | | //获取订单号排序的空订单笼子 |
| | | @Select("select cage,COUNT(if(order_id=#{glassid},order_id,null))as orderid from storage_cage where (order_id=#{glassid} or ''='') GROUP BY cage ORDER BY orderid desc; ") |
| | | List<StorageCage> selectAll(String glassid); |
| | | List<StorageCage> selectAll(Short glassid); |
| | | |
| | | //判断该笼子是否有合适宽度空格 |
| | | @Select("select COUNT(*),cage,cell,tier from storage_cage where cage=#{cage1} and state=0 and width>=1500 ORDER BY cell,tier") |
| | | StorageCage selectCage1(int cage1); |
| | | @Select("select COUNT(*),cage,cell,IF(tier=1,0,1)as tier,ROUND(id/2)as id from storage_cage where cage=#{cage1} and state=0 and width>=#{width} ORDER BY cell,tier") |
| | | StorageCage selectCage1(int cage1,double width); |
| | | |
| | | //@Update("update longzi set glass_id = #{glass_id}, width = #{width}, state = #{state} where cell = #{cell}") |
| | | @Update("update longzi set glass_id =123, width =1600, state =1 where cell =24") |
| | |
| | | void insert(StorageTask storageTask); |
| | | |
| | | //出片任务查询 |
| | | @Select("select cage,cell,tier,glasswidth from storage_cage as a where a.order_id=#{orderId} and state=1 order by cage desc,tier desc,cell desc LIMIT 1") |
| | | @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as id from storage_cage as a where a.order_id=#{orderId} and state=1 order by cage desc,tier desc,cell desc LIMIT 1") |
| | | StorageCage selectOut(String orderId); |
| | | |
| | | //判断出片为1时,是否可直接出片 |
| | | @Select("select state from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;") |
| | | int selectGlassState(int cage,int cell); |
| | | |
| | | //判断该调拨的笼子 |
| | | @Select("select cage,cell,max(state)as shu from storage_cage where width>=#{width} and cage>#{cage1} and cage<#{cage2} GROUP BY cage,cell HAVING shu=0 order by abs(#{cage} - cage) limit 1;") |
| | | @Select("select cage,cell,max(state)as shu,ROUND(id/2)as id from storage_cage where width>=#{width} and cage>#{cage1} and cage<#{cage2} GROUP BY cage,cell HAVING shu=0 order by abs(#{cage} - cage) limit 1;") |
| | | StorageCage selectGlassCage(int cage,double width,int cage1,int cage2); |
| | | |
| | | |
| | | //修改笼子信息(出片) |
| | | @Update("update storage_cage set state=#{state},width=width+#{width},glass_id=#{glassid},order_id=#{orderid},glasswidth=0 where cage=#{cage} and cell=#{cell} and tier=#{tier};") |
| | | void UpdataGlassCage(String orderid,String glassid,double width,int cage,int cell,int tier,int state); |
| | | |
| | | //修改笼子信息(进片) |
| | | @Update("update storage_cage set state=#{state},width=width-#{width},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where cage=#{cage} and cell=#{cell} and tier=#{tier};") |
| | | void UpdataAddCage(String orderid,Short glassid,double width,int cage,int cell,int tier,int state); |
| | | // @Insert("insert into user(name, date, address, user_no) values (#{name}, #{date}, #{address}, #{userNo})") |
| | | // void insert (Spian spian); |
| | | |
| | |
| | | package com.example.springboot.service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | |
| | |
| | | public class SpianService { |
| | | @Autowired |
| | | private SpianMapper spianMapper; |
| | | public void Save(StorageCage spian){ |
| | | if(spian.getId()==null){ |
| | | spianMapper.update(); |
| | | }else{ |
| | | spianMapper.update(); |
| | | @GetMapping("/all2") |
| | | public Result selectadd(String orderid){ |
| | | //定义PRC数据传送数组 |
| | | List<String> adddresslist=new ArrayList<>(); |
| | | adddresslist.add("DB105.6");//出片车起始位置 |
| | | adddresslist.add("DB105.8");//出片车目标位置 |
| | | adddresslist.add("DB105.10");//出片笼玻璃数 |
| | | adddresslist.add("DB105.14");//出片车启动 1为启动 |
| | | List<Short> datas=new ArrayList<>(); |
| | | //获取优先出片的位置 |
| | | StorageCage cageout=spianMapper.selectOut(orderid); |
| | | int cage =cageout.getCage(); //储存出片位置,笼子格子几号玻璃 |
| | | int cell =cageout.getCell(); |
| | | int tier =cageout.getTier(); |
| | | int id=cageout.getId(); |
| | | int ids; |
| | | double glasswidth=cageout.getGlassWidth(); |
| | | //判断玻璃内外片 |
| | | if(tier==2){ |
| | | //判断玻璃可直接出片时 |
| | | //修改数据库笼子表(出片) |
| | | spianMapper.UpdataGlassCage("","",glasswidth, cage, cell, tier, 0); |
| | | datas.add((short)id); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | return Result.success(datas); |
| | | } |
| | | else{ |
| | | //获取格子的玻璃数量 |
| | | int state= spianMapper.selectGlassState(cage,cell); |
| | | //判断内片是否需要调拨 |
| | | if(state==0){ |
| | | return Result.success("状态为0,直接出片"); |
| | | }else{ |
| | | //玻璃需要调拨时,判断属于哪个半区的笼子 |
| | | if(cage<6){ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,0,6); |
| | | //获取调拨位置进行调拨 |
| | | ids=cagecell.getId();//调拨目标位ID |
| | | //填入调拨数据 |
| | | datas.add((short)id); |
| | | datas.add((short)ids); |
| | | datas.add((short)2); |
| | | datas.add((short)1); |
| | | //传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //更换玻璃的笼子 |
| | | datas.clear(); // 清空整个列表 |
| | | //判断调拨结束后再次出片,填入出片数据 |
| | | datas.add((short)id); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //修改数据库笼子表(出片) |
| | | spianMapper.UpdataGlassCage("","",glasswidth, cage, cell, tier, 0); |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | |
| | | }else{ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,5,11); |
| | | //获取调拨位置进行调拨 |
| | | ids=cagecell.getId();//调拨目标位ID |
| | | //填入调拨数据 |
| | | datas.add((short)id); |
| | | datas.add((short)ids); |
| | | datas.add((short)2); |
| | | datas.add((short)1); |
| | | //传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | datas.clear(); // 清空整个列表 |
| | | //判断调拨结束后再次出片 |
| | | //填入出片数据 |
| | | datas.add((short)id); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @GetMapping("/all") |
| | | //进片任务,传订单id |
| | | //按订单优先进片 |
| | | public Result selectAll(Short glassid){ |
| | | //return spianMapper.selectAll(); |
| | | int cage1; |
| | | int ids; |
| | | int tier; |
| | | double widths=1500; |
| | | 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<>(); |
| | | //String orderid="A001"; |
| | | //获取订单相关度最高的笼子排序 |
| | | List<StorageCage> storageCage=spianMapper.selectAll(glassid); |
| | | for (StorageCage storageCage2 : storageCage) { |
| | | //保存订单优先顺序笼子号 |
| | | cage1=storageCage2.getCage(); |
| | | //判断该笼子号相邻最大的空格数 |
| | | int cages=spianMapper.selectCage(cage1); |
| | | //判断选中笼子是否有合适宽度空格 |
| | | StorageCage cages1=spianMapper.selectCage1(cage1,widths); |
| | | ids=cages1.getId(); |
| | | tier=cages1.getTier(); |
| | | //有合适空格时进片 |
| | | if(cages>1 &&cages1.getTier()!=null){ |
| | | //执行进片 |
| | | datas.add((short)1000); |
| | | datas.add((short)ids); |
| | | datas.add((short)tier); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //数据库修改笼子表新增一条玻璃 |
| | | spianMapper.UpdataAddCage("glassid", glassid, widths, cages, ids, tier, 1);//还未获取玻璃id |
| | | return Result.success(cages1); |
| | | } |
| | | |
| | | |
| | | } |
| | | return Result.success("不可进片"); |
| | | |
| | | } |
| | | |
| | | } |