From 5d726c33c3da931a7c5c43bba3f37a4e8c11ca93 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期一, 18 九月 2023 21:11:21 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
CanadaMes-ui/src/views/home/index.vue | 179 ++++++++++------
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java | 103 +++++++-
springboot-vue3/src/main/java/com/example/springboot/component/S7control.java | 26 ++
springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java | 12
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java | 20 +
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java | 9
springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java | 17 +
springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java | 2
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java | 84 +++++--
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java | 29 ++
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java | 17 +
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java | 23 +
CanadaMes-ui/src/lang/locales/zh-CN.json | 6
springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java | 2
CanadaMes-ui/src/api/home.js | 26 +
CanadaMes-ui/src/lang/locales/en-US.json | 9
springboot-vue3/src/main/java/com/example/springboot/mapper/AlarmMapper.java | 10
springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java | 4
springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java | 32 ++
springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java | 2
20 files changed, 447 insertions(+), 165 deletions(-)
diff --git a/CanadaMes-ui/src/api/home.js b/CanadaMes-ui/src/api/home.js
index dfecfd8..20bf0fb 100644
--- a/CanadaMes-ui/src/api/home.js
+++ b/CanadaMes-ui/src/api/home.js
@@ -12,13 +12,7 @@
data
})
}
-export function SelectPassword() {
-return request({
-url: '/home/SelectPassword',
- method: 'get',
- data :""
- })
- }
+
export function home2(data) {
return request({
url: '/home/loads',
@@ -89,3 +83,21 @@
data :""
})
}
+
+export function Loadcarlist() {
+ return request({
+ url: '/home/Loadcarlist',
+ method: 'get',
+ data :""
+ })
+}
+
+export function SelectPassword() {
+ return request({
+ url: '/home/SelectPassword',
+ method: 'get',
+ data :""
+ })
+}
+
+
diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index f1faf87..09b53ef 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -274,7 +274,16 @@
"Are you sure to perform this operation ?":"Are you sure to perform this operation ?",
"prompt":"prompt",
"Yes":"Yes",
+<<<<<<< .mine
"No":"No",
"ElectricalPassword":"ElectricalPassword"
+
+=======
+ "No":"No",
+ "Please enter the password":"Please enter the password",
+ "Password error":"Password error",
+ "DataBase Connection failed":"DataBase Connection failed"
+>>>>>>> .theirs
+
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/lang/locales/zh-CN.json b/CanadaMes-ui/src/lang/locales/zh-CN.json
index 4d83f47..5a565aa 100644
--- a/CanadaMes-ui/src/lang/locales/zh-CN.json
+++ b/CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -279,5 +279,11 @@
"alacontent": "鎶ヨ鍐呭",
"time-on": "寮�濮嬫椂闂�",
"End-Time": "缁撴潫鏃堕棿",
+<<<<<<< HEAD
"ElectricalPassword":"鐢垫皵瀵嗙爜"
+=======
+ "Please enter the password":"璇疯緭鍏ュ瘑鐮�",
+ "Password error":"瀵嗙爜閿欒",
+ "DataBase Connection failed":"鏁版嵁搴撹繛鎺ュけ璐�"
+>>>>>>> 5aa99c119f387d6f32a58dfc7190351f6f92ecf6
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index b87e524..d1c95f8 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -60,25 +60,25 @@
.gezi {
height: 35px;
-
+
position: absolute;
- width: 3.07px;
+ width: 3.08px;
/* width: 4.22px; */
}
-.gezi:nth-child(22),
+/* .gezi:nth-child(22),
.gezi:nth-child(43),
.gezi:nth-child(64),
.gezi:nth-child(85) {
margin-left: 7px;
- /* margin-left: 10px; */
-}
+ margin-left: 10px;
+} */
.blocks {
-
+
background-image: url('../../img/xmjc.png');
margin: 0 auto;
background-repeat: no-repeat;
@@ -176,6 +176,10 @@
transform: translateX(-150%);
}
}
+
+.el-dialog {
+ width: 80%;
+}
</style>
<template>
<el-container>
@@ -183,7 +187,8 @@
<el-main>
<div class="box" @click="dialogFormVisible2 = true">
<div class="text">
- Alarm:
+ <!-- Alarm: -->
+ {{ this.text }}
<label v-for="item in this.alarm" :key="item['id']">
{{ item['content'] }}
</label>
@@ -241,46 +246,51 @@
<el-footer>
<div class="blocks" style="position: relative;">
<div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:237px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
- :style="{ height: 35 * item['glassWidth'] + 'px' }" @click="showcageinfo(item['cage'])"></div>
+ <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist1" :key="item['date']"
+ :style="{ height: 35 * item['glassWidth'] + 'px', left: 3.07 * index + Math.abs(item['cage'] - 10) * 6.8 + 'px' }"
+ @click="showcageinfo(item['cage'])"></div>
</div>
<div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:640px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"
- :style="{ height: 35 * item['glassWidth'] + 'px' }" @click="showcageinfo(item['cage'])"></div>
+ <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist2" :key="item['date']"
+ :style="{ height: 35 * item['glassWidth'] + 'px', left: 3.07 * index + Math.abs(item['cage'] - 5) * 6.8 + 'px' }"
+ @click="showcageinfo(item['cage'])"></div>
</div>
<div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:237px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
- :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
+ <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist3" :key="item['date']"
+ :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px', left: 3.07 * index + Math.abs(item['cage'] - 10) * 6.8 + 'px' }"
@click="showcageinfo(item['cage'])">
</div>
</div>
<div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:640px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
- :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
+ <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist4" :key="item['date']"
+ :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px', left: 3.07 * index + Math.abs(item['cage'] - 5) * 6.8 + 'px' }"
@click="showcageinfo(item['cage'])"></div>
+ </div>
+ <div class="blue gezi"
+ :style="{ display: flex, position: absolute, float: left, top: 105 + 'px', left: 1050 + 'px', height: loadglassheight + 'px', width: 5 + 'px' }">
</div>
<div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
<div class="blocks-img" :style="{ left: car2 + 'px', top: '175px' }"></div>
<div class="blocks-img2"></div>
<div class="blocks-img3"></div>
<!-- <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:328px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
- :style="{ height: 35 * item['glassWidth'] + 'px' }"
+ <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist1" :key="item['date']"
+ :style="{ height: 35 * item['glassWidth'] + 'px',left:4.22*index+'px' }"
@click="showcageinfo(item['cage'])"></div>
</div>
<div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:885px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"
- :style="{ height: 35 * item['glassWidth'] + 'px' }"
+ <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist2" :key="item['date']"
+ :style="{ height: 35 * item['glassWidth'] + 'px',left:4.22*index+'px' }"
@click="showcageinfo(item['cage'])"></div>
</div>
<div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:328px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
- :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
+ <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist3" :key="item['date']"
+ :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px',left:4.22*index+'px' }"
@click="showcageinfo(item['cage'])"></div>
</div>
<div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:885px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
- :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
+ <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist4" :key="item['date']"
+ :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px',left:4.22*index+'px' }"
@click="showcageinfo(item['cage'])"></div>
</div>
<div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
@@ -337,14 +347,14 @@
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible3" :title="$t('Cage Details')">
<el-table :data="this.cageinfo" :height="700" border style="width: 100%;overflow: auto;">
- <el-table-column :width="150" prop="cage" :label="$t('The Cage number')"></el-table-column>
+ <el-table-column prop="cage" :label="$t('The Cage number')"></el-table-column>
<el-table-column prop="cell" :label="$t('cell')"></el-table-column>
<el-table-column prop="tier" :label="$t('tier')"></el-table-column>
<el-table-column prop="glassId" :label="$t('glassid')"></el-table-column>
- <el-table-column :width="130" prop="orderId" :label="$t('order number')"></el-table-column>
- <el-table-column :width="150" prop="lengthWidth" :label="$t('Length and width')"></el-table-column>
+ <el-table-column prop="orderId" :label="$t('order number')"></el-table-column>
+ <el-table-column prop="lengthWidth" :label="$t('Length and width')"></el-table-column>
<el-table-column prop="coating" :label="$t('coating')"></el-table-column>
- <el-table-column :width="140" :label="$t('Operate')">
+ <el-table-column :label="$t('Operate')">
<template slot-scope='scope'>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@click="deleteglass(scope.row.glassId, scope.row.state)">{{ $t('delete') }}</el-button>
@@ -360,7 +370,7 @@
</template>
<script>
-import { home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID } from "../../api/home";
+import { home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID, Loadcarlist, SelectPassword } from "../../api/home";
import LanguageMixin from '../../lang/LanguageMixin'
@@ -369,6 +379,7 @@
name: "Home",
data() {
return {
+ name: 'Confirm',
mixins: [LanguageMixin],
dialogFormVisible: false,
dialogFormVisible1: false,
@@ -397,12 +408,16 @@
order: "",
glassid: "",
url: "../../img/bigcar01.png",
- car1: 107,
- car2: 175,
- // car1: 150,
- // car2: 242,
+ car1: 145,
+ car2: 210,
+ // car1: 210,
+ // car2: 300,
cageinfo: [],
- cage: 0
+ cage: 0,
+ carlist: [],
+ loadglassheight: 0,
+ password: 1,
+ text: ""
};
},
created() {
@@ -434,10 +449,11 @@
//console.log("鏀跺埌鏁版嵁====" + msg.data);
let obj = JSON.parse(msg.data);
if (obj.params != null) {
- this.car1 = 107 + 17.62 * obj.params[0][0]/1000;
- this.car2 = 175 + 17.62 * obj.params[0][1]/1000;
- // this.car1 = 150 + 24.6 * obj.params[0][0]/1000;
- // this.car2 = 242 + 24.6 * obj.params[0][1]/1000;
+ this.car1 = 145 + 8.1 * Math.abs(obj.params[0][0] - this.carlist[0]['start']) / Math.abs(this.carlist[0]['end'] - this.carlist[0]['start']) * 100;
+ this.car2 = 210 + 8.25 * Math.abs(obj.params[0][1] - this.carlist[1]['start']) / Math.abs(this.carlist[1]['end'] - this.carlist[1]['start']) * 100;
+ // this.car1 = 210 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
+ // this.car2 = 300 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
+ console.log(obj.params[0][1], this.carlist[1]['start']);
}
this.tableData = obj.tableData[0];
this.cagelist1 = obj.cagelist1[0];
@@ -447,7 +463,11 @@
this.tasklist1 = obj.tasklist1[0];
this.tasklist2 = obj.tasklist2[0];
this.alarm = obj.alarmmg[0];
+ this.loadglassheight = obj.loadglassheight;
+ if (obj.dbconnected == "false") {
+ this.text = this.$t('DataBase Connection failed');
+ }
SelectCageInfo(this.cage).then(res => {
this.cageinfo = res.data.cageinfo;
});
@@ -486,14 +506,19 @@
if (res.data.list.length > 0) {
this.outcell = this.tasklist2[0]['cell'];
}
-
});
loadtask(this.task2).then(res => {
this.tasklist2 = res.data.list;
-
});
SelectAlarmmgInfo().then(res => {
this.alarm = res.data.alarmmg;
+ });
+ Loadcarlist().then(res => {
+ this.carlist = res.data.carlist;
+ console.log(this.carlist);
+ });
+ SelectPassword().then(res => {
+ this.password = res.data.password;
});
},
//鏍规嵁鏍煎瓙鐘舵�佷慨鏀归鑹�
@@ -578,23 +603,28 @@
this.form1 = {};
},
endtask(type, glassid, cell) {
- this.$confirm(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
+ this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
+ inputType: 'password',
+ inputPlaceholder: this.$t('Please enter the password'),
confirmButtonText: this.$t('Yes'),
cancelButtonText: this.$t('No'),
type: 'warning'
- }).then(() => {
- UpdateTask(type, glassid, cell).then(res => {
- if (res.data.message3 == 200) {
- this.$message.success(this.$t('Operation successful'));
- }
- });
+ }).then(({ value }) => {
+ if (this.password == value) {
+ UpdateTask(type, glassid, cell).then(res => {
+ if (res.data.message3 == 200) {
+ this.$message.success(this.$t('Operation successful'));
+ }
+ });
+ } else {
+ this.$message.success(this.$t('Password error'));//瀵嗙爜閿欒
+ }
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('Operation canceled')
});
});
-
},
showcageinfo(cage) {
this.cage = cage;
@@ -604,20 +634,27 @@
});
},
deleteglass(glassid, state) {
- this.$confirm(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
+ this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
+ inputType: 'password',
+ inputPlaceholder: this.$t('Please enter the password'),
confirmButtonText: this.$t('Yes'),
cancelButtonText: this.$t('No'),
type: 'warning'
- }).then(() => {
- if (state == 1) {
- DeleteByGlassID(glassid).then(res => {
- if (res.data.message3 == 200) {
- this.$message.success(this.$t('Operation successful'));
- }
- });
+ }).then(({ value }) => {
+ if (this.password == value) {
+ if (state == 1) {
+ DeleteByGlassID(glassid).then(res => {
+ if (res.data.message3 == 200) {
+ this.$message.success(this.$t('Operation successful'));
+ }
+ });
+ } else {
+ this.$message.success(this.$t('No delete allowed'));
+ }
} else {
- this.$message.success(this.$t('No delete allowed'));
+ this.$message.success(this.$t('Password error'));//瀵嗙爜閿欒
}
+
}).catch(() => {
this.$message({
type: 'info',
@@ -626,22 +663,28 @@
});
},
outglass(glassid, state) {
- this.$confirm(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
+ this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
+ inputType: 'password',
+ inputPlaceholder: this.$t('Please enter the password'),
confirmButtonText: this.$t('Yes'),
cancelButtonText: this.$t('No'),
type: 'warning'
- }).then(() => {
- if (state == 1) {
- OutByGlassID(glassid).then(res => {
- if (res.data.message3 == 200) {
- this.$message.success(this.$t('Operation successful'));
- }
- else if (res.data.message2 == 300) {
- this.$message.success(this.$t('There is no such grid'));
- }
- });
+ }).then(({ value }) => {
+ if (this.password == value) {
+ if (state == 1) {
+ OutByGlassID(glassid).then(res => {
+ if (res.data.message3 == 200) {
+ this.$message.success(this.$t('Operation successful'));
+ }
+ else if (res.data.message2 == 300) {
+ this.$message.success(this.$t('There is no such grid'));
+ }
+ });
+ } else {
+ this.$message.success(this.$t('No out allowed'));
+ }
} else {
- this.$message.success(this.$t('No out allowed'));
+ this.$message.success(this.$t('Password error'));//瀵嗙爜閿欒
}
}).catch(() => {
this.$message({
diff --git a/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java b/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java
index ac38360..689a34d 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java
@@ -13,9 +13,7 @@
public static void main(String[] args) {
- // SpringApplication.run(AuthorityApplication.class, args);
- // 111
- //System.out.println("null");
+
SpringApplication springApplication = new SpringApplication(AuthorityApplication.class);
ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
WebSocketServer.setApplicationContext(configurableApplicationContext);
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
index c410d62..feaec32 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.ibatis.javassist.compiler.ast.Symbol;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.service.JdbcConnections;
@@ -23,11 +24,12 @@
@Override
public void run() {
-
+ boolean inglassbegin=false;
+ boolean outglassbegin=false;
while (this != null) {
try {
- Thread.sleep(500);
+ Thread.sleep(1000);
} catch (InterruptedException e) {
// \\ TODO Auto-generated catch block
e.printStackTrace();
@@ -38,6 +40,7 @@
// 鏍规嵁鐜荤拑id鑾峰彇璁㈠崟鍙�,鍗曠嫭鏁版嵁婧�
// try {
+
// Glass glass = jdbcConnections.selectGlass(112);
// // System.out.println(glass.getOrderId());
@@ -45,60 +48,126 @@
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
- spianService.selectAll((short)257);
+ // spianService.selectAll((short)257);
//鍒ゆ柇杩涚墖璇锋眰
- List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);
- List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);
-
-
+ 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.12", 1);// 鑾峰彇杩涚墖杞︿换鍔℃槸鍚﹀惎鍔�
+
if (datas1List != null && datas1ListState != null) {
+
// 鑾峰彇prc杩涚墖璇锋眰鏁版嵁
boolean exist = datas1List.contains((short) 1);
// 鑾峰彇杩涚墖杞︾姸鎬�
boolean exist1 = datas1ListState.contains((short) 0);
+ //鍒ゆ柇杩涚墖杞︿换鍔℃槸鍚﹀惎鍔�
+ boolean exist2 = datas1ListState2.contains((short) 1);
+
String glassid="";
+ StringBuilder strId=new StringBuilder();
+ StringBuilder writedstrId=new StringBuilder();
+
+ if(!inglassbegin&!exist1)
+ {
+ inglassbegin=true;
+ }
+ if(inglassbegin&exist1)
+ {
+ inglassbegin=false;
+ spianMapper.UpdataAddCageState(1,2);
+ }
// 杩涚墖璇锋眰涓�1鏃�
if (exist == true) {
// 褰撹繘鐗囪溅绌洪棽鏃�
if (exist1 == true) {
+ //鑾峰彇宸蹭笅鍙戠殑杩涚墖id 涓巔lc璇锋眰鐨刬d浣滄瘮杈�
+ byte[] writedglassidbytes = S7control.getinstance().ReadByte("DB105.16", 1);
+ if (writedglassidbytes != null) {
+ // 鑾峰彇鐜荤拑id
+ for (byte iditem : writedglassidbytes) {
+ writedstrId.append(iditem);
+ }
+ }
// 鑾峰彇杩涚墖id
- List<Short> datas1ListID = S7control.getinstance().ReadWord("DB106.26", 1);
+ byte[] datas1ListID = S7control.getinstance().ReadByte("DB106.26", 1);
if (datas1ListID != null) {
// 鑾峰彇鐜荤拑id
- for (Short list1 : datas1ListID) {
- glassid=glassid.concat(list1.toString());
+ for (byte list1 : datas1ListID) {
+ strId.append(list1);
}
- spianService.selectAll(Short.parseShort(glassid));
+ if(!writedstrId.toString().equals(strId.toString())) //宸茬粡涓嬪彂鐨刬d涓巔lc璇锋眰鐨刬d涓嶄竴鏍锋椂锛岃涓轰笉鏄噸澶嶇殑浠诲姟锛屾墠鎵ц涓嬪彂浠诲姟鎸囦护
+ {
+ spianService.selectAll(strId.toString());
+ S7control.getinstance().WriteByte("DB105.16",datas1ListID);//娲惧彂杩涚墖id
+
+ }
+ //spianService.selectAll(Short.parseShort(strId.toString()));
}
}
// System.out.println(exist);
+ }
+
+ if(exist1==false){//涓嬪彂浠诲姟鍚庡皢浠诲姟鍚姩鏀逛负0
+ if(exist2==true) {
+ S7control.getinstance().WriteWord("DB105.12",(short)0);//杩涚墖浠诲姟鍚姩鏀逛负0
+ }
}
}
//spianService.selectAll((short) 111);
List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖杞︾姸鎬�
+ List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.14", 1); // 鍑虹墖浠诲姟鏄惁鍚姩
+ StringBuilder writedstrIdOut=new StringBuilder();
+ //鑾峰彇宸蹭笅鍙戠殑鍑虹墖id
+ byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 1);
+ if (writedglassidbytesOut != null) {
+ // 鑾峰彇鐜荤拑id
+ for (byte iditem : writedglassidbytesOut) {
+ writedstrIdOut.append(iditem);
+ }
+ }
boolean outstate=false;//鍑虹墖杞︾┖闂插垽鏂�
- if (outlist != null) {
+ boolean outstate1=false;//鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔�
+ if (outlist != null&&outlist1!=null) {
// 鍒ゆ柇鎸夎鍗曞嚭鐗�
- outstate = outlist.contains((short) 0);
+ outstate = outlist.contains((short) 0);//鍑虹墖杞︾┖闂插垽鏂�
+ outstate1 = outlist1.contains((short) 1);//鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔�
+
Glass glass=spianMapper.SelectDBOut();//鍒ゆ柇鏄惁鏈夎皟鎷ㄥ悗鐨勫嚭鐗囦换鍔℃湭瀹屾垚
- if(outstate== true ){
- if(glass.getId()==2){
+ if(!outglassbegin&!outstate)//褰撲换鍔¤繕鏈紑濮嬶紝涓斿嚭鐗囪溅涓嶇┖闂叉椂,浠诲姟鐘舵�佹敼涓哄紑濮�
+ {
+ outglassbegin=true;
+ }
+ if(outglassbegin&outstate)//褰撲换鍔″紑濮嬩笖鍑虹墖杞︾┖闂叉椂
+ {
+ outglassbegin=false;
+ spianMapper.UpdataAddCageState(0,3);
+ }
+
+ if(outstate== true &glass.getGlassId()!=null){ //褰撳嚭鐗囪溅绌洪棽涓旀湁鍑虹墖浠诲姟寰呭畬鎴愭椂
+ if(glass.getId()==2&!writedstrIdOut.toString().equals(glass.getGlassId().toString())){
spianService.selectout2(glass.getGlassId().toString());
}
- }
+ }
+ if(outstate==false){//涓嬪彂浠诲姟鍚庡皢浠诲姟鍚姩鏀逛负0//鍑虹墖杞︾┖闂插垽鏂�
+ if(outstate1==true){
+ S7control.getinstance().WriteWord("DB105.14",(short)0);//鍑虹墖浠诲姟鍚姩鏀逛负0
+ }
+ }
}
if (outstate == true) { // 鍑虹墖杞︾姸鎬佺┖闂叉椂
+ Integer state=spianMapper.Selectoutstate();
String orderid = spianMapper.SelectOrderout();
- if (orderid != null) {
+
+ if (orderid != null &&state==0) {
spianService.selectout(orderid);
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
index ba512ab..17b9d6d 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
@@ -11,7 +11,7 @@
public void run() {
while (this != null) {
try {
- Thread.sleep(500);
+ Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
index 00d1d4b..ca035a8 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
@@ -19,7 +19,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
-
+ // 鏍规嵁鍦板潃璇诲彇PCL鏁版嵁
List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.0.0", 40);
// Boolean[] values = { true, false, true, false, true, false, true, false,
// true, false, true, false, true, false,
@@ -31,7 +31,6 @@
if (plclist != null) {
JSONObject jsonObject = new JSONObject();
-
jsonObject.append("params", plclist);
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("alarm");
if (sendwServer != null) {
@@ -44,9 +43,11 @@
Intlist.add(value == true ? 1 : 0);
}
+
// 灏咺ntlist杞崲涓烘暟缁�
Integer[] shuzu1 = Intlist.toArray(new Integer[0]);
+ // 瀹氫箟鐨勬姤璀﹀唴瀹规暟缁�
String[] shuzu = {
"D01 VFD error",
"D02 VFD error",
@@ -91,10 +92,14 @@
};
alarmMapper = WebSocketServer.applicationContext.getBean(AlarmMapper.class);
for (short i = 0; i < shuzu.length; i++) {
+ // 鏌ヨ瀵瑰簲鎶ヨ淇℃伅缁撴潫鏃堕棿涓簄ull鐨勬潯鏁�
short result = alarmMapper.selectnullti(shuzu[i]);
+ // 璇诲彇鍒癙LC鐨勫�间负1骞朵笖瀵瑰簲鎶ヨ淇℃伅缁撴潫鏃堕棿涓簄ull鐨勬潯鏁扮殑鏉℃暟涓�0
if (shuzu1[i] == 1 && result == 0) {
+ // 濉姞涓�鏉℃姤璀︿俊鎭�,鏈夊紑濮嬫椂闂�
alarmMapper.Insertalarm(shuzu[i]);
} else if (shuzu1[i] == 0 && result > 0) {
+ // 淇敼璇ユ潯鎶ヨ淇℃伅鐨勭粨鏉熸椂闂�
alarmMapper.updatealarm(shuzu[i]);
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
index cc53b99..2ea5797 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -5,14 +5,17 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.ibatis.javassist.tools.framedump;
+
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
import com.example.springboot.mapper.HomeMapper;
+import com.example.springboot.service.JdbcConnections;
public class Plchome extends Thread {
private HomeMapper homeMapper;
-
+ private JdbcConnections dbserve;
@Override
public void run() {
while (this != null) {
@@ -47,21 +50,35 @@
jsonObject.append("alarmmg", alarmmg);
// 璇诲幓Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃甒
List<String> addressList = new ArrayList<String>();
- addressList.add("DB106.0");
addressList.add("DB106.12");
- List<Short> paramlist = S7control.getinstance().ReadWord(addressList);
+ addressList.add("DB106.0");
+ List<Short> paramlist= S7control.getinstance().ReadWord(addressList);
// List<Short> paramlists = new ArrayList<Short>();
- // short para1 = 1;
- // short para2 = 2;
+ // short para1 = 11111;
+ // short para2 = 32000;
// paramlists.add(para1);
// paramlists.add(para2);
// System.out.println(paramlists);
if(paramlist!=null){
- // Short[] paramlists = paramlist.toArray(new Short[0]);
jsonObject.append("params", paramlist);
}
+ List<Short> inglassInfo= S7control.getinstance().ReadWord("DB106.24",1);
+ if(inglassInfo!=null){
+ if(inglassInfo.size()>0)
+ jsonObject.append("loadglassheight", inglassInfo.get(0)*70);
+ }
+ dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
+ boolean dbconnected=false;
+ try {
+ dbserve.getConn();
+ dbconnected=true;
+ } catch (Exception e) {
+ // TODO: handle exception
+ dbconnected=false;
+ }
+ jsonObject.append("dbconnected", dbconnected);
// jsonObject.append("params", new short[] { 30, 40, });
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Home");
if (sendwServer != null) {
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
index ce46de1..f91920e 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
@@ -11,21 +11,30 @@
public void run() {
while (this != null) {
try {
- Thread.sleep(500);
+ Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
- List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.0.0", 58);
+ List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.0.0", 44);
+ List<Boolean> plclist2 = S7control.getinstance().ReadBits("DB102.5.5", 13);
+
// Boolean[] values = { true, false, true, false, true, false, true, false,
// true, false, true, false, true, false,
// true, false, true, false, true, false, true, false, true, false, true, false,
// true, false, true, false, true,
// false, true, false, true, false,
- // true, false, true, false, true, false, true, false, true, false,
+ // true, false, true, false, true, false, true, false, };
+ // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
+
+ // Boolean[] values2 = { true, false,
// true, false, true, false, true, false,
// true, false, true, false, true, };
- // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
+ // List<Boolean> plclist2 = new ArrayList<>(Arrays.asList(values2));
+
+ // 灏唒lclist2鐨勫厓绱犳坊鍔犲埌plclist涓�
+ plclist.addAll(plclist2);
+ // System.out.println(plclist);
if (plclist != null) {
// 灏嗚幏鍙栫殑甯冨皵绫诲瀷杞崲涓烘暣鏁扮被鍨�
List<Integer> Intlist = new ArrayList<>();
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
index e02e09a..a539781 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
@@ -11,7 +11,7 @@
public void run() {
while (this != null) {
try {
- Thread.sleep(500);
+ Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
index 3ae24aa..593a8b9 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
@@ -137,6 +137,18 @@
}
s7PLC.writeMultiData(addressWrite);
}
+ /**
+ * 鎸夋寚瀹氱殑鍦板潃 鍐欏叆澶氫釜byte
+ *
+ * @param address 鍦板潃
+ * @param datas byte鐨勫��
+ */
+ public void WriteByte(String address, byte[] datas) {
+ if (s7PLC==null)
+ return;
+ // s7PLC.write(address, data);
+ s7PLC.writeByte(address, datas);
+ }
/**
* 鎸夋寚瀹氱殑鍦板潃 璇诲彇word缁撴灉闆�
@@ -164,6 +176,20 @@
List<String> addresslist = GetAddressList(address, count, 16);
return s7PLC.readInt16(addresslist);
}
+ /**
+ * 鎸夋寚瀹氱殑鍦板潃 璇诲彇byte缁撴灉闆�
+ *
+ * @param address 鍦板潃
+ * @param count 杩炵画璇诲灏戜釜byte
+ * @return 缁撴灉
+ */
+ public byte[] ReadByte(String address, int count) {
+ if (s7PLC==null)
+ return null;
+
+ // List<String> addresslist = GetAddressList(address, count, 16);
+ return s7PLC.readByte(address,count);
+ }
/**
* 鎸夋寚瀹氱殑鍦板潃 鎸塨it浣� 0 flase 1 true 璇诲彇缁撴灉
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java
index 4a0d232..b141d58 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java
@@ -25,7 +25,7 @@
AlarmService alarmService;
@GetMapping("/load")
- public Result selectAll() {
+ public Result selectAll() {// 鏌ヨ褰撳ぉ宸茬粨鏉熺殑鎶ヨ淇℃伅
Map<String, Object> map = new HashMap<>();
List<alarmmg> storageCagelist = alarmMapper.selectAll();
@@ -34,9 +34,7 @@
}
@GetMapping("/stTime")
- public Result selecttime(String shijian1, String shijian2) {
-
- // if (shijian1 != "" || shijian2 != "") {
+ public Result selecttime(String shijian1, String shijian2) {// 鏍规嵁鏃ユ湡鏌ヨ鎶ヨ淇℃伅
// 灏唃et鏂规硶浼犺繃鏉ョ殑鍙傛暟涓�"#20"鏇挎崲涓�" "
String sj1 = shijian1.replace("#20", " ");
String sj2 = shijian2.replace("#20", " ");
@@ -44,12 +42,6 @@
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);
- // }
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
index 4636ae8..cae88ae 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -10,6 +10,7 @@
import com.example.springboot.service.HomeService;
import com.example.springboot.service.SpianService;
import com.example.springboot.common.Result;
+import com.example.springboot.entity.CarPosition;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
@@ -79,7 +80,7 @@
map.put("message2", "500");
} else {
// 璋冪敤浼嶄笂鐗囧嚱鏁�
- short results = spianService.selectAll(glassid);
+ short results = spianService.selectAll(Short.toString(glassid));
if (results == 200) {
map.put("message2", "200");
} else if (results == 300) {
@@ -130,8 +131,6 @@
@GetMapping("/OutByGlassID")
public Result OutByGlassID(String glassid) {
-
-
Map<String, Object> map = new HashMap<>();
// 璋冪敤浼嶄笂鐗囧嚱鏁�
Short results = spianService.selectout2(glassid);
@@ -142,8 +141,24 @@
} else if (results == 400) {
map.put("message2", "400");
}
-
return Result.success(map);
}
+ @GetMapping("/Loadcarlist")
+ public Result Loadcarlist() {
+ List<CarPosition> carlist = homeMapper.Loadcarlist();
+ Map<String, Object> map = new HashMap<>();
+ map.put("carlist", carlist);
+ return Result.success(map);
+ }
+
+ @GetMapping("/SelectPassword")
+ public Result SelectPassword() {
+ String pwdct = homeMapper.SelectPassword();
+ Map<String, Object> map = new HashMap<>();
+ map.put("password", pwdct);
+ return Result.success(map);
+ }
+
+
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java
index 8870607..7ab5b9a 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java
@@ -33,7 +33,7 @@
//鎸夎鍗曚紭鍏堣繘鐗�
public void selectAll(Short glassid){
SpianService service=new SpianService();
- service.selectAll(glassid);
+ service.selectAll(Short.toString(glassid));
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java b/springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java
new file mode 100644
index 0000000..c307c00
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java
@@ -0,0 +1,32 @@
+package com.example.springboot.entity;
+
+public class CarPosition {
+ public int carid;
+ public int start;
+ public int end;
+
+ public void setcarId(Integer carid) {
+ this.carid = carid;
+ }
+
+ public Integer getcarId() {
+ return carid;
+ }
+
+ public void setStart(Integer start) {
+ this.start = start;
+ }
+
+ public Integer getStart() {
+ return start;
+ }
+
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ public Integer getEnd() {
+ return end;
+ }
+
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/AlarmMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/AlarmMapper.java
index c7f9ccc..2dfe841 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/AlarmMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/AlarmMapper.java
@@ -9,17 +9,17 @@
@Mapper
public interface AlarmMapper {
@Select("SELECT * FROM alarmmg where endTime is not null and to_days(timeon)=to_days(now())")
- List<alarmmg> selectAll();
+ List<alarmmg> selectAll();// 鏌ヨ褰撳ぉ鎵�鏈夊凡缁撴潫鎶ヨ淇℃伅
@Select("SELECT count(*) FROM alarmmg where endTime is null and content=#{content}")
- short selectnullti(String content);
+ short selectnullti(String content);// 鏍规嵁鎶ヨ鍐呭鏌ヨ缁撴潫鏃堕棿涓簄ull鐨�
@Insert("INSERT INTO `canadames`.`alarmmg`( `content`,`timeon`) VALUES ( #{content},now())")
- void Insertalarm(String content);
+ void Insertalarm(String content);// 娣诲姞涓�鏉℃姤璀︽暟鎹�
@Insert("UPDATE `canadames`.`alarmmg` set endTime= now() where endTime is null and content=#{content}")
- void updatealarm(String content);
+ void updatealarm(String content);// 淇敼瀵瑰簲鎶ヨ鍐呭鐨勭粨鏉熸椂闂�
@Select("SELECT * FROM alarmmg where timeon between #{sj1} and #{sj2}")
- List<alarmmg> selecttime(String sj1, String sj2);
+ List<alarmmg> selecttime(String sj1, String sj2);// 鏍规嵁鏃ユ湡鏌ヨ鎶ヨ淇℃伅
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
index 8c8b53b..d4bd543 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -2,6 +2,7 @@
import org.apache.ibatis.annotations.*;
+import com.example.springboot.entity.CarPosition;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
@@ -10,23 +11,23 @@
@Mapper
public interface HomeMapper {
//鏌ヨ姣忎釜绗煎瓙鐨勪娇鐢ㄦ儏鍐�
- @Select("SELECT cage,ROUND(sum(case when state=1 or state=2 or state=3 then 1 else 0 end)/42*100) as cell,42-sum(case when state=1 or state=2 or state=3 then 1 else 0 end) as state FROM `storage_cage` group by cage")
+ @Select("select cage,round(100-(21-sum(state))/21*100) as cell,21-sum(state) as state from (select cage,cell,max(state) as state from storage_cage group by cage,cell) as cages group by cage")
List<StorageCage> selectAll();
// 鏌ヨ1-5绗煎唴灞傛牸瀛愮姸鎬�
- @Select("SELECT cage,state,glasswidth/width*2 as glasswidth from storage_cage where cage<=5 and tier=2")
+ @Select("SELECT cage,state,glasswidth/2750*2 as glasswidth from storage_cage where cage>5 and tier=2 order by cage desc,cell desc")
List<StorageCage> selectRack1();
// 鏌ヨ6-10绗煎唴灞傛牸瀛愮姸鎬�
- @Select("SELECT cage,state,glasswidth/width*2 as glasswidth from storage_cage where cage>5 and tier=2")
+ @Select("SELECT cage,state,glasswidth/2750*2 as glasswidth from storage_cage where cage<=5 and tier=2 order by cage desc,cell desc")
List<StorageCage> selectRack2();
// 鏌ヨ1-5绗煎灞傛牸瀛愮姸鎬�
- @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/width*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/width*2 else 0 end) as width from storage_cage where cage<=5 group by cell")
+ @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width from storage_cage where cage>5 group by cage,cell order by cage desc,cell desc")
List<StorageCage> selectRack3();
// 鏌ヨ6-10绗煎灞傛牸瀛愮姸鎬�
- @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/width*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/width*2 else 0 end) as width from storage_cage where cage>5 group by cell")
+ @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width from storage_cage where cage<=5 group by cage,cell order by cage desc,cell desc")
List<StorageCage> selectRack4();
// 鏍规嵁浠诲姟绫诲瀷鏌ヨ褰撳墠姝e湪鍑虹墖锛岃繘鐗囩殑鐜荤拑淇℃伅
@@ -72,4 +73,10 @@
@Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,coating=null where glass_id=#{glassid}")
void DeleteByGlassID(short glassid);
+ @Select("select * from car_position")
+ List<CarPosition> Loadcarlist();
+
+ @Select("select dianqimima from user where id=1")
+ String SelectPassword();
+
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
index e86cd52..05b5daf 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
@@ -9,6 +9,8 @@
import java.util.List;
+import javax.print.DocFlavor.STRING;
+
@Mapper
public interface SpianMapper {
@@ -33,13 +35,13 @@
void update();
//鑾峰彇鐜荤拑淇℃伅
@Select("select orderid,width from glass where glassid=#{glassid}")
- Glass selectGlass(Short glassid);
+ Glass selectGlass(String glassid);
@Insert("insert into storage_task(task_type,task_state,shelf_rack,load_rack)values(#{storage_task},#{task_state},#{shelf_rack},#{load_rack})")
void insert(StorageTask storageTask);
//鍑虹墖浠诲姟鏌ヨ
- @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as prcId,id 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 prcId,id,glass_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);
//鎸夌幓鐠僆D鍑虹墖浠诲姟鏌ヨ
@Select("select cage,cell,tier,glasswidth,ROUND(id/2)as prcId,id from storage_cage as a where a.glass_id=#{glassid} and state=1 order by cage desc,tier desc,cell desc LIMIT 1")
@@ -59,15 +61,18 @@
//淇敼绗煎瓙淇℃伅(杩涚墖)
@Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where id=#{id};")
- void UpdataAddCage(Short orderid,Short glassid,double width,int cage,int cell,int id,int state);
+ void UpdataAddCage(Short orderid,String glassid,double width,int cage,int cell,int id,int state);
//淇敼鍚岀瀛愭牸瀛愬搴�
@Update("update storage_cage set width=width-#{width} where cage=#{cage} and cell=#{cell};")
void UpdataAddCage1(double width,int cage,int cell);
+ //淇敼鍚岀瀛愭牸瀛愬搴�
+ @Update("update storage_cage set state=#{state} where state=#{oldstate};")
+ void UpdataAddCageState(int state,int oldstate);
//淇敼鍚岀瀛愭牸瀛愬搴�(鍑虹墖)
@Update("update storage_cage set width=width+#{width} where cage=#{cage} and cell=#{cell};")
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=2)as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1 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=2)as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth where a.id=#{id1}")
void UpdateDBCage(int id1,int cage,int cell);
// @Insert("insert into user(name, date, address, user_no) values (#{name}, #{date}, #{address}, #{userNo})")
// void insert (Spian spian);
@@ -92,4 +97,11 @@
//鍒ゆ柇鏄惁鏈夎皟鎷ㄥ畬鍚庡嚭鐗囩殑浠诲姟
@Select("select COUNT(*)as id,glass_id from storage_task where (task_type=1 or task_type=2) and task_state=0;")
Glass SelectDBOut();
+ //鏍规嵁绗煎瓙鏍煎瓙灞傛暟鑾峰彇鐜荤拑id
+ @Select("select glass_id from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;")
+ String SelectGlassid(int cage,int cell);
+ //鏍规嵁绗煎瓙鏍煎瓙灞傛暟鑾峰彇鐜荤拑id
+ @Select("SELECT COUNT(*) FROM `storage_cage` where state=3;")
+ Integer Selectoutstate();
}
+
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java b/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
index 70bb729..2cda052 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
@@ -1,5 +1,6 @@
package com.example.springboot.service;
+import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
@@ -11,6 +12,7 @@
import com.example.springboot.entity.Glass;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.mapper.SpianMapper;
+import com.google.common.primitives.Bytes;
@Service
public class SpianService {
@@ -41,6 +43,7 @@
int cell = cageout.getCell();// 鍑虹墖鏍煎彿
int tier = cageout.getTier();// 鍑虹墖鍐呭鐗�
int prcid = cageout.getPrcId();// prcid
+ String glassid=cageout.getGlassId();
int prcid2;
int ids;
int cages;
@@ -56,24 +59,26 @@
datas.add((short) 1);
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
+ spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
spianMapper.Inserttask(1, 0,cageout.getId(),1000,orderid);//鏂板浠诲姟
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+ outmesid(glassid);//娲惧彂鍑虹墖ID
return Result.success(datas);//缁撴潫
} else {
// 鑾峰彇鏍煎瓙鐨勭幓鐠冩暟閲�
int state = spianMapper.selectGlassState(cage, cell);
// 鍒ゆ柇鍐呯墖鏄惁闇�瑕佽皟鎷�
if (state == 0) {
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);
+ //spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);
datas.add((short) prcid);
datas.add((short) 1000);
datas.add((short) 1);
datas.add((short) 1);
spianMapper.Inserttask(1, 0,cageout.getId(),1000,orderid);//鏂板浠诲姟
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
+ spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+ outmesid(glassid);//娲惧彂鍑虹墖ID
//spianMapper.Updatetask(1, 1);//瀹屾垚浠诲姟
return Result.success(datas);//缁撴潫
@@ -88,10 +93,7 @@
prcid2 = cagecell.getPrcId();// 璋冩嫧鐩爣浣峆RCID
ids = cagecell.getId();// 璋冩嫧鐩爣浣岻D
cages=cagecell.getCage();//璋冩嫧鐩爣浣嶇瀛�
- cells=cagecell.getCell();//璋冩嫧鐩爣浣嶆牸瀛�
-
-
-
+ cells=cagecell.getCell();//璋冩嫧鐩爣浣嶆牸瀛�
// 濉叆璋冩嫧鏁版嵁
datas.add((short) prcid);// 璋冩嫧澶栫墖璧峰浣嶇疆
@@ -99,13 +101,16 @@
datas.add((short) 2);
datas.add((short) 1);
// 鏇存崲鐜荤拑鐨勭瀛�
- spianMapper.UpdataAddCage1(glasswidth, cages, cells);//鍑忓皯鏂版牸瀛愬搴�
+ String glassids=spianMapper.SelectGlassid(cage, cell); //鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
spianMapper.UpdateDBCage(ids, cage, cell);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
+ spianMapper.UpdataAddCage1(glasswidth, cages, cells);//鍑忓皯鏂版牸瀛愬搴�
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
+ spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
spianMapper.Inserttask(2, 0,cageout.getId(),ids,orderid);//鏂板璋冨害浠诲姟
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+ S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+ System.out.println(datas);
+ outmesid(glassids);//娲惧彂璋冩嫧鐜荤拑ID
return Result.success(cagecell); //缁撴潫
} else {// 绗煎瓙鍙峰ぇ浜�5鏃�
@@ -123,13 +128,16 @@
datas.add((short) prcid2);
datas.add((short) 2);
datas.add((short) 1);
+ String glassids=spianMapper.SelectGlassid(cage, cell); //鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
+ spianMapper.UpdateDBCage(ids, cage, cell);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
spianMapper.Inserttask(2, 0,cageout.getId(),ids,orderid);//鏂板璋冨害浠诲姟
spianMapper.UpdataAddCage1(glasswidth, cages, cells);//鍑忓皯鏂版牸瀛愬搴�
- spianMapper.UpdateDBCage(ids, cage, cell);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
+ spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+ S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+
+ outmesid(glassids);//娲惧彂璋冩嫧鐜荤拑ID
return Result.success(cagecell); //缁撴潫
}
@@ -142,7 +150,7 @@
// @GetMapping("/all")
// 杩涚墖浠诲姟,浼犺鍗昳d
// 鎸夎鍗曚紭鍏堣繘鐗�
- public Short selectAll(Short glassid) {
+ public Short selectAll(String glassid) {
int cage1;
int cells;
@@ -202,10 +210,12 @@
datas.add((short) prctier);
datas.add((short) 1);
// 鏁版嵁搴撲慨鏀圭瀛愯〃鏂板涓�鏉$幓鐠�
- spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 1);
+ spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 2);
spianMapper.UpdataAddCage1(widths, cage1, cells);//鍑忓皯鏍煎瓙瀹藉害
spianMapper.Inserttask(0, 0, 1000, ids,glassid.toString());//鏂板浠诲姟
S7control.getinstance().WriteWord(adddresslist, datas);
+
+ // S7control.getinstance().WriteByte("DB105.16",glassid);
return (200);
}
@@ -254,7 +264,7 @@
datas.add((short) 1);
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
+ spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//鏂板浠诲姟
//int state = spianMapper.selectGlassState(cage, cell);//鑾峰彇鏍煎瓙鏁伴噺
if(state==2){
@@ -262,24 +272,27 @@
spianMapper.UpdateDBCage2(cage, cell);// 娓呴櫎鍐呯墖鏁版嵁
}
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
-
-
+ outmesid(glassid);//娲惧彂鍑虹墖ID
+
+
return (200);//缁撴潫
} else {
// 鑾峰彇鏍煎瓙鐨勭幓鐠冩暟閲�
int state = spianMapper.selectGlassState(cage, cell);
// 鍒ゆ柇鍐呯墖鏄惁闇�瑕佽皟鎷�
if (state == 0) {
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);
+ //spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);
datas.add((short) prcid);
datas.add((short) 1000);
datas.add((short) 1);
datas.add((short) 1);
spianMapper.Inserttask(1, 0,cageout.getId(),1000 ,glassid);//鏂板浠诲姟
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
+ spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
+ outmesid(glassid);//娲惧彂鍑虹墖ID
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
- //spianMapper.Updatetask(1, 1);//瀹屾垚浠诲姟
+
+
return (200);//缁撴潫
} else {
@@ -302,14 +315,17 @@
datas.add((short) 2);
datas.add((short) 1);
// 鏇存崲鐜荤拑鐨勭瀛�
- spianMapper.UpdataAddCage1(glasswidth, cages, cells);//鍑忓皯鏂版牸瀛愬搴�
+ String glassids=spianMapper.SelectGlassid(cage, cell); //鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
spianMapper.UpdateDBCage(ids, cage, cell);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
+ spianMapper.UpdataAddCage1(glasswidth, cages, cells);//鍑忓皯鏂版牸瀛愬搴�
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
+ spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
spianMapper.Inserttask(2, 0,cageout.getId(),ids,glassid);//鏂板璋冨害浠诲姟
spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//鏂板鍑虹墖浠诲姟
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+ S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+
+ outmesid(glassids);//娲惧彂璋冩嫧鐜荤拑ID
return (200); //缁撴潫
} else {// 绗煎瓙鍙峰ぇ浜�5鏃�
@@ -327,14 +343,17 @@
datas.add((short) prcid2);
datas.add((short) 2);
datas.add((short) 1);
+ String glassids=spianMapper.SelectGlassid(cage, cell); //鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
spianMapper.Inserttask(2, 0,cageout.getId()+1,ids,glassid);//鏂板璋冨害浠诲姟
spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//鏂板鍑虹墖浠诲姟
+ spianMapper.UpdateDBCage(ids, cage, cell);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
spianMapper.UpdataAddCage1(glasswidth, cages, cells);//鍑忓皯鏂版牸瀛愬搴�
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdateDBCage(ids, cage, cell);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
- spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
+ spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+ S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+
+ outmesid(glassids);//娲惧彂璋冩嫧鐜荤拑ID
return (200);//缁撴潫
}
@@ -343,6 +362,17 @@
}
+ public void outmesid(String glassid) {
+ System.out.println("outmesid:"+glassid);
+ List<Byte> glassidlist=new ArrayList();
+ for (char iditem : glassid.toCharArray()) {
+ glassidlist.add(Byte.valueOf(String.valueOf(iditem)));
+ }
+ byte[] bytes= Bytes.toArray(glassidlist);
+ System.out.println("outmesidbytes:"+bytes.length);
+ S7control.getinstance().WriteByte("DB105.30", bytes);//娲惧彂鍑虹墖id
+ }
+
/*** 淇敼鐢ㄦ埛* @throws SQLException */
// public static int updateUser(Glass user) throws SQLException {conn =
// getConn();
--
Gitblit v1.8.0