From cc24badd0e407574ced84850dfd1feba53982bf5 Mon Sep 17 00:00:00 2001
From: zhangyong <517047165@qq.com>
Date: 星期日, 17 九月 2023 16:10:36 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java | 4
CanadaMes-ui/src/views/home/index.vue | 52 ++++++----
CanadaMes-ui/src/views/Electrical/alarm.vue | 1
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java | 61 ++++++-----
CanadaMes-ui/src/views/Electrical/State.vue | 20 ++-
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java | 23 +++-
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java | 9 +
springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java | 15 ++
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java | 95 +++++++++----------
springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java | 8 +
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java | 10 +-
11 files changed, 174 insertions(+), 124 deletions(-)
diff --git a/CanadaMes-ui/src/views/Electrical/State.vue b/CanadaMes-ui/src/views/Electrical/State.vue
index fdf7dd0..bb0a133 100644
--- a/CanadaMes-ui/src/views/Electrical/State.vue
+++ b/CanadaMes-ui/src/views/Electrical/State.vue
@@ -3,11 +3,16 @@
<!--闈㈠寘灞戝鑸尯鍩�-->
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') }}</router-link>
- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') }}</router-link>
- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') }}</router-link>
- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') }}</router-link>
- <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') }}</router-link>
+ <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
+ }}</router-link>
+ <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
+ }}</router-link>
+ <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
+ }}</router-link>
+ <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
+ }}</router-link>
+ <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
+ }}</router-link>
</el-breadcrumb>
<div>{{ $t('State') }}</div>
@@ -16,7 +21,7 @@
<el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="messagepack.data">
<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" readonly></el-input>
+ <el-input style="width: 60%;" class="in_mc" v-model="item.name" readonly></el-input>
<el-input v-model="item.value" readonly="readonly" style="width: 90px;"></el-input>
</div>
@@ -53,7 +58,7 @@
{ name: 'D05.State', value: "鑷姩" },
{ name: 'D06.State', value: "鑷姩" },
],
-
+
},
@@ -162,6 +167,7 @@
margin-bottom: 15px;
}
+
.el-input {
border: none;
diff --git a/CanadaMes-ui/src/views/Electrical/alarm.vue b/CanadaMes-ui/src/views/Electrical/alarm.vue
index a56d009..910046b 100644
--- a/CanadaMes-ui/src/views/Electrical/alarm.vue
+++ b/CanadaMes-ui/src/views/Electrical/alarm.vue
@@ -131,6 +131,7 @@
},
selectTime () {
+
//moment闇�瑕佸崟鐙畨杞緷璧栵紝npm install moment
let sj1 = moment(this.shijian1).format('YYYY-MM-DD%20HH:mm');
let sj2 = moment(this.shijian2).format('YYYY-MM-DD%20HH:mm')
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 72685ec..072ab2c 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -60,6 +60,8 @@
.gezi {
height: 35px;
+
+ position: absolute;
width: 3.07px;
/* width: 4.22px; */
}
@@ -75,19 +77,20 @@
.blocks {
+
- max-width: 94vw;
background-image: url('../../img/xmjc.png');
margin: 0 auto;
background-repeat: no-repeat;
background-attachment: local;
width: 1660px;
min-height: 55vh;
+ max-width: 94vw;
background-size: 1200px 510px;
/* max-width: 100vw;
background-size: 1660px 560px; */
-
-
+
+
}
.blocks-img {
@@ -238,19 +241,22 @@
<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']"
- @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+'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']"
- @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+'px' }" @click="showcageinfo(item['cage'])"></div>
</div>
- <div style="display:flex;position: absolute;float:left;z-index: 999;top:138px;left:237px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
- @click="showcageinfo(item['cage'])"></div>
+ <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:237px;">
+ <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+'px' }"
+ @click="showcageinfo(item['cage'])">
+ </div>
</div>
- <div style="display:flex;position: absolute;float:left;z-index: 999;top:138px;left:640px;">
- <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
+ <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:640px;">
+ <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+'px' }"
@click="showcageinfo(item['cage'])"></div>
</div>
<div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
@@ -258,19 +264,23 @@
<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']"
+ <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']"
+ <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']"
+ <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']"
+ <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>
@@ -424,10 +434,10 @@
//console.log("鏀跺埌鏁版嵁====" + msg.data);
let obj = JSON.parse(msg.data);
if (obj.params != null) {
- this.car1 = 107 + 17.62 * obj.params[0][0];
- this.car2 = 175 + 17.62 * obj.params[0][1];
- // this.car1 = 150 + 24.6 * obj.params[0][0];
- // this.car2 = 242 + 24.6 * obj.params[0][1];
+ 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.tableData = obj.tableData[0];
this.cagelist1 = obj.cagelist1[0];
@@ -625,7 +635,7 @@
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'));
}
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 131cd1b..c410d62 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
@@ -36,23 +36,21 @@
spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
- // 鏍规嵁鐜荤拑id鑾峰彇璁㈠崟鍙�
- try {
- Glass glass = jdbcConnections.selectGlass(112);
+ // 鏍规嵁鐜荤拑id鑾峰彇璁㈠崟鍙�,鍗曠嫭鏁版嵁婧�
+ // try {
+ // Glass glass = jdbcConnections.selectGlass(112);
- // System.out.println(glass.getOrderId());
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- // spianService.selectout("11");
-
- // 鍒ゆ柇杩涚墖璇锋眰
+ // // System.out.println(glass.getOrderId());
+ // } catch (SQLException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ spianService.selectAll((short)257);
+ //鍒ゆ柇杩涚墖璇锋眰
List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);
List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);
-
-
+
+
if (datas1List != null && datas1ListState != null) {
// 鑾峰彇prc杩涚墖璇锋眰鏁版嵁
boolean exist = datas1List.contains((short) 1);
@@ -60,11 +58,11 @@
boolean exist1 = datas1ListState.contains((short) 0);
String glassid="";
// 杩涚墖璇锋眰涓�1鏃�
- if (exist = true) {
+ if (exist == true) {
// 褰撹繘鐗囪溅绌洪棽鏃�
- if (exist1 = true) {
+ if (exist1 == true) {
// 鑾峰彇杩涚墖id
- List<Short> datas1ListID = S7control.getinstance().ReadWord("DB106.26", 13);
+ List<Short> datas1ListID = S7control.getinstance().ReadWord("DB106.26", 1);
if (datas1ListID != null) {
// 鑾峰彇鐜荤拑id
for (Short list1 : datas1ListID) {
@@ -78,25 +76,34 @@
// System.out.println(exist);
}
}
-
+
//spianService.selectAll((short) 111);
-
+
List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖杞︾姸鎬�
- //List<Short> outlist2 = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖浠诲姟瀹屾垚
-
-
- if (outlist != null) {
+ boolean outstate=false;//鍑虹墖杞︾┖闂插垽鏂�
+ if (outlist != null) {
// 鍒ゆ柇鎸夎鍗曞嚭鐗�
- boolean outstate = outlist.contains((short) 0);
-
- if (outstate = true) { // 鍑虹墖杞︾姸鎬佺┖闂叉椂
+ outstate = outlist.contains((short) 0);
+ Glass glass=spianMapper.SelectDBOut();//鍒ゆ柇鏄惁鏈夎皟鎷ㄥ悗鐨勫嚭鐗囦换鍔℃湭瀹屾垚
+
+ if(outstate== true ){
+ if(glass.getId()==2){
+ spianService.selectout2(glass.getGlassId().toString());
+ }
+ }
+ }
+
+
+
+
+ if (outstate == true) { // 鍑虹墖杞︾姸鎬佺┖闂叉椂
String orderid = spianMapper.SelectOrderout();
if (orderid != null) {
spianService.selectout(orderid);
}
}
- }
+
// 鏌ヨ鏁版嵁搴�
// 鎺ㄩ�佸埌鍓嶇
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/Plcsign.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
index ce46de1..8ec4b48 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
@@ -16,16 +16,25 @@
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/WebSocketServer.java b/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
index ebdc697..9515c0d 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
@@ -112,7 +112,7 @@
*/
public void sendMessage(String message) {
try {
- log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
+ // log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
this.session.getBasicRemote().sendText(message);
} catch (Exception e) {
log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
@@ -125,7 +125,7 @@
public void sendAllMessage(String message) {
try {
for (WebSocketServer webSocketServer : sessionMap.values()) {
- log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
+ //log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
webSocketServer.sendMessage(message);
}
} catch (Exception e) {
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java b/springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java
index 1fbb577..a1de33a 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java
@@ -3,6 +3,7 @@
public class StorageTask{
private Integer id;
private String taskType;
+ private String glassId;
private String cataskStatege;
private String shelfRack;
private String loadrack;
@@ -25,6 +26,13 @@
public void setTaskType(String taskType) {
this.taskType = taskType;
}
+ public String getGlassId() {
+ return glassId;
+ }
+
+ public void setGlassId(String glassId) {
+ this.glassId = glassId;
+ }
public String getCataskStatege() {
return cataskStatege;
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 3e22d2c..b8ffefa 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
@@ -14,19 +14,19 @@
List<StorageCage> selectAll();
// 鏌ヨ1-5绗煎唴灞傛牸瀛愮姸鎬�
- @Select("SELECT cage,state from storage_cage where cage<=5 and tier=1")
+ @Select("SELECT cage,state,glasswidth/2750*2 as glasswidth from storage_cage where cage<=5 and tier=2")
List<StorageCage> selectRack1();
// 鏌ヨ6-10绗煎唴灞傛牸瀛愮姸鎬�
- @Select("SELECT cage,state from storage_cage where cage>5 and tier=1")
+ @Select("SELECT cage,state,glasswidth/2750*2 as glasswidth from storage_cage where cage>5 and tier=2")
List<StorageCage> selectRack2();
// 鏌ヨ1-5绗煎灞傛牸瀛愮姸鎬�
- @Select("SELECT cage,state from storage_cage where cage<=5 and tier=2")
+ @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 cell")
List<StorageCage> selectRack3();
// 鏌ヨ6-10绗煎灞傛牸瀛愮姸鎬�
- @Select("SELECT cage,state from storage_cage where cage>5 and tier=2")
+ @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 cell")
List<StorageCage> selectRack4();
// 鏍规嵁浠诲姟绫诲瀷鏌ヨ褰撳墠姝e湪鍑虹墖锛岃繘鐗囩殑鐜荤拑淇℃伅
@@ -66,7 +66,7 @@
List<alarmmg> SelectAlarmmgInfo();
//鑾峰彇鐞嗙墖绗煎唴鐜荤拑淇℃伅
- @Select("select *,concat(glasswidth,' x ',glassheight) as lengthwidth from storage_cage where cage=#{cage} ")
+ @Select("select *,concat(glasswidth,' x ',glassheight) as lengthwidth from storage_cage where cage=#{cage} and state!=0 ")
List<StorageCage> SelectCageInfo(short cage);
@Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,coating=null where glass_id=#{glassid}")
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 ae9b6a6..e86cd52 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
@@ -18,12 +18,12 @@
//@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=#{orderids},order_id,null))as orderid from storage_cage where (order_id=#{orderids} or ''='') GROUP BY cage ORDER BY orderid desc; ")
+ @Select("select cage,COUNT(if(order_id=#{orderids},order_id,null))as orderid,cell,min(state)as state1 from storage_cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY orderid desc; ")
List<StorageCage> selectAll(Short orderids);
//鍒ゆ柇璇ョ瀛愭槸鍚︽湁鍚堥�傚搴︾┖鏍�
- @Select("select cage,cell,tier,id,ROUND(id/2)as prcId from storage_cage where cage=#{cage1} and state=0 and width>=#{width} ORDER BY cell asc,tier desc LIMIT 1")
- StorageCage selectCage1(int cage1,double width);
+ @Select("select cage,cell,tier,id,ROUND(id/2)as prcId,width from storage_cage where cage=#{cage1} and cell=#{cell} and state=0 and width>=#{width} ORDER BY cell asc,tier desc LIMIT 1")
+ StorageCage selectCage1(int cage1,int cell,double width);
//鍒ゆ柇绗煎瓙鍐呯幓鐠冩暟
@Select("select COUNT(tier)as tier from storage_cage where cage=#{cage} and cell=#{cell} and state=1;")
int selectsum(int cage,int cell);
@@ -50,11 +50,11 @@
int selectGlassState(int cage,int cell);
//鍒ゆ柇璇ヨ皟鎷ㄧ殑绗煎瓙
- @Select("select cage,cell,max(state)as shu,ROUND(id/2)as prcid,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;")
+ @Select("select glass_id,cage,cell,max(state)as shu,ROUND(id/2)as prcid,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},glass_id=#{glassid},order_id=#{orderid},glasswidth=0 where cage=#{cage} and cell=#{cell} and tier=#{tier};")
+ @Update("update storage_cage as a set state=#{state},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);
//淇敼绗煎瓙淇℃伅(杩涚墖)
@@ -72,8 +72,8 @@
// @Insert("insert into user(name, date, address, user_no) values (#{name}, #{date}, #{address}, #{userNo})")
// void insert (Spian spian);
//鏂板浠诲姟琛�
- @Insert("INSERT INTO `canadames`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now());")
- void Inserttask(int tasktype,int taskstate,int shelfrack,int loadrack);
+ @Insert("INSERT INTO `canadames`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid});")
+ void Inserttask(int tasktype,int taskstate,int shelfrack,int loadrack,String glassid);
//淇敼浠诲姟琛�
@Update("update storage_task set task_state=#{state} where task_type=#{type} and task_state=0;")
void Updatetask(int state,int type);
@@ -83,4 +83,13 @@
//鏌ヨ鎸夎鍗曞嚭鐗�
@Select("select order_id state from order_out where state=0")
String SelectOrderout();
+ //鍐呭鐗囪皟鎹�
+ @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.cage=#{cage} and a.cell=#{cell} and a.tier=1")
+ void UpdateDBCage1(int cage,int cell);
+ //娓呴櫎鍐呯墖鏁版嵁
+ @Update("update storage_cage set glass_id='',order_id='',state=0,glasswidth=0 where a.cage=#{cage} and a.cell=#{cell} and a.tier=1;")
+ void UpdateDBCage2(int cage,int cell);
+ //鍒ゆ柇鏄惁鏈夎皟鎷ㄥ畬鍚庡嚭鐗囩殑浠诲姟
+ @Select("select COUNT(*)as id,glass_id from storage_task where (task_type=1 or task_type=2) and task_state=0;")
+ Glass SelectDBOut();
}
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 942e6dd..70bb729 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
@@ -57,10 +57,7 @@
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
- spianMapper.Inserttask(1, 0,cageout.getId(),1000 );//鏂板浠诲姟
-
- S7control.getinstance().WriteWord("DB106.22", (short)0); //鍑虹墖浠诲姟瀹屾垚鏀规垚0
- S7control.getinstance().WriteWord("DB106.20", (short)1); //鍑虹墖杞︾姸鎬佹敼鎴愬繖纰�
+ spianMapper.Inserttask(1, 0,cageout.getId(),1000,orderid);//鏂板浠诲姟
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
return Result.success(datas);//缁撴潫
} else {
@@ -73,11 +70,9 @@
datas.add((short) 1000);
datas.add((short) 1);
datas.add((short) 1);
- spianMapper.Inserttask(1, 0,cageout.getId(),1000 );//鏂板浠诲姟
+ spianMapper.Inserttask(1, 0,cageout.getId(),1000,orderid);//鏂板浠诲姟
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
- S7control.getinstance().WriteWord("DB106.22", (short)0); //鍑虹墖浠诲姟瀹屾垚鏀规垚0
- S7control.getinstance().WriteWord("DB106.20", (short)1); //鍑虹墖杞︾姸鎬佹敼鎴愬繖纰�
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
//spianMapper.Updatetask(1, 1);//瀹屾垚浠诲姟
return Result.success(datas);//缁撴潫
@@ -106,11 +101,10 @@
// 鏇存崲鐜荤拑鐨勭瀛�
spianMapper.UpdataAddCage1(glasswidth, cages, cells);//鍑忓皯鏂版牸瀛愬搴�
spianMapper.UpdateDBCage(ids, cage, cell);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
+ spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
- spianMapper.Inserttask(2, 0,cageout.getId(),ids );//鏂板璋冨害浠诲姟
+ spianMapper.Inserttask(2, 0,cageout.getId(),ids,orderid);//鏂板璋冨害浠诲姟
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- S7control.getinstance().WriteWord("DB106.22", (short)0); //鍑虹墖浠诲姟瀹屾垚鏀规垚0
- S7control.getinstance().WriteWord("DB106.20", (short)1); //鍑虹墖杞︾姸鎬佹敼鎴愬繖纰�
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
return Result.success(cagecell); //缁撴潫
@@ -129,13 +123,12 @@
datas.add((short) prcid2);
datas.add((short) 2);
datas.add((short) 1);
- spianMapper.Inserttask(2, 0,cageout.getId(),ids );//鏂板璋冨害浠诲姟
+ 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);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- S7control.getinstance().WriteWord("DB106.22", (short)0); //鍑虹墖浠诲姟瀹屾垚鏀规垚0
- S7control.getinstance().WriteWord("DB106.20", (short)1); //鍑虹墖杞︾姸鎬佹敼鎴愬繖纰�
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
return Result.success(cagecell); //缁撴潫
@@ -157,9 +150,10 @@
int prcid;
int tiers;
int prctier;
-
+ double width;
+ double minwidth=0;
spianMapper.Updatetask(1, 0);//瀹屾垚浠诲姟
- Glass glasslist = spianMapper.selectGlass(glassid);
+ Glass glasslist = spianMapper.selectGlass(glassid);
if(glasslist==null){
return (300);
}
@@ -184,22 +178,24 @@
cage1 = storageCage2.getCage();
// 鍒ゆ柇璇ョ瀛愬彿鐩搁偦鏈�澶х殑绌烘牸鏁�
int cages = spianMapper.selectCage(cage1);
+ StorageCage cages1 ;
+ //鍒ゆ柇鏄惁鏄浜岀墖闇�瑕佸姞闂撮殧鐗�
+ prctier = spianMapper.selectsum(cage1, storageCage2.getCell());// 浼犵粰prc鐨勬牸瀛愬唴鐜荤拑鏁�
+ if(prctier>0){
+ cages1 = spianMapper.selectCage1(cage1,storageCage2.getCell(),widths+400);
+ }else{
+ cages1 = spianMapper.selectCage1(cage1,storageCage2.getCell(),widths);
+ }
// 鍒ゆ柇閫変腑绗煎瓙鏄惁鏈夊悎閫傚搴︾┖鏍�
- StorageCage cages1 = spianMapper.selectCage1(cage1, widths);
- if (cages1 != null) {
+ // 鏈夊悎閫傜┖鏍兼椂杩涚墖
+ if (cages1 != null&&cages>=1) {
ids = cages1.getId();// 鏁版嵁搴揑D
tiers = cages1.getTier();// 鍐呭鐗�
cells = cages1.getCell();// 鏍煎瓙鍙�
prcid = cages1.getPrcId();// 浼犵粰prc鐨勭洰鏍囧湴id
-
-
- if (glasslist == null) {
- return (300);
- }
- spianMapper.Inserttask(0, 0, 1000, ids);//鏂板浠诲姟
- prctier = spianMapper.selectsum(cage1, cells);// 浼犵粰prc鐨勬牸瀛愬唴鐜荤拑鏁�
- // 鏈夊悎閫傜┖鏍兼椂杩涚墖
- if (cages > 1 && cages1.getTier() != null) {
+ width=cages1.getWidth();//鏍煎瓙鍓╀綑瀹藉害
+ widths=glasslist.getWidth();
+
// 鎵ц杩涚墖
datas.add((short) 1000);
datas.add((short) prcid);
@@ -208,12 +204,10 @@
// 鏁版嵁搴撲慨鏀圭瀛愯〃鏂板涓�鏉$幓鐠�
spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 1);
spianMapper.UpdataAddCage1(widths, cage1, cells);//鍑忓皯鏍煎瓙瀹藉害
-
+ spianMapper.Inserttask(0, 0, 1000, ids,glassid.toString());//鏂板浠诲姟
S7control.getinstance().WriteWord(adddresslist, datas);
- S7control.getinstance().WriteWord("DB106.10", (short)0); //杩涚墖浠诲姟瀹屾垚鏀规垚0
- S7control.getinstance().WriteWord("DB106.8", (short)1); //杩涚墖杞︾姸鎬佹敼鎴愬繖纰�
- return (200);
- }
+ return (200);
+
}
}
@@ -223,6 +217,7 @@
// @GetMapping("/all2")
public Short selectout2(String glassid) {
+ spianMapper.UpdatetaskOut(); //瀹屾垚涓婁竴娆″嚭鐗囨垨鑰呰皟搴︿换鍔�
// 瀹氫箟PRC鏁版嵁浼犻�佹暟缁�
List<String> adddresslist = new ArrayList<>();
adddresslist.add("DB105.6");// 鍑虹墖杞﹁捣濮嬩綅缃�
@@ -246,24 +241,29 @@
int prcid2;
int ids;
int cages;
- int cells;
+ int cells;
double glasswidth = cageout.getGlassWidth();
// 鍒ゆ柇鐜荤拑鍐呭鐗�
if (tier == 2) {
+ int state = spianMapper.selectGlassState(cage, cell);//鑾峰彇鏍煎瓙鏁伴噺
// 鍒ゆ柇鐜荤拑鍙洿鎺ュ嚭鐗囨椂
// 淇敼鏁版嵁搴撶瀛愯〃(鍑虹墖)
datas.add((short) prcid);
datas.add((short) 1000);
- datas.add((short) 1);
+ datas.add((short) state);
datas.add((short) 1);
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
- spianMapper.Inserttask(1, 0,cageout.getId(),1000 );//鏂板浠诲姟
-
- S7control.getinstance().WriteWord("DB106.22", (short)0); //鍑虹墖浠诲姟瀹屾垚鏀规垚0
- S7control.getinstance().WriteWord("DB106.20", (short)1); //鍑虹墖杞︾姸鎬佹敼鎴愬繖纰�
+ spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//鏂板浠诲姟
+ //int state = spianMapper.selectGlassState(cage, cell);//鑾峰彇鏍煎瓙鏁伴噺
+ if(state==2){
+ spianMapper.UpdateDBCage1(cage, cell);// 灏嗗唴鐗囨暟鎹洿鏂板埌澶栫墖閲�
+ spianMapper.UpdateDBCage2(cage, cell);// 娓呴櫎鍐呯墖鏁版嵁
+ }
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
+
+
return (200);//缁撴潫
} else {
// 鑾峰彇鏍煎瓙鐨勭幓鐠冩暟閲�
@@ -275,11 +275,9 @@
datas.add((short) 1000);
datas.add((short) 1);
datas.add((short) 1);
- spianMapper.Inserttask(1, 0,cageout.getId(),1000 );//鏂板浠诲姟
+ spianMapper.Inserttask(1, 0,cageout.getId(),1000 ,glassid);//鏂板浠诲姟
spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
- S7control.getinstance().WriteWord("DB106.22", (short)0); //鍑虹墖浠诲姟瀹屾垚鏀规垚0
- S7control.getinstance().WriteWord("DB106.20", (short)1); //鍑虹墖杞︾姸鎬佹敼鎴愬繖纰�
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
//spianMapper.Updatetask(1, 1);//瀹屾垚浠诲姟
return (200);//缁撴潫
@@ -295,10 +293,7 @@
prcid2 = cagecell.getPrcId();// 璋冩嫧鐩爣浣峆RCID
ids = cagecell.getId();// 璋冩嫧鐩爣浣岻D
cages=cagecell.getCage();//璋冩嫧鐩爣浣嶇瀛�
- cells=cagecell.getCell();//璋冩嫧鐩爣浣嶆牸瀛�
-
-
-
+ cells=cagecell.getCell();//璋冩嫧鐩爣浣嶆牸瀛�
// 濉叆璋冩嫧鏁版嵁
@@ -309,11 +304,11 @@
// 鏇存崲鐜荤拑鐨勭瀛�
spianMapper.UpdataAddCage1(glasswidth, cages, cells);//鍑忓皯鏂版牸瀛愬搴�
spianMapper.UpdateDBCage(ids, cage, cell);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
+ spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
- spianMapper.Inserttask(2, 0,cageout.getId(),ids );//鏂板璋冨害浠诲姟
+ spianMapper.Inserttask(2, 0,cageout.getId(),ids,glassid);//鏂板璋冨害浠诲姟
+ spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//鏂板鍑虹墖浠诲姟
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- S7control.getinstance().WriteWord("DB106.22", (short)0); //鍑虹墖浠诲姟瀹屾垚鏀规垚0
- S7control.getinstance().WriteWord("DB106.20", (short)1); //鍑虹墖杞︾姸鎬佹敼鎴愬繖纰�
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
return (200); //缁撴潫
@@ -332,13 +327,13 @@
datas.add((short) prcid2);
datas.add((short) 2);
datas.add((short) 1);
- spianMapper.Inserttask(2, 0,cageout.getId(),ids );//鏂板璋冨害浠诲姟
+ spianMapper.Inserttask(2, 0,cageout.getId()+1,ids,glassid);//鏂板璋冨害浠诲姟
+ spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//鏂板鍑虹墖浠诲姟
spianMapper.UpdataAddCage1(glasswidth, cages, cells);//鍑忓皯鏂版牸瀛愬搴�
+ spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
spianMapper.UpdateDBCage(ids, cage, cell);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 娓呴櫎琚皟鎷ㄦ牸瀛愭暟鎹�
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- S7control.getinstance().WriteWord("DB106.22", (short)0); //鍑虹墖浠诲姟瀹屾垚鏀规垚0
- S7control.getinstance().WriteWord("DB106.20", (short)1); //鍑虹墖杞︾姸鎬佹敼鎴愬繖纰�
S7control.getinstance().WriteWord(adddresslist, datas);//娲惧彂鍑虹墖杞︿换鍔�
return (200);//缁撴潫
--
Gitblit v1.8.0