From 5400d8b310ce6fe6919594a096f3a87307a66e61 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期四, 11 一月 2024 08:47:36 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
CanadaMes-ui/src/views/home/index.vue | 89 ++-
springboot-vue3/src/main/resources/JsonFile/PlcParameter.json | 77 +++
springboot-vue3/src/main/java/com/example/springboot/component/PlcsignReview.java | 124 ++++
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java | 241 +++++----
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitInfo.java | 74 ++
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java | 14
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java | 2
springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java | 17
springboot-vue3/src/main/resources/JsonFile/PlcSign.json | 47 +
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java | 78 +-
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java | 13
CanadaMes-ui/src/layout/index.vue | 26
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java | 7
CanadaMes-ui/src/lang/locales/zh-CN.json | 3
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitObject.java | 113 ++++
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java | 24
CanadaMes-ui/src/api/home.js | 7
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java | 149 +++++
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterInfo.java | 112 ++++
springboot-vue3/src/main/java/com/example/springboot/entity/Out_slice.java | 10
CanadaMes-ui/src/lang/locales/en-US.json | 3
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java | 213 ++++++++
springboot-vue3/src/main/java/com/example/springboot/service/North_Glass_Buffer1Service.java | 6
23 files changed, 1,236 insertions(+), 213 deletions(-)
diff --git a/CanadaMes-ui/src/api/home.js b/CanadaMes-ui/src/api/home.js
index f281e67..6560bec 100644
--- a/CanadaMes-ui/src/api/home.js
+++ b/CanadaMes-ui/src/api/home.js
@@ -238,3 +238,10 @@
})
}
+export function FrameStateUpdate(frameno,framestate) {
+ return request({
+ url: '/home/FrameStateUpdate?frameno=' + frameno+'&framestate='+framestate,
+ method: 'post',
+ data:""
+ })
+}
diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index 54a8dee..422dbf4 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -341,6 +341,9 @@
"EXTERIQR OUT AND BYPASS TO THE RIGHT":"EXTERIQR OUT AND BYPASS TO THE RIGHT",
"Complete Task":"Complete Task",
"Outed":"Outed",
+ "Queue State":"Queue State",
+ "Sorting State":"Sorting State",
+ "Confirm State":"Confirm State",
"ServoManualone": {
"A01 鎵�鍦ㄦ牸瀛�": "A01 Current Grid",
"鏁伴噺": "Quantity",
diff --git a/CanadaMes-ui/src/lang/locales/zh-CN.json b/CanadaMes-ui/src/lang/locales/zh-CN.json
index 705b108..cc0008c 100644
--- a/CanadaMes-ui/src/lang/locales/zh-CN.json
+++ b/CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -330,6 +330,9 @@
"EXTERIQR OUT AND BYPASS TO THE RIGHT":"EXTERIQR OUT AND BYPASS TO THE RIGHT",
"Complete Task":"瀹屾垚浠诲姟",
"Outed":"宸插嚭绗�",
+ "Queue State":"闃熷垪鐘舵��",
+ "Sorting State":"鎺掑簭鐘舵��",
+ "Confirm State":"纭鐘舵��",
"langparameter": {
"conveyor Velocity(Auto FAST)": "D01-D06 鐨甫杈撻�佽嚜鍔ㄥ揩閫�",
"conveyor Velocity(Auto SLOW)": "D01-D06 鐨甫杈撻�佽嚜鍔ㄦ參閫�",
diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index 3aafa96..244d977 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -103,19 +103,19 @@
</el-table>
</el-dialog>
<el-dialog :visible.sync="dialogFormCountDown" :title="$t('Approximately resettable time')" top="5vh">
- <div :style="'font-size: ' + PromptSize + 'px;text-align: center;'">
- <!-- {{ this.CountDowns }} -->
- {{ this.CountDowns }}
- </div>
- </el-dialog>
- <el-dialog :visible.sync="dialogFormVisible3">
+ <div :style="'font-size: ' + PromptSize + 'px;text-align: center;'">
+ <!-- {{ this.CountDowns }} -->
+ {{ this.CountDowns }}
+ </div>
+ </el-dialog>
+ <!-- <el-dialog :visible.sync="dialogFormVisible3">
<el-button :class="{ 'blue-button': receivedData === 1 }" @click="toggleButtonValue(1)">{{
$t('A01Abort/ResumeTasks') }}</el-button>
<el-button :class="{ 'blue-button': receivedData2 === 1 }" @click="toggleButtonValue(2)">{{
$t('A02Abort/ResumeTasks') }}</el-button>
- </el-dialog>
+ </el-dialog> -->
</el-container>
</template>
@@ -161,7 +161,7 @@
CountDowns: "0",
EmergencyStop: false,
PromptSize: 250,
- dialogFormCountDown:false
+ dialogFormCountDown: false
}
},
@@ -274,7 +274,6 @@
}
//澶嶄綅鍊掕鏃�
- console.log(obj.countdown);
if (obj.countdown != null) {
if ((obj.countdown[0] == true && this.CountDowns == 0) || this.EmergencyStop == true) {
this.CountDown();
@@ -292,13 +291,12 @@
-
if (obj.Abort) {
if (obj.Abort[0].length > 0) {
this.receivedData = obj.Abort[0][0];
this.receivedData2 = obj.Abort[0][1];
- this.dialogFormVisible3 = true;
+ // this.dialogFormVisible3 = true;
}
}
this.$forceUpdate();
@@ -328,7 +326,6 @@
this.PromptSize = 500;
this.CountDowns = count;
count--;
- this.dialogFormCountDown = true;
}
else {
this.PromptSize = 200;
@@ -339,10 +336,13 @@
}
}
}
+
},
1000
);
-
+ if (this.reset == false) {
+ this.dialogFormCountDown = true;
+ }
},
logout: function () {
removeToken()
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 7c8e015..e0a791e 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -245,13 +245,13 @@
</div>
<div>
<el-table :data="this.tasklist1" border style="width: 100%">
- <el-table-column :width="180" prop="glassId" :label="$t('Outfeed glass barcode')"></el-table-column>
- <el-table-column :width="130" prop="cage" :label="$t('Cage No')"></el-table-column>
- <el-table-column :width="130" prop="cell" :label="$t('Slot No')"></el-table-column>
- <el-table-column :width="130" prop="orderId" :label="$t('Order No')"></el-table-column>
+ <el-table-column :min-width="180" prop="glassId" :label="$t('Outfeed glass barcode')"></el-table-column>
+ <el-table-column :min-width="130" prop="cage" :label="$t('Cage No')"></el-table-column>
+ <el-table-column :min-width="130" prop="cell" :label="$t('Slot No')"></el-table-column>
+ <el-table-column :min-width="130" prop="orderId" :label="$t('Order No')"></el-table-column>
<el-table-column prop="orderId" :label="$t('List No')"></el-table-column>
<el-table-column prop="orderId" :label="$t('Box No')"></el-table-column>
- <el-table-column :width="130" prop="lengthWidth" :label="$t('Dim')">
+ <el-table-column :min-width="150" prop="lengthWidth" :label="$t('Dim')">
<template slot-scope='scope'>
{{ scope.row.glasswidthmm }}*{{ scope.row.glassheightmm }}
</template>
@@ -265,13 +265,13 @@
</el-table-column>
</el-table>
<el-table :data="this.tasklist2" border style="width: 100%">
- <el-table-column :width="180" prop="glassId" :label="$t('Infeed glass barcode')"></el-table-column>
- <el-table-column :width="130" prop="cage" :label="$t('Cage No')"></el-table-column>
- <el-table-column :width="130" prop="cell" :label="$t('Slot No')"></el-table-column>
- <el-table-column :width="130" prop="orderId" :label="$t('Order No')"></el-table-column>
+ <el-table-column :min-width="180" prop="glassId" :label="$t('Infeed glass barcode')"></el-table-column>
+ <el-table-column :min-width="130" prop="cage" :label="$t('Cage No')"></el-table-column>
+ <el-table-column :min-width="130" prop="cell" :label="$t('Slot No')"></el-table-column>
+ <el-table-column :min-width="130" prop="orderId" :label="$t('Order No')"></el-table-column>
<el-table-column prop="orderId" :label="$t('List No')"></el-table-column>
<el-table-column prop="orderId" :label="$t('Box No')"></el-table-column>
- <el-table-column :width="130" prop="lengthWidth" :label="$t('Dim')">
+ <el-table-column :min-width="150" prop="lengthWidth" :label="$t('Dim')">
<template slot-scope='scope'>
{{ scope.row.glasswidthmm }}*{{ scope.row.glassheightmm }}
</template>
@@ -444,10 +444,10 @@
<el-table-column :min-width="50" prop="cell" :label="$t('Slot No')"></el-table-column>
<el-table-column :min-width="55" prop="tier" :label="$t('The Side')"></el-table-column>
<el-table-column :min-width="145" prop="glassId" :label="$t('Barcode')"></el-table-column>
- <el-table-column :min-width="100" prop="orderId" :label="$t('Order No')"></el-table-column>
+ <el-table-column :min-width="80" prop="orderId" :label="$t('Order No')"></el-table-column>
<el-table-column :min-width="80" prop="listId" :label="$t('List No')"></el-table-column>
- <el-table-column :min-width="100" prop="boxId" :label="$t('Box No')"></el-table-column>
- <el-table-column :min-width="90" prop="state" :label="$t('Glass State')">
+ <el-table-column :min-width="50" prop="boxId" :label="$t('Box No')"></el-table-column>
+ <el-table-column :min-width="80" prop="state" :label="$t('Glass State')">
<template slot-scope='scope'>
{{
scope.row.state == 1 ? $t('Normal') : scope.row.state == 2 ? $t('Entering') : scope.row.state == 3 ?
@@ -460,6 +460,12 @@
{{ scope.row.glassWidthMm }}{{ scope.row.glassWidthMm > 0 ? "*" : "" }}{{ scope.row.glassHeightMm }}
</template>
</el-table-column>
+
+ <el-table-column :min-width="80" prop="lengthWidth" :label="$t('State')">
+ <template slot-scope='scope'>
+ {{ scope.row.disabled == 0 ? $t('Enable') : $t('Disable') }}
+ </template>
+ </el-table-column>
<el-table-column :min-width="250" :label="$t('Operate')">
<template slot-scope='scope'>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@@ -470,7 +476,7 @@
@click="outglass(scope.row.glassId, scope.row.state)">{{ $t('Out') }}</el-button>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@click="UpdateDisabled(scope.row.cage, scope.row.cell, scope.row.disabled == 0 ? 1 : 0)">
- {{ scope.row.disabled == 0 ? $t('Enable') : $t('Disable') }}</el-button>
+ {{ scope.row.disabled == 0 ? $t('Disable') : $t('Enable') }}</el-button>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
:disabled="scope.row.glassId != null ? true : false"
@click="insertglass(scope.row.cage, scope.row.cell, scope.row.tier)">{{ $t('Add')
@@ -510,8 +516,11 @@
<el-form :model="form" label-width="100px" style="padding-right: 30px">
<div style="display: flex;justify-content: space-around;">
<label for="">{{ $t('Upper film position') }}</label>
+ <div>
+ {{ $t('Confirm State') }}:{{ this.isConfirm == true ? $t('Not Allow') : $t('Allow') }}
<el-button type="primary" @click="isConfirmState()">
- {{ this.isConfirm == true ? "Allow" : "Not Allow" }}</el-button>
+ {{ this.isConfirm == true ? $t('Allow') : $t('Not Allow') }}</el-button>
+ </div>
<label for="">{{ $t('Scan Code Point') }}</label>
</div>
<div style="display: flex;justify-content: space-around;height: 40px;">
@@ -637,18 +646,31 @@
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible6" :title="$t('Outing Queue')" top="5vh">
- <el-button type="primary" @click="isAllowQueueState()" :disabled="!this.isAllowReordering">{{ this.isAllowQueue
+ {{ $t('Queue State') }}:
+ {{ this.isAllowQueue
== true ? $t('Start') : $t('Stop')
+ }}
+ <el-button type="primary" @click="isAllowQueueState()" :disabled="!this.isAllowReordering">{{ this.isAllowQueue
+ == true ? $t('Stop') : $t('Start')
}}</el-button>
- <el-button type="primary" @click="isAllowReorderings()" :disabled="this.isAllowQueue">{{
+ {{ $t('Sorting State') }}:
+ {{
this.isAllowReordering == true ? $t('Not Allow') : $t('Allow')
+ }}
+ <el-button type="primary" @click="isAllowReorderings()" :disabled="this.isAllowQueue">{{
+ this.isAllowReordering == true ? $t('Allow') : $t('Not Allow')
}}</el-button>
<el-input style="width:15%;" :placeholder="$t('Enter the Frame No')" v-model="framebarcode"></el-input>
<el-button type="primary" @click="AddOutSliceS()">{{ $t('Add') }}</el-button>
+ <label style="background-color:yellow;font-size: 23px;" for="">{{ isQueueWarning== true ? $t('The cage is disabled') : "" }}</label>
+ <!-- <span style="background-color:yellow;">
+ {{ isQueueWarning== true ? $t('The cage is disabled') : $t('The cage is disabled') }}
+ </span> -->
+
<el-table :data="this.OutSlice" :height="700" :span-method="objectSpanMethod" border :cell-style="cellStyle"
style="width: 100%;overflow: auto;font-size: 18px;">
<el-table-column :min-width="175" prop="glassId" :label="$t('Barcode')"></el-table-column>
- <el-table-column :min-width="100" prop="orderId" :label="$t('Order No')"></el-table-column>
+ <el-table-column :min-width="70" prop="orderId" :label="$t('Order No')"></el-table-column>
<el-table-column :min-width="70" prop="listId" :label="$t('List No')"></el-table-column>
<el-table-column :min-width="70" prop="boxId" :label="$t('Box No')"></el-table-column>
<el-table-column :min-width="100" prop="glasswidthmm" :label="$t('Length')"></el-table-column>
@@ -670,12 +692,10 @@
</el-table-column>
<el-table-column :min-width="300" prop="position" :label="$t('Position')" style="font-size: 20px;">
<template slot-scope='scope'>
- <!-- {{ scope.row.position == 1 ? "<>鈻勨杽鈻�" : "鈻�" }} -->
<div
:style="'width:' + (scope.row.position == 1 ? '300' : '100') + 'px;height:' + (scope.row.position == 1 ? '100' : '200') + 'px;background-Color:gray;margin:0 auto;'">
- <!-- <div :style="'width:100px;height:300px;background-Color:red;'"></div> -->
+
</div>
- <!-- {{ scope.row.position == 1 ? "<div></div>" : "<div></div>" }} -->
</template>
</el-table-column>
<el-table-column prop="position" :label="$t('Flipped')" :min-width="200">
@@ -685,9 +705,7 @@
</template>
</el-table-column>
<el-table-column prop="barcode" :label="$t('Frame No')"></el-table-column>
-
-
- <el-table-column :width="200" :label="$t('Operate')">
+ <el-table-column :width="240" :label="$t('Operate')">
<template slot-scope='scope'>
<el-button type="text" size="small" @click="getTopMove(scope.row, scope.$index)"
style="font-size: 15px;"
@@ -706,6 +724,10 @@
</el-button>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;" :disabled="isAllowQueue"
@click="deleteproductionqueueglass(scope.row.barcode)">{{ $t('Delete') }}</el-button>
+
+ <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" :disabled="isAllowQueue"
+ @click="FrameStateUpdate(scope.row.barcode,scope.row.framestate)">{{
+ scope.row.framestate == 0 ? $t('Stop') : $t('Start') }}</el-button>
</template>
</el-table-column>
</el-table>
@@ -762,7 +784,7 @@
home, home2, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID, Loadcarlist,
SelectPassword, SelectGlassByGlassID, Disabled, Inglassid, SelectGlass, InsertQueueGlassId, UpdateQueueState, DeleteQueueGlass, SelectGlassNo,
SelectAluminumFrameInfoById, DeleteProductionQueueGlass, AddOutSliceS, isAllowQueues, isConfirmStates, SelectPermissionByUserName, currentUsername, CompleteQueue,
- isAllowReorderings
+ isAllowReorderings, FrameStateUpdate
} from "../../api/home";
@@ -852,7 +874,8 @@
D01RequestState: false,
EmergencyStop: false,
PromptSize: 250,
- reset: false
+ reset: false,
+ isQueueWarning: false
};
},
created() {
@@ -933,6 +956,8 @@
//鏄惁鍏佽鍑虹墖
this.isAllowQueue = obj.isAllowQueue[0];
+ //褰撳墠鍑虹墖鏍煎瓙鏄惁琚鐢�
+ this.isQueueWarning = obj.isQueueWarning[0];
//鏄惁鍏佽鍑虹墖闃熷垪璋冨簭
this.isAllowReordering = obj.isAllowReordering[0];
//鍑虹墖闃熷垪
@@ -1796,6 +1821,18 @@
1000
);
+ },
+ FrameStateUpdate(frameno,framestate){
+ if(framestate == 1){
+ framestate=0;
+ }else{
+ framestate=1;
+ }
+ FrameStateUpdate(frameno,framestate).then(res=>{
+ if(res.data.message == 200){
+ this.$message.success("Operation successful");
+ }
+ });
}
}
}
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 cb92ba3..bfddeba 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
@@ -17,9 +17,10 @@
private SpianMapper spianMapper;
private SpianService spianService;
int aaa;
+
@Override
public void run() {
-
+
while (this != null) {
try {
@@ -29,135 +30,143 @@
e.printStackTrace();
}
if (S7control.getinstance().CheckConnected() == true) {
- spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
- spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
- jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
- // 鏍规嵁鐜荤拑id鑾峰彇璁㈠崟鍙�,鍗曠嫭鏁版嵁婧�
- // try {
- // north_glass_buffer1 glass = jdbcConnections.selectGlass(112);
- // // System.out.println(glass.getOrderId());
- // } catch (SQLException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- //spianService.selectAll("X12345610402GV");
- // 鍑虹墖浠诲姟////////////////////////////////
- List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖杞︾姸鎬�
- List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 鍑虹墖浠诲姟鏄惁鍚姩
- // StringBuilder writedstrIdOut = new StringBuilder();
- // 鑾峰彇宸蹭笅鍙戠殑鍑虹墖id
- byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 14);
- String writedstrIdOut = new String(writedglassidbytesOut);
+ spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
+ spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
+ jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
+ // 鏍规嵁鐜荤拑id鑾峰彇璁㈠崟鍙�,鍗曠嫭鏁版嵁婧�
+ // try {
+ // north_glass_buffer1 glass = jdbcConnections.selectGlass(112);
+ // // System.out.println(glass.getOrderId());
+ // } catch (SQLException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ // spianService.selectAll("X12345610402GV");
+ // 鍑虹墖浠诲姟////////////////////////////////
+ List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖杞︾姸鎬�
+ List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 鍑虹墖浠诲姟鏄惁鍚姩
+ // StringBuilder writedstrIdOut = new StringBuilder();
+ // 鑾峰彇宸蹭笅鍙戠殑鍑虹墖id
+ byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 14);
+ String writedstrIdOut = new String(writedglassidbytesOut);
- boolean outstate = false;// 鍑虹墖杞︾┖闂插垽鏂�
- boolean outstate1 = false;// 鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔�
- if (outlist != null && outlist1 != null) {
+ boolean outstate = false;// 鍑虹墖杞︾┖闂插垽鏂�
+ boolean outstate1 = false;// 鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔�
+ if (outlist != null && outlist1 != null) {
- outstate = outlist.contains((short) 0);// 鍑虹墖杞︾┖闂插垽鏂� 褰撳嚭鐗囪溅绌洪棽鏃朵负true
- outstate1 = outlist1.contains((short) 1);// 鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔� 褰撳嚭鐗囪溅浠诲姟鍚姩鏃朵负true
+ outstate = outlist.contains((short) 0);// 鍑虹墖杞︾┖闂插垽鏂� 褰撳嚭鐗囪溅绌洪棽鏃朵负true
+ outstate1 = outlist1.contains((short) 1);// 鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔� 褰撳嚭鐗囪溅浠诲姟鍚姩鏃朵负true
- // 鍒ゆ柇褰撳墠鏄惁鏈夋湭鎵ц鐨勪换鍔�
- int outnum = spianMapper.SelectOutSliceshu();
- // 褰撴病鏈変换鍔℃墽琛屽苟涓斿嚭鐗囪溅绌洪棽鏃�
- if (outnum == 0 && outstate == true && Plchome.isAllowQueue == true) {
- // 鍒ゆ柇閾濇鍑虹墖闃熷垪琛ㄦ槸鍚︽湁寰呭嚭鐗囩殑鐜荤拑
- String outglassid = spianMapper.SelectOutSlice();
- if (outglassid != null) {
+ // 鍒ゆ柇褰撳墠鏄惁鏈夋湭鎵ц鐨勪换鍔�
+ int outnum = spianMapper.SelectOutSliceshu();
+ int cageoutsum = spianMapper.Selectcageout(3);
+ // 褰撴病鏈変换鍔℃墽琛屽苟涓斿嚭鐗囪溅绌洪棽鏃�
+ if (outnum == 0 && outstate == true && Plchome.isAllowQueue == true && cageoutsum == 0) {
+ // 鍒ゆ柇閾濇鍑虹墖闃熷垪琛ㄦ槸鍚︽湁寰呭嚭鐗囩殑鐜荤拑
+ String outglassid = spianMapper.SelectOutSlice();
+ // 褰撴湁寰呭嚭鐗囩殑鐜荤拑鏃�
+ if (outglassid != null) {
+ // 鑾峰彇璇ョ幓鐠冩槸鍚﹁绂佺敤
+ int glassdisabled = spianMapper.SelectCageGlassState(outglassid);
+ //鏈鐢ㄤ笅鍙戜换鍔�
+ if (glassdisabled == 0) {
+ spianService.selectout2(outglassid);
+ Plchome.isQueueWarning = false;
+ outstate = false;
+ } else { //绂佺敤鏇存敼鐘舵�佸脊鍑烘彁绀�
+ Plchome.isQueueWarning = true;
+ }
- spianService.selectout2(outglassid);
- outstate = false;
+ }
+ }
+ if (outstate == true) {// 褰撳嚭鐗囪溅绌洪棽鏃�,涓斿嚭鐗囧惎鍔ㄤ负1鏃讹紝浠诲姟鍚姩鏀逛负0
+ if (outstate1 == true) {
+ S7control.getinstance().WriteWord("DB105.18", (short) 0);// 鍑虹墖浠诲姟鍚姩鏀逛负0
+ }
}
}
- if (outstate == true) {// 褰撳嚭鐗囪溅绌洪棽鏃�,涓斿嚭鐗囧惎鍔ㄤ负1鏃讹紝浠诲姟鍚姩鏀逛负0
- if (outstate1 == true) {
- S7control.getinstance().WriteWord("DB105.18", (short) 0);// 鍑虹墖浠诲姟鍚姩鏀逛负0
+
+ ///////////// 杩涚墖浠诲姟
+ List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 鑾峰彇prc杩涚墖璇锋眰鏁版嵁
+ List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 鑾峰彇杩涚墖杞︾姸鎬�
+ List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 鑾峰彇杩涚墖杞︿换鍔℃槸鍚﹀惎鍔�
+
+ boolean B01backs = spianService.listbool("DB106.60");// b01姹囨姤
+
+ boolean B02backs = spianService.listbool("DB106.62");// b02姹囨姤
+ StringBuilder B01glassid = spianService.queGlassid("DB103.184", 14);// BO1鐨勭幓鐠僫d
+ StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02鐨勭幓鐠僫d
+
+ // 褰撹繘鐗囧皬杞﹀畬鎴愪换鍔℃椂
+ if (B01backs == true) {
+ // 褰揃01灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬� 涓�1
+ spianService.overtask(B01glassid.toString());// 瀹屾垚浠诲姟
+ S7control.getinstance().WriteWord("DB106.60", (short) 0);// 鎭㈠B01灏忚溅搴旂瓟鏀逛负0
+ boolean yingda = spianService.listbool("DB106.60");// b01姹囨姤
+ System.out.println("姹囨姤鏃禕01|绗�" + aaa + "娆�" + B01glassid + "搴旂瓟" + yingda);
+ aaa += 1;
+ }
+
+ // 褰撳嚭鐗囧皬杞﹀畬鎴愪换鍔℃椂
+ if (B02backs == true) {
+ // 褰揃02灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬佷负0
+ spianService.overtask(B02glassid.toString());// 瀹屾垚浠诲姟
+ S7control.getinstance().WriteWord("DB106.62", (short) 0);// 鎭㈠B02灏忚溅搴旂瓟鏀逛负0
+ System.out.println("姹囨姤鏃禕02|" + B02glassid);
+ boolean yingda = spianService.listbool("DB106.62");// b02姹囨姤
+ System.out.println("姹囨姤鏃禕02|绗�" + aaa + "娆�" + B02glassid + "搴旂瓟" + yingda);
+ }
+
+ // 鑾峰彇DO1鏁版嵁
+ StringBuilder queueid1 = spianService.queGlassid("DB106.26", 14);// 鑾峰彇璇锋眰鐨刬d璺烡O1鍚屾椂娓�
+ // 鑾峰彇DO2鏁版嵁
+ StringBuilder queueid2 = spianService.queGlassid("DB103.58", 14);
+
+ int questate = spianMapper.Selectquecount(queueid1.toString());// 鍒ゆ柇鎵爜浣嶆槸鍚︽湁鐜荤拑宸茬‘璁�
+ // queueid1.toString().isEmpty()
+ north_glass_buffer1 glass1 = spianMapper.selectGlass(queueid1.toString());// D01鐨勭幓鐠冧俊鎭�
+ north_glass_buffer1 glass2 = spianMapper.selectGlass(queueid2.toString());// D02鐜荤拑淇℃伅
+ // 褰撴壂鐮佷綅鐜荤拑id涓虹┖鏃� 瀹藉害涓�0
+ if (queueid1 != null && questate == 0) {
+ // 鍐欏叆D01鐨勬暟鎹埌涓婄墖闃熷垪琛�
+ if (glass1 == null) { // 褰撴病鏈夊�兼椂浼犵┖
+ spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 1);
+ } else {
+
+ spianMapper.Updatequeue(queueid1.toString(), glass1.getordernumber(), glass1.getlistnumber(),
+ glass1.getboxnumber(), 0, glass1.getglasslengthmm().toString(), glass1.getglassheightmm().toString(),
+ glass1.getglasslength().toString(), glass1.getglassheight().toString(), 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.16", 1);// 鑾峰彇杩涚墖杞︿换鍔℃槸鍚﹀惎鍔�
+ if (queueid2 != null) {
+ // 鍐欏叆D02鐨勬暟鎹埌涓婄墖闃熷垪琛�
+ if (glass2 == null) {
+ spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 2);
+ } else {
+ spianMapper.Updatequeue(queueid2.toString(), glass2.getordernumber(), glass2.getlistnumber(),
+ glass2.getboxnumber(), 0, glass2.getglasslengthmm().toString(), glass2.getglassheightmm().toString(),
+ glass2.getglasslength().toString(), glass2.getglassheight().toString(), 2);
+ spianMapper.overqueue2(queueid2.toString(), 0, 1);// 鏇存敼鎵爜浣嶄换鍔¤〃鐨勭姸鎬佷负0
+ S7control.getinstance().WriteWord("DB105.16", (short) 0);// 鍏抽棴浠诲姟鍚姩
+ }
- boolean B01backs = spianService.listbool("DB106.60");// b01姹囨姤
-
- boolean B02backs = spianService.listbool("DB106.62");// b02姹囨姤
- StringBuilder B01glassid = spianService.queGlassid("DB103.184", 14);// BO1鐨勭幓鐠僫d
- StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02鐨勭幓鐠僫d
-
- // 褰撹繘鐗囧皬杞﹀畬鎴愪换鍔℃椂
- if (B01backs == true) {
- // 褰揃01灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬� 涓�1
- spianService.overtask(B01glassid.toString());// 瀹屾垚浠诲姟
- S7control.getinstance().WriteWord("DB106.60", (short) 0);// 鎭㈠B01灏忚溅搴旂瓟鏀逛负0
- boolean yingda = spianService.listbool("DB106.60");// b01姹囨姤
- System.out.println("姹囨姤鏃禕01|绗�"+aaa+"娆�"+ B01glassid+"搴旂瓟"+yingda);
- aaa+=1;
- }
-
- // 褰撳嚭鐗囧皬杞﹀畬鎴愪换鍔℃椂
- if (B02backs == true) {
- // 褰揃02灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬佷负0
- spianService.overtask(B02glassid.toString());// 瀹屾垚浠诲姟
- S7control.getinstance().WriteWord("DB106.62", (short) 0);// 鎭㈠B02灏忚溅搴旂瓟鏀逛负0
- System.out.println("姹囨姤鏃禕02|" + B02glassid);
- boolean yingda = spianService.listbool("DB106.62");// b02姹囨姤
- System.out.println("姹囨姤鏃禕02|绗�"+aaa+"娆�"+ B02glassid+"搴旂瓟"+yingda);
- }
-
- // 鑾峰彇DO1鏁版嵁
- StringBuilder queueid1 = spianService.queGlassid("DB106.26", 14);// 鑾峰彇璇锋眰鐨刬d璺烡O1鍚屾椂娓�
- // 鑾峰彇DO2鏁版嵁
- StringBuilder queueid2 = spianService.queGlassid("DB103.58", 14);
-
- int questate = spianMapper.Selectquecount(queueid1.toString());// 鍒ゆ柇鎵爜浣嶆槸鍚︽湁鐜荤拑宸茬‘璁�
- // queueid1.toString().isEmpty()
- north_glass_buffer1 glass1 = spianMapper.selectGlass(queueid1.toString());// D01鐨勭幓鐠冧俊鎭�
- north_glass_buffer1 glass2 = spianMapper.selectGlass(queueid2.toString());// D02鐜荤拑淇℃伅
- // 褰撴壂鐮佷綅鐜荤拑id涓虹┖鏃� 瀹藉害涓�0
- if (queueid1 != null && questate == 0) {
- // 鍐欏叆D01鐨勬暟鎹埌涓婄墖闃熷垪琛�
- if (glass1 == null) { // 褰撴病鏈夊�兼椂浼犵┖
- spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 1);
- } else {
-
- spianMapper.Updatequeue(queueid1.toString(), glass1.getordernumber(), glass1.getlistnumber(),
- glass1.getboxnumber(), 0, glass1.getglasslengthmm().toString(), glass1.getglassheightmm().toString(),
- glass1.getglasslength().toString(), glass1.getglassheight().toString(), 1);
}
- }
- if (queueid2 != null) {
- // 鍐欏叆D02鐨勬暟鎹埌涓婄墖闃熷垪琛�
- if (glass2 == null) {
- spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 2);
- } else {
- spianMapper.Updatequeue(queueid2.toString(), glass2.getordernumber(), glass2.getlistnumber(),
- glass2.getboxnumber(), 0, glass2.getglasslengthmm().toString(), glass2.getglassheightmm().toString(),
- glass2.getglasslength().toString(), glass2.getglassheight().toString(), 2);
- spianMapper.overqueue2(queueid2.toString(), 0, 1);// 鏇存敼鎵爜浣嶄换鍔¤〃鐨勭姸鎬佷负0
- S7control.getinstance().WriteWord("DB105.16", (short) 0);// 鍏抽棴浠诲姟鍚姩
- }
+ // if (outstate == true) { // 鍑虹墖杞︾姸鎬佺┖闂叉椂
+ // Integer state = spianMapper.Selectoutstate();
+ // String orderid = spianMapper.SelectOrderout();
+
+ // if (orderid != null && state == 0) {
+ // spianService.selectout(orderid);
+ // }
+ // }
+
+ // 鏌ヨ鏁版嵁搴�
+ // 鎺ㄩ�佸埌鍓嶇
}
-
-
-
- // if (outstate == true) { // 鍑虹墖杞︾姸鎬佺┖闂叉椂
- // Integer state = spianMapper.Selectoutstate();
- // String orderid = spianMapper.SelectOrderout();
-
- // if (orderid != null && state == 0) {
- // spianService.selectout(orderid);
- // }
- // }
-
- // 鏌ヨ鏁版嵁搴�
- // 鎺ㄩ�佸埌鍓嶇
-
}
}
-}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java
new file mode 100644
index 0000000..ab4ee3c
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java
@@ -0,0 +1,213 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import org.apache.commons.io.FileUtils;
+import org.apache.tomcat.jni.Lock;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.ReentrantLock;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
+
+import com.example.springboot.entity.device.PlcParameterObject;
+import com.example.springboot.entity.device.PlcParameterInfo;
+
+public class PlcParameter1Review extends Thread {
+
+ @Autowired
+ private ResourceLoader resourceLoader;
+ private volatile static PlcParameter1Review instance = null;
+
+ private PlcParameter1Review() {
+ init();
+ }
+
+ // 鍗曚緥妯″紡 绾跨▼瀹夊叏
+ public static PlcParameter1Review getInstance() {
+ if (instance == null) {
+ synchronized (PlcParameter1Review.class) {
+ if (instance == null) {
+ instance = new PlcParameter1Review();
+ }
+ }
+ }
+ return instance;
+ }
+ PlcParameterObject plcParameterObject = new PlcParameterObject();//璇B鍖烘暟鎹疄渚�
+
+ private void init() {
+ try {
+ String jsonfilename= PlcParameter1Review.class.getResource("/JsonFile/PlcParameter.json").getFile();
+ FileReader fileReader = new FileReader(jsonfilename);
+ BufferedReader bufferedReader = new BufferedReader(fileReader);
+
+ StringBuilder content = new StringBuilder();
+ String line;
+
+ while ((line = bufferedReader.readLine()) != null) {
+ content.append(line);
+ }
+
+ bufferedReader.close();
+ fileReader.close();
+
+ JSONObject jsonfileobj = new JSONObject(content.toString());
+ JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor");
+ plcParameterObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//璁剧疆璧峰浣嶅湴鍧�
+ plcParameterObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//璁剧疆鍦板潃闀垮害
+
+
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject parameterObj = jsonArray.getJSONObject(i);
+
+ PlcParameterInfo plcParameterInfo = new PlcParameterInfo(jsonfileobj.getStr("plcAddressBegin")); //鍙傛暟瀹炰緥
+ String codeid=parameterObj.getStr("codeId");
+ plcParameterInfo.setCodeId(codeid);
+ plcParameterInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex")));
+ plcParameterInfo.setRatio(Integer.valueOf(parameterObj.getStr("ratio")));
+ plcParameterInfo.setAddressLength(Integer.valueOf(parameterObj.getStr("addressLenght")));
+ plcParameterInfo.setUnit(parameterObj.getStr("unit"));
+ plcParameterObject.addPlcParameter(plcParameterInfo);
+ }
+ System.out.println("");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ byte[] getplcvlues=S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(),plcParameterObject.getPlcAddressLength());
+ plcParameterObject.setPlcParameterList(getplcvlues);
+ int index=plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddressIndex();
+ S7control.getinstance().WriteWord(plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddress(index), (short)100);
+
+ List<String> addresses = new ArrayList<>();
+ addresses.add("conveyorVelocity(AutoFAST)");
+ addresses.add("conveyorVelocity(AutoSLOW)");
+ addresses.add("conveyorVelocity(Manual)");
+ addresses.add("A01A02TURNJOGVelocity");
+ addresses.add("A01A02TRAVELJOGVelocity");
+
+ plcParameterObject.getPlcParameterValues(addresses);
+
+ JSONObject jsonObject = new JSONObject();
+
+ jsonObject.append("params", plcParameterObject.getPlcParameterValues(addresses));
+ jsonObject.append("fanzhuan", plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getValue());
+ jsonObject.append("xiaoche", plcParameterObject.getPlcParameter("").getValue());
+
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter1");
+ if (sendwServer != null) {
+ sendwServer.sendMessage(jsonObject.toString());
+ }
+
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter1");
+ if (webSocketServer != null) {
+ List<String> messages = webSocketServer.getMessages();
+ List<String> waddresses1 = new ArrayList<>();
+ waddresses1.add("DB100.0");
+ waddresses1.add("DB100.2");
+ waddresses1.add("DB100.4");
+ waddresses1.add("DB100.6");
+ waddresses1.add("DB100.26");
+ waddresses1.add("DB100.28");
+ waddresses1.add("DB100.30");
+ waddresses1.add("DB100.32");
+ waddresses1.add("DB100.34");
+ waddresses1.add("DB100.36");
+ waddresses1.add("DB100.38");
+ waddresses1.add("DB100.40");
+
+ String addressList2 = "DB100.8";
+ String addressList3 = "DB100.12";
+
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+ String lastMessage = messages.get(messages.size() - 1);
+ // System.out.println("lastMessage锛�" + lastMessage);
+ JSONArray messageArray = new JSONArray(lastMessage);
+
+ // 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
+ List<Short> mergedList = new ArrayList<>();
+ for (int i = 0; i < 3; i++) {
+ JSONArray sublist = messageArray.getJSONArray(i);
+ for (int j = 0; j < sublist.size(); j++) {
+ Object value = sublist.get(j);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short sValue = Short.parseShort(cleanedValue.trim());
+ mergedList.add(sValue);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ }
+
+ // 鍐欏叆绗竴涓湴鍧�
+ if (messageArray.getJSONArray(3).size() > 0) {
+ Object value = messageArray.getJSONArray(3).get(0);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short sValue = Short.parseShort(cleanedValue.trim());
+ S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
+ System.out
+ .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList2);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+
+ // 鍐欏叆绗簩涓湴鍧�
+ if (messageArray.getJSONArray(4).size() > 0) {
+ Object value = messageArray.getJSONArray(4).get(0);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short sValue = Short.parseShort(cleanedValue.trim());
+ S7control.getinstance().WriteWord(addressList3, Arrays.asList(sValue));
+ System.out
+ .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList3);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+
+ // 鍐欏叆绗笁涓湴鍧�
+ if (!mergedList.isEmpty()) {
+ S7control.getinstance().WriteWord(waddresses1, mergedList);
+ System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + waddresses1);
+ }
+
+ // 娓呯┖娑堟伅鍒楄〃
+ webSocketServer.clearMessages();
+ }
+
+ }
+
+ }
+ }
+}
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 2d0c98d..4de113f 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
@@ -28,7 +28,7 @@
FileInputStream fileInputStream;
try {
// 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
- fileInputStream = new FileInputStream("D:/canadames/Alarm.json");
+ fileInputStream = new FileInputStream("D:/code/canadames/Alarm.json");
// 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
// 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
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 2977c20..87e0a12 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
@@ -31,6 +31,8 @@
// 鍑虹墖闃熷垪鏄惁鍏佽鍑虹墖
public static Boolean isAllowQueue = true;
public static Boolean isAllowReordering = true;
+ //鍑虹墖闃熷垪璀﹀憡
+ public static Boolean isQueueWarning=false;
// 閾濇id
public static String FrameNo = "";
// 鏄惁闇�瑕佹墜鍔ㄧ‘璁ょ幓鐠�
@@ -104,20 +106,22 @@
jsonObject.append("listoutslice", listoutslice);
// 鑾峰彇褰撳墠鍑虹墖闃熷垪鍑虹墖鐘舵��
jsonObject.append("isAllowQueue", Plchome.isAllowQueue);
+ //鑾峰彇鍑虹墖闃熷垪璀﹀憡鐘舵��
+ jsonObject.append("isQueueWarning", Plchome.isQueueWarning);
// 鑾峰彇褰撳墠鍑虹墖闃熷垪璋冨簭鐘舵��
jsonObject.append("isAllowReordering", Plchome.isAllowReordering);
// 鏄惁闇�瑕佷汉宸ョ‘璁や笂鐗囩幓鐠�
jsonObject.append("isConfirm", isConfirm);
- String framenos="X21763329601FB";
- if (!framenos.equals(Plchome.FrameNo)) {
- Plchome.FrameNo = framenos;
- try {
- north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+ // String framenos="X21763329601FB";
+ // if (!framenos.equals(Plchome.FrameNo)) {
+ // Plchome.FrameNo = framenos;
+ // try {
+ // north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
+ // } catch (SQLException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ // }
if (S7control.getinstance().CheckConnected() == true) {
// 璇诲幓Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃甒
List<String> addressList = new ArrayList<String>();
@@ -147,7 +151,7 @@
// 鑾峰彇閾濇idDB106.DBW64锛屾坊鍔犲埌鍑虹墖闃熷垪
String frameno = spianService.queGlassid("DB103.270", 14).toString();
// String frameno="X12345611002GV";
- frameno="X21763329601FB";
+ // frameno="X21763329601FB";
if (!frameno.equals(Plchome.FrameNo)) {
Plchome.FrameNo = frameno;
try {
@@ -180,36 +184,38 @@
// 鏄惁鎬ュ仠
List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
for (Boolean emergencystop : emergencystops) {
- jsonObject.append("emergencystop", emergencystop);
+ jsonObject.
+ append("emergencystop", emergencystop);
}
+
- // 缁堟缁х画鎸夐挳
- List<String> niuanaddressList3 = Arrays.asList(config.getProperty("Parameter2.stop").split(","));
- List<Boolean> anniuread = S7control.getinstance().readBits(niuanaddressList3);
- // Boolean[] value4 = { false, false};
- // List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
- Boolean[] value5 = { true };
- List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
- short[] anniuparams = new short[anniuread.size()];
- for (int i = 0; i < anniuread.size(); i++) {
- boolean value = anniuread.get(i);
- anniuparams[i] = value ? (short) 1 : (short) 0;
- }
+ // // 缁堟缁х画鎸夐挳
+ // List<String> niuanaddressList3 = Arrays.asList(config.getProperty("Parameter2.stop").split(","));
+ // List<Boolean> anniuread = S7control.getinstance().readBits(niuanaddressList3);
+ // // Boolean[] value4 = { false, false};
+ // // List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
+ // Boolean[] value5 = { true };
+ // List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
+ // short[] anniuparams = new short[anniuread.size()];
+ // for (int i = 0; i < anniuread.size(); i++) {
+ // boolean value = anniuread.get(i);
+ // anniuparams[i] = value ? (short) 1 : (short) 0;
+ // }
- short[] resets2 = new short[resets.size()];
- for (int i = 0; i < resets.size(); i++) {
- boolean value = resets.get(i);
- resets2[i] = value ? (short) 1 : (short) 0;
- }
+ // short[] resets2 = new short[resets.size()];
+ // for (int i = 0; i < resets.size(); i++) {
+ // boolean value = resets.get(i);
+ // resets2[i] = value ? (short) 1 : (short) 0;
+ // }
- for (short number : resets2) {
+ // for (short number : resets2) {
- if (number == 1) {
- jsonObject.append("Abort", anniuparams);
+ // if (number == 1) {
+ // jsonObject.append("Abort", anniuparams);
- }
+ // }
- }
+ // }
}
// 閾濇绾夸氦浜�
@@ -257,11 +263,11 @@
List<String> messages = webserver.getMessages();
if (!messages.isEmpty()) {
- // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
// String lastMessage = messages.get(messages.size() - 1);
// System.out.println("lastMessage锛�" + lastMessage);
// JSONArray messageArray = new JSONArray(lastMessage);
- //
+
// try {
// // 妫�鏌ョ储寮曟槸鍚︽湁鏁�
// if (messageArray.getJSONArray(0).size() > 0) {
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcsignReview.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcsignReview.java
new file mode 100644
index 0000000..ef6af2d
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcsignReview.java
@@ -0,0 +1,124 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.example.springboot.entity.device.PlcBitObject;
+import com.example.springboot.entity.device.PlcBitInfo;
+
+public class PlcsignReview extends Thread {
+ String name = "";
+ Integer count = 0;
+ private volatile static PlcsignReview instance = null;
+
+ private PlcsignReview() {
+ init();
+ }
+
+ // 鍗曚緥妯″紡 绾跨▼瀹夊叏
+ public static PlcsignReview getInstance() {
+ if (instance == null) {
+ synchronized (PlcsignReview.class) {
+ if (instance == null) {
+ instance = new PlcsignReview();
+ }
+ }
+ }
+ return instance;
+ }
+ PlcBitObject plcBitObject = new PlcBitObject();//璇B鍖烘暟鎹疄渚�
+
+ private void init() {
+ try {
+ String jsonfilename= PlcsignReview.class.getResource("/JsonFile/PlcSign.json").getFile();
+ FileReader fileReader = new FileReader(jsonfilename);
+ BufferedReader bufferedReader = new BufferedReader(fileReader);
+
+ StringBuilder content = new StringBuilder();
+ String line;
+
+ while ((line = bufferedReader.readLine()) != null) {
+ content.append(line);
+ }
+
+ bufferedReader.close();
+ fileReader.close();
+
+ JSONObject jsonfileobj = new JSONObject(content.toString());
+ JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor");
+ plcBitObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//璁剧疆璧峰浣嶅湴鍧�
+ plcBitObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//璁剧疆鍦板潃闀垮害
+
+
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject parameterObj = jsonArray.getJSONObject(i);
+
+ PlcBitInfo plcBitInfo = new PlcBitInfo(jsonfileobj.getStr("plcAddressBegin")); //鍙傛暟瀹炰緥
+ String codeid=parameterObj.getStr("codeId");
+ plcBitInfo.setCodeId(codeid);
+ plcBitInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex")));
+
+ plcBitObject.addPlcBit(plcBitInfo);
+ }
+ System.out.println("");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ List<Boolean> getplcbits=S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(),plcBitObject.getPlcAddressLength());
+ plcBitObject.setPlcBitList(getplcbits);
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
+ // System.out.println(PlcAddress);
+
+// List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount);
+ List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.0.0", 64);
+
+// Boolean[] values = { true, true, true, true, 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, null,
+// true, false,
+// true, false, true, false, true, false,
+// true, false, true, false, true, };
+// List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
+
+ if (plclist != null) {
+ // 灏嗚幏鍙栫殑甯冨皵绫诲瀷杞崲涓烘暣鏁扮被鍨�
+ List<Integer> Intlist = new ArrayList<>();
+ for (Boolean value : plclist) {
+ if (value != null) {
+ Intlist.add(value == true ? 0 : 1);
+ }
+
+ }
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.append("sig", Intlist);
+ WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign");
+ if (sendwServer3 != null) {
+ sendwServer3.sendMessage(jsonObject.toString());
+ }
+
+ }
+ }
+ }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
index 834badb..d64b920 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -17,25 +17,25 @@
//
System.out.println("鍚姩瀹屾垚");
- // new PlcHold().start();
+ new PlcHold().start();
new Plchome().start();
- // new Plcalarm().start();
+ new Plcalarm().start();
- // new Plcsign().start();
+ new Plcsign().start();
- // new Plcstate().start();
- // new PlcPositioning1().start();
+ new Plcstate().start();
+ new PlcPositioning1().start();
- // new PlcParameter2().start();
+ new PlcParameter2().start();
- // new PLCAutomaticParameterSetting().start();
+ new PLCAutomaticParameterSetting().start();
- // new PlcManualonePosition().start();
- // new PlcManualonePosition2().start();
- // new PlcServoManualone().start();
- // new PLCManualJog().start();
- // new Plclog().start();
+ new PlcManualonePosition().start();
+ new PlcManualonePosition2().start();
+ new PlcServoManualone().start();
+ new PLCManualJog().start();
+ new Plclog().start();
}
}
\ No newline at end of file
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 6c6958d..3884738 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
@@ -391,4 +391,11 @@
return outSliceServive.CompleteQueue(id, frameid, glassid);
}
+ // 鎵嬪姩瀹屾垚浠诲姟
+ @PostMapping("/FrameStateUpdate")
+ public Result FrameStateUpdate(String frameno, String framestate) {
+ return outSliceServive.FrameStateUpdate(frameno, framestate);
+ }
+
+
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/Out_slice.java b/springboot-vue3/src/main/java/com/example/springboot/entity/Out_slice.java
index 51c5233..4195abe 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/entity/Out_slice.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/Out_slice.java
@@ -16,6 +16,8 @@
private String boxId;//绠卞瓙id
private double glasswidthmm;//鐜荤拑瀹絤m
private double glassheightmm;//鐜荤拑楂榤m
+ private String position_x;//x鍧愭爣
+ private int framestate;//y鍧愭爣
public String getPosition() {
return position;
@@ -168,4 +170,12 @@
public void setBoxno(String boxId) {
this.boxId = boxId;
}
+
+ public int getFrameState() {
+ return framestate;
+ }
+
+ public void SetFrameState(int framestate) {
+ this.framestate = framestate;
+ }
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitInfo.java b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitInfo.java
new file mode 100644
index 0000000..e3cf8d1
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitInfo.java
@@ -0,0 +1,74 @@
+package com.example.springboot.entity.device;
+
+import com.example.springboot.component.S7control;
+
+public class PlcBitInfo {
+
+ public PlcBitInfo(String startAddress) {
+ this.startAddress = startAddress;
+ }
+ private String startAddress;
+ // 鍙傛暟鏍囪瘑
+ private String codeId;
+
+ // 鍙傛暟鍚嶇О
+ private String name;
+
+ // 璇诲彇 鍙傛暟鍊�
+ private Boolean value;
+ // 鍙傛暟鍦板潃
+ private int addressIndex;
+
+ public String getCodeId() {
+ return this.codeId;
+ }
+
+ public void setCodeId(String codeId) {
+ this.codeId = codeId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Boolean getValue() {
+ return this.value;
+ }
+
+ public void setValue(Boolean value) {
+ this.value = value;
+ }
+
+
+ public int getAddressIndex() {
+ return this.addressIndex;
+ }
+ /**
+ * 鑾峰彇鍦板潃
+ *
+ * @param index 绱㈠紩鍦板潃
+ */
+ public String getAddress(int index) {
+ String[] stringdatas = this.startAddress.trim().split("\\.");
+ if (stringdatas.length < 2 )
+ return null;
+ int dbwindex = 0;
+ int bitindex = 0;
+ if (stringdatas.length == 3) {
+ dbwindex = Integer.parseInt(stringdatas[1]);
+ bitindex = Integer.parseInt(stringdatas[2]);
+ } else
+ return null;
+ dbwindex+=index/8;
+ bitindex+=index%8;
+ return stringdatas[0]+"."+dbwindex+"."+bitindex;
+ }
+
+ public void setAddressIndex(int addressindex) {
+ this.addressIndex = addressindex;
+ }
+ }
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitObject.java b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitObject.java
new file mode 100644
index 0000000..643664b
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitObject.java
@@ -0,0 +1,113 @@
+package com.example.springboot.entity.device;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlcBitObject {
+
+ // 璇ユā鍧楁暟鎹被鍨嬶紝鏁版嵁璧峰浣嶇疆
+ private String plcAddressBegin;
+ // 鏁版嵁鍦板潃闀垮害锛氱涓�鍙傛暟鍒版渶鍚庝竴涓弬鏁扮殑闀垮害
+ private int plcAddressLength;
+ private ArrayList<PlcBitInfo> plcBitList;
+
+ /**
+ * @return 鏁版嵁鍖哄紑濮嬪湴鍧�
+ */
+ public String getPlcAddressBegin() {
+ return plcAddressBegin;
+ }
+
+ /**
+ * @param plcAddressBegin 璁剧疆鏁版嵁鍖哄紑濮嬪湴鍧�
+ */
+ public void setPlcAddressBegin(String plcAddressBegin) {
+ this.plcAddressBegin = plcAddressBegin;
+ }
+
+ /**
+ * @return 鏁版嵁鍖� 璇诲彇鎵�鏈夋暟鎹墍闇�鐨勯暱搴︼紙浠yte绫诲瀷涓哄熀鍑嗭級
+ */
+ public int getPlcAddressLength() {
+ return plcAddressLength;
+ }
+
+ /**
+ * @return 璁剧疆锛氭暟鎹尯 璇诲彇鎵�鏈夋暟鎹墍闇�鐨勯暱搴︼紙浠yte绫诲瀷涓哄熀鍑嗭級
+ */
+ public void setPlcAddressLength(int plcAddressLength) {
+ this.plcAddressLength = plcAddressLength;
+ }
+
+ /**
+ * @return 鑾峰彇鍙傛暟瀹炰緥闆嗗悎
+ */
+ public ArrayList<PlcBitInfo> getBitList() {
+ return plcBitList;
+ }
+
+ /**
+ * 鏍规嵁鍙傛暟鏍囪瘑 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
+ *
+ * @param codeid 鍙傛暟鏍囪瘑
+ * @return 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
+ */
+ public PlcBitInfo getPlcBit(String codeid) {
+ if (plcBitList != null) {
+ for (PlcBitInfo plcbitInfo : plcBitList) {
+ if (plcbitInfo.getCodeId().equals(codeid))
+ return plcbitInfo;
+ }
+ return null;
+ } else
+ return null;
+ }
+
+ /**
+ * 鏍规嵁鍙傛暟鏍囪瘑 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
+ *
+ * @param codeid 鍙傛暟鏍囪瘑
+ * @return 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
+ */
+ public List<Boolean> getPlcBitValues(List<String> codeids) {
+ List<Boolean> arrayList = new ArrayList();
+ if (plcBitList != null) {
+ for (PlcBitInfo plcbitInfo : plcBitList) {
+ if (codeids.contains(plcbitInfo.getCodeId().toString()))
+ arrayList.add(plcbitInfo.getValue());
+ }
+ }
+ return arrayList;
+ }
+
+ /**
+ * 娣诲姞鍙傛暟瀹炰緥
+ *
+ * @param param 鍙傛暟瀹炰緥
+ */
+ public void addPlcBit(PlcBitInfo param) {
+ if (plcBitList != null)
+ plcBitList.add(param);
+ else {
+ plcBitList = new ArrayList<PlcBitInfo>();
+ plcBitList.add(param);
+ }
+ }
+
+ /**
+ * 鏍规嵁PLC杩斿洖鐨勬暟鎹� 缁欏弬鏁板疄渚嬭祴鍊�
+ *
+ * @param plcValueArray PLC璇诲彇鍥炴潵鐨刡yte绫诲瀷鏁版嵁闆嗗悎
+ */
+ public void setPlcBitList(List<Boolean> plcValueArray) {
+ if (plcBitList != null) {
+ for (PlcBitInfo plcbitInfo : plcBitList) {
+ plcbitInfo.setValue(plcValueArray.get(plcbitInfo.getAddressIndex()));
+ }
+ }
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterInfo.java b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterInfo.java
new file mode 100644
index 0000000..ff39eba
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterInfo.java
@@ -0,0 +1,112 @@
+package com.example.springboot.entity.device;
+public class PlcParameterInfo {
+ public PlcParameterInfo(String startAddress) {
+ this.startAddress = startAddress;
+ }
+ private String startAddress;
+ // 鍙傛暟鏍囪瘑
+ private String codeId;
+
+ // 鍙傛暟鍚嶇О
+ private String name;
+
+ // 璇诲彇 鍙傛暟鍊�
+ private String value;
+
+ // // 鍐欏叆 鍙傛暟鍊�
+ // private String writeValue;
+
+ // 鍙傛暟鍗曚綅
+ private String unit;
+
+ // 鍙傛暟鍊艰浆鎹㈢郴鏁�
+ private int ratio;
+
+ // 鍙傛暟鍦板潃
+ private int addressIndex;
+
+ // 鍙傛暟鍦板潃浣嶉暱搴�
+ private int addressLength;
+
+ public String getCodeId() {
+ return this.codeId;
+ }
+
+ public void setCodeId(String codeId) {
+ this.codeId = codeId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ // public String getWriteValue() {
+ // return this.writeValue;
+ // }
+
+ // public void setWriteValue(String writeValue) {
+ // this.writeValue = writeValue;
+ // }
+
+ public String getUnit() {
+ return this.unit;
+ }
+
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
+
+ public int getAddressIndex() {
+ return this.addressIndex;
+ }
+
+ public void setAddressIndex(int addressindex) {
+ this.addressIndex = addressindex;
+ }
+
+ public int getAddressLength() {
+ return this.addressLength;
+ }
+
+ public void setAddressLength(int addresslength) {
+ this.addressLength = addresslength;
+ }
+
+ public int getRatio() {
+ return this.ratio;
+ }
+
+ public void setRatio(int ratio) {
+ this.ratio = ratio;
+ }
+
+ /**
+ * 鑾峰彇鍦板潃
+ *
+ * @param index 绱㈠紩鍦板潃
+ */
+ public String getAddress(int index) {
+ String[] stringdatas = this.startAddress.trim().split("\\.");
+ if (stringdatas.length < 2 )
+ return null;
+ int dbwindex = 0;
+ int bitindex = 0;
+ if (stringdatas.length == 2) {
+ dbwindex = Integer.parseInt(stringdatas[1]);
+ } else
+ return null;
+ return stringdatas[0]+"."+dbwindex+bitindex;
+ }
+ }
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java
new file mode 100644
index 0000000..163c45e
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java
@@ -0,0 +1,149 @@
+package com.example.springboot.entity.device;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlcParameterObject {
+
+ // 璇ユā鍧楁暟鎹被鍨嬶紝鏁版嵁璧峰浣嶇疆
+ private String plcAddressBegin;
+ // 鏁版嵁鍦板潃闀垮害锛氱涓�鍙傛暟鍒版渶鍚庝竴涓弬鏁扮殑闀垮害
+ private int plcAddressLength;
+ private ArrayList<PlcParameterInfo> plcParameterList;
+
+ /**
+ * @return 鏁版嵁鍖哄紑濮嬪湴鍧�
+ */
+ public String getPlcAddressBegin() {
+ return plcAddressBegin;
+ }
+
+ /**
+ * @param plcAddressBegin 璁剧疆鏁版嵁鍖哄紑濮嬪湴鍧�
+ */
+ public void setPlcAddressBegin(String plcAddressBegin) {
+ this.plcAddressBegin = plcAddressBegin;
+ }
+
+ /**
+ * @return 鏁版嵁鍖� 璇诲彇鎵�鏈夋暟鎹墍闇�鐨勯暱搴︼紙浠yte绫诲瀷涓哄熀鍑嗭級
+ */
+ public int getPlcAddressLength() {
+ return plcAddressLength;
+ }
+
+ /**
+ * @return 璁剧疆锛氭暟鎹尯 璇诲彇鎵�鏈夋暟鎹墍闇�鐨勯暱搴︼紙浠yte绫诲瀷涓哄熀鍑嗭級
+ */
+ public void setPlcAddressLength(int plcAddressLength) {
+ this.plcAddressLength = plcAddressLength;
+ }
+
+ /**
+ * @return 鑾峰彇鍙傛暟瀹炰緥闆嗗悎
+ */
+ public ArrayList<PlcParameterInfo> getPlcParameterList() {
+ return plcParameterList;
+ }
+
+ /**
+ * 鏍规嵁鍙傛暟鏍囪瘑 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
+ *
+ * @param codeid 鍙傛暟鏍囪瘑
+ * @return 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
+ */
+ public PlcParameterInfo getPlcParameter(String codeid) {
+ if (plcParameterList != null) {
+ for (PlcParameterInfo plcParameterInfo : plcParameterList) {
+ if (plcParameterInfo.getCodeId().equals(codeid))
+ return plcParameterInfo;
+ }
+ return null;
+ } else
+ return null;
+ }
+
+ /**
+ * 鏍规嵁鍙傛暟鏍囪瘑 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
+ *
+ * @param codeid 鍙傛暟鏍囪瘑
+ * @return 鑾峰彇鏌愪釜鍙傛暟瀹炰緥
+ */
+ public List<String> getPlcParameterValues(List<String> codeids) {
+ List<String> arrayList = new ArrayList();
+ if (plcParameterList != null) {
+ for (PlcParameterInfo plcParameterInfo : plcParameterList) {
+ if (codeids.contains(plcParameterInfo.getCodeId().toString()))
+ arrayList.add(plcParameterInfo.getValue());
+ }
+ }
+ return arrayList;
+ }
+
+ /**
+ * 娣诲姞鍙傛暟瀹炰緥
+ *
+ * @param param 鍙傛暟瀹炰緥
+ */
+ public void addPlcParameter(PlcParameterInfo param) {
+ if (plcParameterList != null)
+ plcParameterList.add(param);
+ else {
+ plcParameterList = new ArrayList<PlcParameterInfo>();
+ plcParameterList.add(param);
+ }
+ }
+
+ /**
+ * 鏍规嵁PLC杩斿洖鐨勬暟鎹� 缁欏弬鏁板疄渚嬭祴鍊�
+ *
+ * @param plcValueArray PLC璇诲彇鍥炴潵鐨刡yte绫诲瀷鏁版嵁闆嗗悎
+ */
+ public void setPlcParameterList(byte[] plcValueArray) {
+ if (plcParameterList != null) {
+ for (PlcParameterInfo plcParameterInfo : plcParameterList) {
+ byte[] valueList = new byte[plcParameterInfo.getAddressLength()];
+ for (int i = 0; i < plcParameterInfo.getAddressLength(); i++) {
+ Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]);
+ }
+ if (plcParameterInfo.getAddressLength()==2) {
+ plcParameterInfo.setValue(String.valueOf(byte2short(valueList)));
+ }
+ else
+ {
+ String valuestr = new String(valueList);
+ plcParameterInfo.setValue(valuestr);
+ }
+ }
+ }
+ }
+ /**
+ * short绫诲瀷杞琤yte[]
+ *
+ * @param s short绫诲瀷鍊�
+ */
+ public static byte[] short2byte(short s){
+ byte[] b = new byte[2];
+ for(int i = 0; i < 2; i++){
+ int offset = 16 - (i+1)*8; //鍥犱负byte鍗�4涓瓧鑺傦紝鎵�浠ヨ璁$畻鍋忕Щ閲�
+ b[i] = (byte)((s >> offset)&0xff); //鎶�16浣嶅垎涓�2涓�8浣嶈繘琛屽垎鍒瓨鍌�
+ }
+ return b;
+ }
+ /**
+ * byte[]绫诲瀷杞瑂hort
+ *
+ * @param b byte[]绫诲瀷鍊�
+ */
+ public static short byte2short(byte[] b){
+ short l = 0;
+ for (int i = 0; i < 2; i++) {
+ l<<=8; //<<=鍜屾垜浠殑 +=鏄竴鏍风殑锛屾剰鎬濆氨鏄� l = l << 8
+ l |= (b[i] & 0xff); //鍜屼笂闈篃鏄竴鏍风殑 l = l | (b[i]&0xff)
+ }
+ return l;
+ }
+
+
+}
\ No newline at end of file
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 37045fe..13fbf9e 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
@@ -156,7 +156,7 @@
List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode);
- //鏌ヨ鐜荤拑鏄惁宸插瓨鍦ㄤ簬鍑虹墖闃熷垪
+ //鏍规嵁鐜荤拑id鏌ヨ鍑虹墖闃熷垪淇℃伅
@Select("select * from out_slice where glassid=#{getbarcode}")
Out_slice SelectQueueByglassid(String getbarcode);
@@ -174,9 +174,14 @@
//鏌ヨ鐢ㄦ埛鏉冮檺
@Select("select rp.* from role_permission rp inner join user r on rp.role_id=r.role_id and r.username=#{username} and (permission_id=32 or permission_id=33 or permission_id=34 or permission_id=35)")
List<RolePermission> SelectPermissionByUserName(String username);
- //瀹屾垚鍑虹墖浠诲姟
+
+ //鏍规嵁鐜荤拑瀹屾垚鍑虹墖浠诲姟
@Update("update out_slice set state=4 where id=#{id}")
void CompleteQueue(String id);
+
+ //鏍规嵁鐜荤拑瀹屾垚鍑虹墖浠诲姟
+ @Update("update out_slice set state=4 where id=#{id}")
+ void CompleteQueueByGlassId(String glassid);
//鏌ヨ閾濇id瀵瑰簲鐜荤拑瀹屾垚鏁伴噺
@Select("select count(*) from out_slice where barcode=#{frameid} and state!=4")
@@ -198,4 +203,8 @@
@Select("select * from storage_task where task_state=0 and task_type=#{task_type}")
List<StorageTask> SelectTaskByState(int task_type);
+ //淇敼鍑虹墖闃熷垪閾濇鐘舵��
+ @Select("update out_slice set framestate=#{framestate} where barcode=#{frameno}")
+ void FrameStateUpdate(String frameno, String framestate);
+
}
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 55e5cf8..93c9fe4 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
@@ -94,7 +94,7 @@
void UpdataOutCage1(double width, int cage, int cell);
// 璋冩嫧鏇存崲绗煎瓙淇℃伅
- @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=#{tier})as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid where a.id=#{id1}")
+ @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=#{tier})as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid,a.FrameBarcode=b.FrameBarcode where a.id=#{id1}")
void UpdateDBCage(int id1, int cage, int cell, int tier);
// @Insert("insert into user(name, date, address, user_no) values (#{name},
@@ -117,11 +117,11 @@
String SelectOrderout();
// 鍐呭鐗囪皟鎹�
- @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=1)as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid where a.cage=#{cage} and a.cell=#{cell} and a.tier=2")
+ @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=1)as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid,a.FrameBarcode=b.FrameBarcode where a.cage=#{cage} and a.cell=#{cell} and a.tier=2")
void UpdateDBCage1(int cage, int cell);
// 娓呴櫎鍐呯墖鏁版嵁
- @Update("update storage_cage a set glass_id='',order_id='',state=0,glasswidth=0,glassheight=0,glasswidthmm=0,glassheightmm=0,listid=null,boxid=null where a.cage=#{cage} and a.cell=#{cell} and a.tier=1;")
+ @Update("update storage_cage a set glass_id=null,order_id=null,state=0,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,listid=null,boxid=null,FrameBarcode=null where a.cage=#{cage} and a.cell=#{cell} and a.tier=1;")
void UpdateDBCage2(int cage, int cell);
// 鍒ゆ柇鏄惁鏈夎皟鎷ㄥ畬鍚庡嚭鐗囩殑浠诲姟
@@ -190,12 +190,15 @@
int Selectqueuestate();
// 鍒ゆ柇閾濇鍑虹墖琛ㄦ槸鍚︽湁鐜荤拑闇�瑕佸嚭
- @Select("SELECT glassid FROM `out_slice` where state=0 order by sequence,id limit 1;")
+ @Select("SELECT glassid FROM `out_slice` where state=0 and framestate!=1 order by sequence,id limit 1;")
String SelectOutSlice();
// 鍒ゆ柇閾濇鍑虹墖琛ㄦ槸鍚︽湁鐜荤拑姝e湪鍑虹墖涓�
@Select("SELECT count(*) FROM `out_slice` where state=1;")
int SelectOutSliceshu();
+ //鍒ゆ柇鏄惁鏈夎皟鎷ㄤ换鍔℃湭瀹屾垚
+ @Select("SELECT count(*) FROM `storage_cage` where state=#{state};")
+ int Selectcageout(int state);
// 鏇存柊鍑虹墖闃熷垪鐨勪换鍔$姸鎬�
@Update("update out_slice set state=#{state} where glassid=#{glassid} and state=#{state2}")
@@ -222,4 +225,7 @@
//鑾峰彇璇ュ崐鍖烘槸鍚︽湁鎵ц鐨勪换鍔�
@Select(" select count(*) from storage_cage where state=#{state} and cage>#{cage1} and cage<#{cage2}")
int SelectCageTask(int state,int cage1,int cage2);
+ //鍒ゆ柇鐜荤拑鏄惁绂佺敤
+ @Select(" select disabled from storage_cage where glass_id=#{glassid} limit 1;")
+ int SelectCageGlassState(String glassid);
}
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/North_Glass_Buffer1Service.java b/springboot-vue3/src/main/java/com/example/springboot/service/North_Glass_Buffer1Service.java
index bcd8410..364e0cc 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/North_Glass_Buffer1Service.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/North_Glass_Buffer1Service.java
@@ -26,15 +26,15 @@
public int compare(north_glass_buffer1 n1, north_glass_buffer1 n2) {//瀵规煡璇㈠埌鐨勯摑妗嗗搴旂殑鐜荤拑鏁版嵁杩涜鎺掑簭锛屽皢绂诲嚭鐗囦綅缃繎鐨勶紝闈犺繎绗煎瓙鍑虹墖渚х殑鐜荤拑鎺掑湪鍓嶉潰
if (n1.getstorageCage() != null) {
if (n2.getstorageCage() != null) {
- int cageComparison = n2.getstorageCage().getCage().compareTo(n1.getstorageCage().getCage());
+ int cageComparison = n2.getstorageCage().getCage().compareTo(n1.getstorageCage().getCage());//闈犲嚭鐗囧彛杩戠殑绗煎瓙浼樺厛
if (cageComparison != 0) {
return cageComparison;
} else {
- int cellComparison = n2.getstorageCage().getCell().compareTo(n1.getstorageCage().getCell());
+ int cellComparison = n2.getstorageCage().getCell().compareTo(n1.getstorageCage().getCell());//闈犲嚭鐗囧彛杩戠殑鏍煎瓙浼樺厛
if (cellComparison != 0) {
return cellComparison;
} else {
- return n2.getstorageCage().getTier().compareTo(n1.getstorageCage().getTier());
+ return n2.getstorageCage().getTier().compareTo(n1.getstorageCage().getTier());//闈犲嚭鐗囧彛杩戠殑鏍煎瓙澶栧眰浼樺厛
}
}
} else {
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java b/springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java
index 256c2e9..a6d32b8 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java
@@ -66,6 +66,16 @@
return Result.success(map);
}
+ // 纭鍚庡畬鎴愪慨鏀瑰嚭鐗囬槦鍒楃姸鎬�
+ public void CompleteQueueByGlassId(String glassid) {
+ homeMapper.CompleteQueueByGlassId(glassid);
+ Out_slice outslice=homeMapper.SelectQueueByglassid(glassid);
+ Short num = homeMapper.SelectCountByFrameNo(outslice.getBarCode());
+ if (num == 0) {
+ homeMapper.CompleteQueueByFrameNo(outslice.getBarCode());
+ }
+ }
+
//缁堟杩涚墖/鍑虹墖
public void StopTask(String glassid, int i) {
if (i == 0) {// 杩涚墖缁堟
@@ -88,4 +98,11 @@
homeMapper.DeleteByGlassID(glassid);
}
+public Result FrameStateUpdate(String frameno, String framestate) {
+ homeMapper.FrameStateUpdate(frameno, framestate);
+ Map<String, Object> map = new HashMap<>();
+ map.put("message", "200");
+ return Result.success(map);
+}
+
}
diff --git a/springboot-vue3/src/main/resources/JsonFile/PlcParameter.json b/springboot-vue3/src/main/resources/JsonFile/PlcParameter.json
new file mode 100644
index 0000000..1a63c24
--- /dev/null
+++ b/springboot-vue3/src/main/resources/JsonFile/PlcParameter.json
@@ -0,0 +1,77 @@
+{
+ "plcAddressBegin":"DB100.0",
+ "plcAddressLenght":"86",
+ "dataType":"word",
+ "parameteInfor":[
+ {
+ "codeId": "conveyorVelocity(Max)",
+ "addressIndex":"0",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "conveyorVelocity(AutoSLOW)",
+ "addressIndex":"6",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "conveyorVelocity(Manual)",
+ "addressIndex":"4",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A01A02TURNJOGVelocity",
+ "addressIndex":"6",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A01A02TRAVELJOGVelocity",
+ "addressIndex":"8",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B01B02TRAVELJOGVelocity",
+ "addressIndex":"10",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A01A02TURNPOSVelocityAUTO",
+ "addressIndex":"12",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A01A02TURNPOSVelocitymanual",
+ "addressIndex":"14",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A01A02TRAVELPOSVelocityAUTO",
+ "addressIndex":"16",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "DO1id",
+ "addressIndex":"18",
+ "addressLenght":"14",
+ "ratio":"1",
+ "unit":"m/min"
+ }
+ ]
+}
diff --git a/springboot-vue3/src/main/resources/JsonFile/PlcSign.json b/springboot-vue3/src/main/resources/JsonFile/PlcSign.json
new file mode 100644
index 0000000..6a40941
--- /dev/null
+++ b/springboot-vue3/src/main/resources/JsonFile/PlcSign.json
@@ -0,0 +1,47 @@
+{
+ "plcAddressBegin":"DB100.0.0",
+ "plcAddressLenght":"20",
+ "dataType":"bit",
+ "parameteInfor":[
+ {
+ "codeId": "D01.SRdec",
+ "addressIndex":"0"
+ },
+ {
+ "codeId": "conveyorVelocity(AutoSLOW)",
+ "addressIndex":"1"
+ },
+ {
+ "codeId": "conveyorVelocity(Manual)",
+ "addressIndex":"2"
+ },
+ {
+ "codeId": "A01A02TURNJOGVelocity",
+ "addressIndex":"3"
+ },
+ {
+ "codeId": "A01A02TRAVELJOGVelocity",
+ "addressIndex":"4"
+ },
+ {
+ "codeId": "B01B02TRAVELJOGVelocity",
+ "addressIndex":"5"
+ },
+ {
+ "codeId": "A01A02TURNPOSVelocityAUTO",
+ "addressIndex":"12"
+ },
+ {
+ "codeId": "A01A02TURNPOSVelocitymanual",
+ "addressIndex":"14"
+ },
+ {
+ "codeId": "A01A02TRAVELPOSVelocityAUTO",
+ "addressIndex":"16"
+ },
+ {
+ "codeId": "DO1id",
+ "addressIndex":"18"
+ }
+ ]
+}
--
Gitblit v1.8.0