From 627d77af3fcc77d012160c916349adc2340a846f Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期一, 06 五月 2024 08:21:26 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
CanadaMes-ui/src/views/home/index.vue | 230 +++-
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java | 428 ++++----
springboot-vue3/src/main/java/com/example/springboot/component/PlchomeNew.java | 3
springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java | 95 +-
springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java | 75 +
springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java | 52
springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java | 16
springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java | 85
springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java | 428 ++++-----
springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java | 1
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java | 74
springboot-vue3/src/main/java/com/example/springboot/component/PlcInteractionState.java | 145 +-
springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java | 62
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java | 220 ++--
springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java | 10
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java | 85 +
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java | 15
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java | 13
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java | 161 ++-
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java | 7
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java | 15
/dev/null | 321 -------
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java | 36
springboot-vue3/src/main/java/com/example/springboot/component/Plclog.java | 11
springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java | 11
25 files changed, 1,214 insertions(+), 1,385 deletions(-)
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 2de9353..49b6c9e 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -249,7 +249,7 @@
</label>
</div>
</div>
- <div style="display:flex;justify-content: space-around;width: 9zz5%;margin: 0 auto;">
+ <div style="display:flex;justify-content: space-around;width: 95%;margin: 0 auto;">
<!-- <el-input style="width:15%;" :placeholder="$t('Enter the glass barcode')" v-model="glassid1"
:class="ManuallyInfeedGlass == true ? 'hide' : ''"></el-input> -->
<el-button type="primary" @click="SelectGlassByGlassIDs()" :disabled="ManuallyInfeedGlass"
@@ -258,13 +258,17 @@
<el-button type="primary" @click="showform2()" :disabled="OrderInfo"
:class="OrderInfo == true ? 'hide' : ''">{{ $t('Order Info')
}}</el-button>
+ <el-button type="primary" @click="showcageinfo(1)" :disabled="OrderInfo"
+ :class="CageDetails == true ? 'hide' : ''">{{ $t('Cage Details')
+ }}</el-button>
<el-button type="primary" @click="showform6()" :disabled="OutingQueue"
:class="OutingQueue == true ? 'hide' : ''">
{{ $t('Outing Queue') }}</el-button>
<el-button type="primary" @click="TaskStop(0)" :disabled="OutingQueue"
:class="StopTask == true ? 'hide' : ''">
{{ $t('Terminate Feeding') }}</el-button>
- <el-button type="primary" @click="TaskStop(1)" :disabled="StopTask" :class="StopTask == true ? 'hide' : ''">
+ <el-button type="primary" @click="TaskStop(1)" :disabled="StopTask"
+ :class="StopTask == true ? 'hide' : ''">
{{ $t('Terminate Outing') }}</el-button>
<el-button type="primary" @click="SoftEmergencyStop()" :disabled="SoftEmergencyStopState"
:class="SoftEmergencyStopState == true ? 'hide' : ''">
@@ -274,9 +278,14 @@
</div>
<div>
<el-table :data="this.tasklist1" border style="width: 100%">
- <el-table-column :min-width="180" prop="glassId" :label="$t('Outfeed glass barcode')"></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="cell" :label="$t('Slot No')">
+ <template slot-scope='scope'>
+ {{ (scope.row.cage - 1) * 21 + scope.row.cell }}
+ </template>
+ </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>
@@ -294,9 +303,14 @@
</el-table-column>
</el-table>
<el-table :data="this.tasklist2" border style="width: 100%">
- <el-table-column :min-width="180" prop="glassId" :label="$t('Infeed glass barcode')"></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="cell" :label="$t('Slot No')">
+ <template slot-scope='scope'>
+ {{ (scope.row.cage - 1) * 21 + scope.row.cell }}
+ </template>
+ </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>
@@ -361,19 +375,28 @@
<div class="blocks-img2"></div>
<div class="blocks-img3"></div>
- <div class="device" :style="'top: 25px;left: 1027px;background-color: ' + ShowDeviceList(0) + ';'">D01</div>
+ <div class="device" :style="'top: 25px;left: 1027px;background-color: ' + ShowDeviceList(0) + ';'">D01
+ </div>
<div class="device" :style="'top: 105px;left: 1027px;background-color: ' + ShowDeviceList(1) + ';'">D02
</div>
- <div class="device" :style="'top: 102px;left: 605px;background-color: ' + ShowDeviceList(2) + ';'">B01</div>
- <div class="device" :style="'top: 102px;left: 197px;background-color: ' + ShowDeviceList(3) + ';'">B02</div>
- <div class="blocks-img" :style="'left:' + car2 + 'px;top:175px;background-color:' + ShowDeviceList(4) + ''">
+ <div class="device" :style="'top: 102px;left: 605px;background-color: ' + ShowDeviceList(2) + ';'">B01
+ </div>
+ <div class="device" :style="'top: 102px;left: 197px;background-color: ' + ShowDeviceList(3) + ';'">B02
+ </div>
+ <div class="blocks-img"
+ :style="'left:' + car2 + 'px;top:175px;background-color:' + ShowDeviceList(4) + ''">
A01</div>
- <div class="blocks-img" :style="'left:' + car1 + 'px;top:16px;background-color:' + ShowDeviceList(5) + ''">
+ <div class="blocks-img"
+ :style="'left:' + car1 + 'px;top:16px;background-color:' + ShowDeviceList(5) + ''">
A02</div>
- <div class="device" :style="'top: 108px;left: 150px;background-color: ' + ShowDeviceList(6) + ';'">D03</div>
- <div class="device" :style="'top: 185px;left: 150px;background-color: ' + ShowDeviceList(7) + ';'">D04</div>
- <div class="device" :style="'top: 262px;left: 150px;background-color: ' + ShowDeviceList(8) + ';'">D05</div>
- <div class="device" :style="'top: 339px;left: 150px;background-color: ' + ShowDeviceList(9) + ';'">D06</div>
+ <div class="device" :style="'top: 108px;left: 150px;background-color: ' + ShowDeviceList(6) + ';'">D03
+ </div>
+ <div class="device" :style="'top: 185px;left: 150px;background-color: ' + ShowDeviceList(7) + ';'">D04
+ </div>
+ <div class="device" :style="'top: 262px;left: 150px;background-color: ' + ShowDeviceList(8) + ';'">D05
+ </div>
+ <div class="device" :style="'top: 339px;left: 150px;background-color: ' + ShowDeviceList(9) + ';'">D06
+ </div>
<div class="device" :style="'top: 395px;left: 90px;background-color: ;'">E01</div>
<div class="device" :style="'top: 395px;left: 243px;background-color: ;'">E02</div>
@@ -457,7 +480,8 @@
<el-dialog :visible.sync="dialogFormVisible" :title="$t('Please confirm the glass information')">
<el-form :model="form" label-width="100px" style="padding-right: 30px">
<el-form-item :label="$t('Barcode')">
- <el-input style="width:15%;" :placeholder="$t('Enter the glass barcode')" v-model="glassid"></el-input>
+ <el-input style="width:15%;" :placeholder="$t('Enter the glass barcode')"
+ v-model="glassid"></el-input>
<el-button type="primary" @click="showform(3)">{{ $t('Query') }}</el-button>
</el-form-item>
<el-form-item :label="$t('Barcode')">
@@ -493,7 +517,7 @@
$t('confirm') }}</el-button> -->
<el-button @click="FeedInglassid()" :style="{ display: confirm2 == true ? '' : 'none' }"
type="primary">{{
- $t('confirm') }}</el-button>
+ $t('confirm') }}</el-button>
<el-button @click="cancel()">{{ $t('cancel') }}</el-button>
</span>
</template>
@@ -527,15 +551,19 @@
<el-dialog :visible.sync="dialogFormVisible3" :title="$t('Cage Details')" top="5vh">
<el-input style="width:15%;" :placeholder="$t('Enter the glass barcode')" v-model="cageglassid"></el-input>
<el-button type="primary" @click="showcageinfo(1)">{{ $t('Query') }}</el-button>
- <el-table :data="cageinfo.slice((currentPages - 1) * pagesizes, currentPages * pagesizes)" :height="700" border
- style="width: 100%;overflow: auto;">
+ <el-table :data="cageinfo.slice((currentPages - 1) * pagesizes, currentPages * pagesizes)" :height="700"
+ border style="width: 100%;overflow: auto;">
<el-table-column :min-width="50" prop="cage" :label="$t('Cage No')"></el-table-column>
- <el-table-column :min-width="50" prop="cell" :label="$t('Slot No')"></el-table-column>
+ <el-table-column :min-width="50" prop="cell" :label="$t('Slot No')">
+ <template slot-scope='scope'>
+ {{ (scope.row.cage - 1) * 21 + scope.row.cell }}
+ </template>
+ </el-table-column>
<el-table-column :min-width="55" prop="tier" :label="$t('The Side')">
<template slot-scope='scope'>
{{
- scope.row.tier == 1 ? $t('Inside') : $t('Outside')
- }}
+ scope.row.tier == 1 ? $t('Inside') : $t('Outside')
+ }}
</template>
</el-table-column>
<el-table-column :min-width="145" prop="glassId" :label="$t('Barcode')"></el-table-column>
@@ -545,14 +573,16 @@
<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 ?
- $t('Outing') : ""
- }}
+ scope.row.state == 1 ? $t('Normal') : scope.row.state == 2 ? $t('Entering') : scope.row.state ==
+ 3 ?
+ $t('Outing') : ""
+ }}
</template>
</el-table-column>
<el-table-column :min-width="150" prop="lengthWidth" :label="$t('Dim')">
<template slot-scope='scope'>
- {{ scope.row.glassWidthMm }}{{ scope.row.glassWidthMm > 0 ? "*" : "" }}{{ scope.row.glassHeightMm }}
+ {{ scope.row.glassWidthMm }}{{ scope.row.glassWidthMm > 0 ? "*" : "" }}{{
+ scope.row.glassHeightMm }}
</template>
</el-table-column>
@@ -601,10 +631,11 @@
<el-table-column prop="glasslength" :label="$t('Length')"></el-table-column>
<el-table-column prop="glassheight" :label="$t('Width')"></el-table-column>
</el-table>
- <el-pagination :style="'margin-top:-2px'" @size-change="handleSizeChange" @current-change="handleCurrentChange"
- :pager-count="7" :current-page="currentPage" :page-sizes="[5, 10, 15, 20]" :page-size="pagesize"
- layout="total, sizes, prev, pager, next, jumper" :total="GlassInfo.length > 0 ? GlassInfo.length : null"
- background style="float: right; margin-top: 20px">
+ <el-pagination :style="'margin-top:-2px'" @size-change="handleSizeChange"
+ @current-change="handleCurrentChange" :pager-count="7" :current-page="currentPage"
+ :page-sizes="[5, 10, 15, 20]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper"
+ :total="GlassInfo.length > 0 ? GlassInfo.length : null" background
+ style="float: right; margin-top: 20px">
</el-pagination>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible5" :title="$t('Please confirm the glass information')">
@@ -616,19 +647,21 @@
{{ this.isConfirm == true ? $t('Not Allow') : $t('Allow') }}</el-button>
</el-form-item>
<el-form-item>
- {{ $t('Current State') }}:{{ this.Scanningmethod == false ? $t('Automatic') : $t('Hand Movement') }}
+ {{ $t('Current State') }}:{{ this.Scanningmethod == false ? $t('Automatic') :
+ $t('Hand Movement') }}
<el-button type="primary" @click="SwitchScanMethod()">{{ $t('Switch')
- }}</el-button>
+ }}</el-button>
</el-form-item>
<el-form-item>
<el-input style="width:70%;" maxlength="13" :placeholder="$t('Enter the glass barcode')"
v-model="glassid1"></el-input>
<el-button type="primary" :disabled="!Scanningmethod" @click="WriteGlassID()">{{ $t('Add')
- }}</el-button>
+ }}</el-button>
</el-form-item>
<el-form-item>
{{ $t('Barcode') }}:
- <el-input style="width:70%;" maxlength="14" :disabled="true" v-model="CurrrentGlassId"></el-input>
+ <el-input style="width:70%;" maxlength="14" :disabled="true"
+ v-model="CurrrentGlassId"></el-input>
</el-form-item>
</div>
<div style="display: flex;justify-content: space-around;">
@@ -740,8 +773,9 @@
{{ 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 type="primary" @click="isAllowQueueState()" :disabled="!this.isAllowReordering">{{
+ this.isAllowQueue
+ == true ? $t('Stop') : $t('Start')
}}</el-button>
<el-button type="primary" @click="showform7()">{{ $t('Add') }}</el-button>
<label style="background-color:yellow;font-size: 23px;" for="">
@@ -761,9 +795,9 @@
<el-table-column :min-width="90" prop="state" :label="$t('Glass State')">
<template slot-scope='scope'>
{{ scope.row.state == 0 ? $t('Waiting') : scope.row.state == 1 ? $t('Outing') :
- scope.row.state
- == 2
- ? $t('Outed') : scope.row.state == 3 ? $t('Absent') : $t('Completed') }}
+ scope.row.state
+ == 2
+ ? $t('Outed') : scope.row.state == 3 ? $t('Absent') : $t('Completed') }}
</template>
</el-table-column>
<el-table-column prop="sequence" :label="$t('Sequence')"></el-table-column>
@@ -772,8 +806,8 @@
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
:disabled="!(!isAllowQueue && scope.row.state != 1 && scope.row.state != 2)"
@click="CompleteQueue(scope.row.id, scope.row.barcode, scope.row.glassId)">{{
- $t('Complete')
- }}</el-button>
+ $t('Complete')
+ }}</el-button>
</template>
</el-table-column>
@@ -781,26 +815,27 @@
<template slot-scope='scope'>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
:disabled="isAllowQueue" @click="deleteproductionqueueglass(scope.row.barcode)">{{
- $t('Delete') }}</el-button>
+ $t('Delete') }}</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="width:30%;" v-for="(item) in CurrentFrame" :key="item['barcode']">
<el-button style="margin-left: 42%;" type="primary" @click="FrameStateUpdate(item['barcode'])">{{
- $t('Next') }}</el-button>
+ $t('Next') }}</el-button>
<h1 style="font-size: 40px;text-align: center;">{{ $t('Current Frame') }}:{{ item['barcode'] }}</h1>
<h1 style="font-size: 30px;text-align: center;">
{{ item['flip'] == true ? $t('EXTERIQR OUT AND BYPASS TO THE LEFT')
- : $t('EXTERIQR OUT AND BYPASS TO THE RIGHT') }}
+ : $t('EXTERIQR OUT AND BYPASS TO THE RIGHT') }}
</h1>
- <h1 style="font-size: 30px;text-align: center;">{{ item['framewidthmm'] }}*{{ item['frameheightmm'] }}
+ <h1 style="font-size: 30px;text-align: center;">{{ item['framewidthmm'] }}*{{ item['frameheightmm']
+ }}
</h1>
<div class="frame" :style="'background-color: green;margin-top:30px;margin:0 auto;width: ' +
- FrameWidthHeight('before', item['framewidthmm'], item['frameheightmm'], item['position']) + 'px;height:' +
- FrameWidthHeight('after', item['framewidthmm'], item['frameheightmm'], item['position']) + 'px;'
- ">
+ FrameWidthHeight('before', item['framewidthmm'], item['frameheightmm'], item['position']) + 'px;height:' +
+ FrameWidthHeight('after', item['framewidthmm'], item['frameheightmm'], item['position']) + 'px;'
+ ">
</div>
</div>
</div>
@@ -822,12 +857,17 @@
<el-table-column prop="glasslength" :label="$t('Length')"></el-table-column>
<el-table-column prop="glassheight" :label="$t('Width')"></el-table-column>
<el-table-column prop="storageCage.cage" :label="$t('Cage No')"></el-table-column>
- <el-table-column prop="storageCage.cell" :label="$t('Slot No')"></el-table-column>
+ <el-table-column prop="storageCage.cell" :label="$t('Slot No')">
+ <template slot-scope='scope'>
+ {{ (scope.row.cage - 1) * 21 + scope.row.cell }}
+ </template>
+ </el-table-column>
<el-table-column prop="storageCage.tier" :label="$t('The Side')">
<template slot-scope='scope'>
{{
- scope.row.storageCage == null ? "" : scope.row.storageCage.tier == 1 ? $t('Inside') : $t('Outside')
- }}
+ scope.row.storageCage == null ? "" : scope.row.storageCage.tier == 1 ? $t('Inside') :
+ $t('Outside')
+ }}
</template>
</el-table-column>
@@ -957,12 +997,23 @@
DeviceList: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
GlassIdList: [],
Scanningmethod: true,
- CurrrentGlassId: ""
+ CurrrentGlassId: "",
+ feedglassid:"",
+ count1:0,
+ count2:1
};
},
created() {
this.load();
-
+ // setInterval(() => {
+ // if(this.count1<this.count2){
+ // this.count1=this.count2;
+ // }else{
+ // const now = new Date();
+ // console.log(now);
+ // alert("websocket鍋滄"+now);
+ // }
+ // }, 3000);
},
activated() {
this.init();
@@ -988,6 +1039,7 @@
};
// 娴忚鍣ㄧ鏀舵秷鎭紝鑾峰緱浠庢湇鍔$鍙戦�佽繃鏉ョ殑鏂囨湰娑堟伅
socket.onmessage = function (msg) {
+ this.count2=this.count2+1;
//console.log("鏀跺埌鏁版嵁====" + msg.data);
let obj = JSON.parse(msg.data);
if (obj.params != null) {
@@ -1017,7 +1069,7 @@
const specialChars = /[^\w\s]/g;
this.CurrrentGlassId = obj.CurrrentGlassId[0].replace(specialChars, "");
}
-
+
//鏌ヨ褰撳墠閾濇淇℃伅
this.CurrentFrame = obj.CurrentFrame;
@@ -1031,6 +1083,7 @@
}
//鑾峰彇寰呯‘璁ょ殑閾濇鐜荤拑淇℃伅
if (obj.AluminumFrame != null) {
+
this.AluminumFrame = obj.AluminumFrame[0];
if (this.dialogFormVisible6 == true) {
this.dialogFormVisible7 = true;
@@ -1044,6 +1097,9 @@
}
}
+ if(obj.feedglassid!=null){
+ this.feedglassid=obj.feedglassid[0];
+ }
// if (obj.alarmmg[0].length > 0) {
// if (this.alarm.length > 0) {
@@ -1105,6 +1161,7 @@
//鏄惁闇�瑕佹墜鍔ㄧ‘璁や笂鐗�
this.isConfirm = obj.isConfirm[0];
+
//鎵爜浣嶇幓鐠冧俊鎭�
if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 1) {
this.form3 = obj.form3[0];
@@ -1115,9 +1172,9 @@
if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 0) {
this.loadglassheight1 = 70;
- if (this.form5.glassId != obj.form3[0].glassId&&this.ManuallyInfeedGlass==false) {
+ if (this.form5.glassId != obj.form3[0].glassId && this.ManuallyInfeedGlass == false) {
this.showform3();
-
+
}
this.form5 = obj.form3[0];
this.glassid1 = "";
@@ -1249,7 +1306,16 @@
//鎵嬪姩涓婄墖
sbumitglassid() {
if (this.form.order != "") {
- if (this.form.height < 380 || this.form.width < 390 || this.form.height > 1810 || this.form.width > 2760) {
+ let width=0;
+ let height=0;
+ if(this.form.glassheight<this.form.glasswidth){
+ width=this.form.glasswidth;
+ height=this.form.glassheight;
+ }else{
+ height=this.form.glasswidth;
+ width=this.form.glassheight;
+ }
+ if (height < 380 || width < 380 || height > 1810 || width > 2760) {
this.$message.error(this.$t('The glass size is not within the range'));
} else {
if (this.zhuangtai == true) {
@@ -1333,9 +1399,9 @@
},
//鏄剧ず瀹㈡埛鐜荤拑淇℃伅
showform2() {
- SelectGlass(this.orderid).then(res => {
- this.GlassInfo = res.data.glass;
- });
+ // SelectGlass(this.orderid).then(res => {
+ // this.GlassInfo = res.data.glass;
+ // });
this.dialogFormVisible4 = true;
},
//鏄剧ず鍑虹墖闃熷垪
@@ -1508,7 +1574,13 @@
if (res.data.message == 200) {
this.$message.success(this.$t('Operation successful'));
this.dialogFormVisible = false;
- this.glassid="";
+ this.glassid = "";
+ this.form = {
+ orderId: "",
+ glassId: "",
+ height: "",
+ width: ""
+ };
}
else if (res.data.message == 400) {
this.$message.error(this.$t('The glass size is not within the range'));
@@ -1525,11 +1597,27 @@
},
//鍚敤//鐞嗙墖绗肩鐢�
UpdateDisabled(cage, cell, disabled) {
- Disabled(cage, cell, disabled).then(res => {
- if (res.data.message == 200) {
- this.$message.success(this.$t('Operation successful'));
+ this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
+ inputType: 'password',
+ inputPlaceholder: this.$t('Please enter the password'),
+ confirmButtonText: this.$t('Yes'),
+ cancelButtonText: this.$t('No'),
+ type: 'warning'
+ }).then(({ value }) => {
+ if (this.password == value) {
+ Disabled(cage, cell, disabled).then(res => {
+ if (res.data.message == 200) {
+ this.$message.success(this.$t('Operation successful'));
+ }
+ });
}
+ }).catch(() => {
+ this.$message({
+ type: 'info',
+ message: this.$t('Operation canceled')
+ });
});
+
},
//鍒犻櫎鍑虹墖闃熷垪鐜荤拑
deleteproductionqueueglass(id) {
@@ -1587,7 +1675,7 @@
this.$message.success(this.$t('Operation successful'));
}
else if (res.data.message == 400) {
- this.$message.error(this.$t('The glass size is not within the range'));
+ this.$message.error(this.$t('There is no such slot'));
} else {
this.$message.error(this.$t('This glass ID already exists in the sorting cage'));
}
@@ -1858,8 +1946,18 @@
},
//鍒ゆ柇鐜荤拑鏄惁瓒呭嚭鑼冨洿
Sizerange(Glass, position) {
+ console.log(position);
if (this.ManuallyInfeedGlass == false) {
- if ((Glass.glassheight < 380 || Glass.glasswidth < 390 || Glass.glassheight > 1810 || Glass.glasswidth > 2760) || (Glass.glassheight < 390 || Glass.glasswidth < 380 || Glass.glassheight > 2760 || Glass.glasswidth > 1810)) {
+ let width=0;
+ let height=0;
+ if(Glass.glassheight<Glass.glasswidth){
+ width=Glass.glasswidth;
+ height=Glass.glassheight;
+ }else{
+ height=Glass.glasswidth;
+ width=Glass.glassheight;
+ }
+ if (height < 380 || width < 380 || height > 1810 || width > 2760) {
this.$alert(this.$t('The glass size is not within the range'), this.$t('confirm'), {
confirmButtonText: this.$t('Yes'),
type: 'info',
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java
index c1cc9db..b01cc8a 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java
@@ -17,121 +17,79 @@
// 鍒涘缓涓�涓嚜瀹氫箟鐨� S7 鎺у埗鍣ㄦ秷鎭鐞嗗櫒瀵硅薄
MessageHandler customS7Control = new MessageHandler();
-
public PLCAutomaticParameterSetting() throws IOException {
config = new Configuration("config.properties");
}
+
@Override
public void run() {
while (this != null) {
try {
Thread.sleep(1000);
+ // System.out.println(stt);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ List<Short> arraylist = S7control.getinstance().ReadWord("DB100.120", 8);
+ List<Short> dache1 = S7control.getinstance().ReadWord("DB100.18", 1);
+ List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.22", 1);
+ List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.14", 1);
+ List<String> addresses = Arrays.asList(config.getProperty("Auto.addresses").split(","));
+ List<Short> arraylist2 = S7control.getinstance().readWords(addresses);
+ // System.out.println("lastMessage锛�" + arraylist2);
+ // 缈昏浆
+ List<Short> fanzhuan2 = S7control.getinstance().ReadWord("DB100.8", 1);
+ List<Short> xiaoche2 = S7control.getinstance().ReadWord("DB100.12", 1);
+ // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
+ // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+ // Short[] fanzhuan = { 4 };
+ // List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan));
+ // Short[] dache = { 5 };
+ // List<Short> dache1 = new ArrayList<>(Arrays.asList(dache));
+ // Short[] xiaoche = { 6 };
+ // List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche));
+ //
+ // Short[] values2 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
+ // List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2));
+ // Short[] fanzhuan22 = { 4 };
+ // List<Short> fanzhuan2 = new ArrayList<>(Arrays.asList(fanzhuan22));
+ // Short[] xiaoche22 = {5};
+ // List<Short> xiaoche2 = new ArrayList<>(Arrays.asList(xiaoche22));
- // System.out.println(stt);
+ JSONObject jsonObject = new JSONObject();
+ // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
+ // new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
- List<Short> arraylist = S7control.getinstance().ReadWord("DB100.120", 8);
- List<Short> dache1 = S7control.getinstance().ReadWord("DB100.18", 1);
- List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.22", 1);
- List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.14", 1);
- List<String> addresses = Arrays.asList(config.getProperty("Auto.addresses").split(","));
- List<Short> arraylist2 = S7control.getinstance().readWords(addresses);
- //System.out.println("lastMessage锛�" + arraylist2);
-//缈昏浆
- List<Short> fanzhuan2 = S7control.getinstance().ReadWord("DB100.8", 1);
- List<Short> xiaoche2 = S7control.getinstance().ReadWord("DB100.12", 1);
+ jsonObject.append("params", arraylist);
+ jsonObject.append("dache1", dache1);
+ jsonObject.append("xiaoche", xiaoche1);
+ jsonObject.append("fanzhuan", fanzhuan1);
+ jsonObject.append("params2", arraylist2);
+ jsonObject.append("fanzhuan2", fanzhuan2);
+ jsonObject.append("xiaoche2", xiaoche2);
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("AutomaticParameterSetting");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ webserver.sendMessage(jsonObject.toString());
-// Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
-// List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
-// Short[] fanzhuan = { 4 };
-// List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan));
-// Short[] dache = { 5 };
-// List<Short> dache1 = new ArrayList<>(Arrays.asList(dache));
-// Short[] xiaoche = { 6 };
-// List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche));
-//
-// Short[] values2 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
-// List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2));
-// Short[] fanzhuan22 = { 4 };
-// List<Short> fanzhuan2 = new ArrayList<>(Arrays.asList(fanzhuan22));
-// Short[] xiaoche22 = {5};
-// List<Short> xiaoche2 = new ArrayList<>(Arrays.asList(xiaoche22));
+ // WebSocketServer webSocketServer =
+ // WebSocketServer.sessionMap.get("AutomaticParameterSetting");
+ if (webserver != null) {
+ List<String> messages = webserver.getMessages();
+ String addressList1 = "DB100.120";
+ String addressList2 = "DB100.18";
+ String addressList3 = "DB100.22";
+ String addressList4 = "DB100.14";
- JSONObject jsonObject = new JSONObject();
- // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
- // new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
-
- jsonObject.append("params", arraylist);
- jsonObject.append("dache1", dache1);
- jsonObject.append("xiaoche", xiaoche1);
- jsonObject.append("fanzhuan", fanzhuan1);
- jsonObject.append("params2", arraylist2);
- jsonObject.append("fanzhuan2", fanzhuan2);
- jsonObject.append("xiaoche2", xiaoche2);
-
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("AutomaticParameterSetting");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- webserver.sendMessage(jsonObject.toString());
-
-// WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("AutomaticParameterSetting");
- if (webserver != null) {
- List<String> messages = webserver.getMessages();
- String addressList1 = "DB100.120";
- String addressList2 = "DB100.18";
- String addressList3 = "DB100.22";
- String addressList4 = "DB100.14";
-
- if (!messages.isEmpty()) {
- // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
- String lastMessage = messages.get(messages.size() - 1);
- // System.out.println("lastMessage锛�" + lastMessage);
- JSONArray messageArray = new JSONArray(lastMessage);
-
- // 鏁村悎绗� 1 鍒� 2 涓暟缁勫苟鍘绘帀 null 鍏冪礌
- List<Short> mergedList = new ArrayList<>();
- for (int i = 0; i < 2; 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);
- }
- }
- }
- }
- System.out.println(messageArray);
- // 鍐欏叆绗竴涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList2,2);
- // 鍐欏叆绗簩涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList3,3);
- // 鍐欏叆绗笁涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList4,4);
- // 鍐欏叆绗洓涓湴鍧�
- if (!mergedList.isEmpty()) {
- S7control.getinstance().WriteWord(addressList1, mergedList);
- System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList1);
- }
-
- List<String> waddresses1 = Arrays.asList(config.getProperty("Auto.shusong").split(","));
- String addressList22 = "DB100.8";
- String addressList33 = "DB100.12";
if (!messages.isEmpty()) {
// 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
- // 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
- List<Short> mergedList2 = new ArrayList<>();
- for (int i = 5; i < 8; i++) {
+ String lastMessage = messages.get(messages.size() - 1);
+ // System.out.println("lastMessage锛�" + lastMessage);
+ JSONArray messageArray = new JSONArray(lastMessage);
+
+ // 鏁村悎绗� 1 鍒� 2 涓暟缁勫苟鍘绘帀 null 鍏冪礌
+ List<Short> mergedList = new ArrayList<>();
+ for (int i = 0; i < 2; i++) {
JSONArray sublist = messageArray.getJSONArray(i);
for (int j = 0; j < sublist.size(); j++) {
Object value = sublist.get(j);
@@ -139,7 +97,7 @@
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
- mergedList2.add(sValue);
+ mergedList.add(sValue);
} catch (NumberFormatException e) {
// 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
System.err.println("Could not parse value: " + value);
@@ -147,23 +105,63 @@
}
}
}
-
- // 鍐欏叆绗紞涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList22,8);
- // 鍐欏叆绗叚涓湴鍧�
- customS7Control.WriteWordsToPLC(messageArray, addressList33,9);
- // 鍐欏叆绗竷涓湴鍧�
- if (!mergedList2.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses1, mergedList2);
- System.out.println("messageValue锛�" + mergedList2 + " written to PLC at address " + waddresses1);
+ System.out.println(messageArray);
+ // 鍐欏叆绗竴涓湴鍧�
+ customS7Control.WriteWordsToPLC(messageArray, addressList2, 2);
+ // 鍐欏叆绗簩涓湴鍧�
+ customS7Control.WriteWordsToPLC(messageArray, addressList3, 3);
+ // 鍐欏叆绗笁涓湴鍧�
+ customS7Control.WriteWordsToPLC(messageArray, addressList4, 4);
+ // 鍐欏叆绗洓涓湴鍧�
+ if (!mergedList.isEmpty()) {
+ S7control.getinstance().WriteWord(addressList1, mergedList);
+ System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList1);
}
- // 娓呯┖娑堟伅鍒楄〃
- webserver.clearMessages();
+
+ List<String> waddresses1 = Arrays.asList(config.getProperty("Auto.shusong").split(","));
+ String addressList22 = "DB100.8";
+ String addressList33 = "DB100.12";
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+ // 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
+ List<Short> mergedList2 = new ArrayList<>();
+ for (int i = 5; i < 8; 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());
+ mergedList2.add(sValue);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ }
+
+ // 鍐欏叆绗紞涓湴鍧�
+ customS7Control.WriteWordsToPLC(messageArray, addressList22, 8);
+ // 鍐欏叆绗叚涓湴鍧�
+ customS7Control.WriteWordsToPLC(messageArray, addressList33, 9);
+ // 鍐欏叆绗竷涓湴鍧�
+ if (!mergedList2.isEmpty()) {
+ S7control.getinstance().WriteWord(waddresses1, mergedList2);
+ System.out.println("messageValue锛�" + mergedList2 + " written to PLC at address " + waddresses1);
+ }
+ // 娓呯┖娑堟伅鍒楄〃
+ webserver.clearMessages();
+ }
}
}
- }
+ }
}
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java b/springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java
index 16f05e3..a3b24e4 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java
@@ -33,14 +33,7 @@
while (this != null) {
try {
Thread.sleep(500);
-
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
-
-
- List<String> addressList21 = Arrays.asList(config.getProperty("PLCManualJog.button").split(","));
+ List<String> addressList21 = Arrays.asList(config.getProperty("PLCManualJog.button").split(","));
List<Boolean> arraylist = S7control.getinstance().readBits(addressList21);
@@ -112,6 +105,13 @@
}
}
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+
+
+
}
}
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 c988d3a..763907d 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
@@ -3,17 +3,16 @@
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.List;
+import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.service.JdbcConnections;
import com.example.springboot.service.SpianService;
-
+import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.north_glass_buffer1;
-import com.example.springboot.mapper.AlarmMapper;
import com.example.springboot.mapper.SpianMapper;
public class PlcHold extends Thread {
- private AlarmMapper alarmMapper;
@Autowired
private JdbcConnections jdbcConnections;
@@ -27,14 +26,9 @@
while (this != null) {
try {
-
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // \\ TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- // if (S7control.getinstance().CheckConnected() == false) {
+ spianService.result=new ArrayList<>();
+ Thread.sleep(300);
+ // if (S7control.getinstance().CheckConnected() == false) {
spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
@@ -48,12 +42,8 @@
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
- spianService.selectout2("X12345610102GV");
-
-
- // 鍑虹墖浠诲姟////////////////////////////////
- //spianService.selectout2("X21942613103GV");
-
+ // spianService.selectout2("X21942610602GV");
+
List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖杞︾姸鎬�
List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 鍑虹墖浠诲姟鏄惁鍚姩
@@ -89,14 +79,18 @@
// 褰撴湁寰呭嚭鐗囩殑鐜荤拑鏃�
if (outglassid != null) {
// 鑾峰彇璇ョ幓鐠冩槸鍚﹁绂佺敤
- int glassdisabled = spianMapper.SelectCageGlassState(outglassid);
- // 鏈鐢ㄤ笅鍙戜换鍔�
- if (glassdisabled == 0) {
+ StorageCage glassdisabled = spianMapper.SelectCageGlassState(outglassid);
+ if(glassdisabled!=null){
+ // 鏈鐢ㄤ笅鍙戜换鍔�
+ if (glassdisabled.getDisabled() == 0) {
spianService.selectout2(outglassid);
Plchome.isQueueWarning = false;
} else { // 绂佺敤鏇存敼鐘舵�佸脊鍑烘彁绀�
Plchome.isQueueWarning = true;
+ System.out.println("绂佺敤" + outglassid);
}
+ }
+
}
}
@@ -120,12 +114,15 @@
if (HB > 0) {
// 褰揃01灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬� 涓�1
S7control.getinstance().WriteWord("DB105.48", (short) 1);// 鎭㈠B01灏忚溅搴旂瓟鏀逛负1
- boolean yingda = spianService.listbool("DB105.48");// b01姹囨姤
+ boolean yingda = spianService.listbool("DB105.48");// b01搴旂瓟
if (yingda == true) {
spianService.overtask(B01glassid.toString());// 瀹屾垚浠诲姟
}
- System.out.println("姹囨姤鏃禕01|绗�" + aaa + "娆�" + B01glassid + "搴旂瓟" + yingda);
- aaa += 1;
+ System.out.println("姹囨姤鏃禕01|" + B01glassid + "搴旂瓟" + yingda);
+ Plchome.feedglassid=B01glassid;
+ }else{
+ S7control.getinstance().WriteWord("DB105.48", (short) 1);// 鎭㈠B01灏忚溅搴旂瓟鏀逛负1
+ System.out.println("HB:|" + HB+"glassid|"+B01glassid);
}
}else{
@@ -136,17 +133,19 @@
if (B02backs == true) {
// 鍒ゆ柇鏄惁姹囨姤姝g‘鐨刬d
int HB = spianMapper.SelectHB(B02glassid.toString());
- System.out.println("姹囨姤鏃禕02|" + B02glassid);
+ System.out.println("huibaoshiB02ID|" + B02glassid);
if (HB > 0) {
// 褰揃02灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬佷负0
-
S7control.getinstance().WriteWord("DB105.50", (short) 1);// 鎭㈠B02灏忚溅搴旂瓟鏀逛负1
- System.out.println("姹囨姤鏃禕02ID|" + B02glassid);
boolean yingda = spianService.listbool("DB105.50");// b02姹囨姤
- if (yingda == true) {
+ if (yingda == true) {
spianService.overtask(B02glassid.toString());// 瀹屾垚浠诲姟
}
- System.out.println("姹囨姤鏃禕02|绗�" + aaa + "娆�" + B02glassid + "搴旂瓟" + yingda);
+ System.out.println("姹囨姤鏃禕02|" + B02glassid + "搴旂瓟" + yingda);
+ Plchome.feedglassid=B01glassid;
+ }else{
+ S7control.getinstance().WriteWord("DB105.50", (short) 1);// 鎭㈠B02灏忚溅搴旂瓟鏀逛负1
+ System.out.println("HB:|" + HB+"glassid|"+B02glassid);
}
}else{
S7control.getinstance().WriteWord("DB105.50", (short) 0);// 鎭㈠B02灏忚溅搴旂瓟鏀逛负0
@@ -159,22 +158,29 @@
StringBuilder queueid2 = spianService.queGlassid("DB103.58", 14);
int questate = spianMapper.Selectquecount(queueid1.toString());// 鍒ゆ柇鎵爜浣嶆槸鍚︽湁鐜荤拑宸茬‘璁�
- // queueid1.toString().isEmpty()
+ //queueid1.toString().isEmpty();
// north_glass_buffer1 glass1 = spianMapper.selectGlass(queueid1.toString());// D01鐨勭幓鐠冧俊鎭�
// north_glass_buffer1 glass2 = spianMapper.selectGlass(queueid2.toString());// D02鐜荤拑淇℃伅
- north_glass_buffer1 glass1=null;
- north_glass_buffer1 glass2=null;
+
+ north_glass_buffer1 glass1 =new north_glass_buffer1();
+ north_glass_buffer1 glass2 =new north_glass_buffer1();
+
try {
- glass1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(queueid1.toString(),"","");// D01鐜荤拑淇℃伅
- glass2 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(queueid2.toString(),"","");// D02鐜荤拑淇℃伅
+ if(queueid1.toString()!=""){
+ glass1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIdplchold(queueid1.toString(),"","");// D01鐜荤拑淇℃伅
+ }
+ if(queueid2.toString()!=""){
+ glass2 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIdplchold(queueid2.toString(),"","");// D02鐜荤拑淇℃伅
+ }
+
} catch (SQLException e) {
e.printStackTrace();
}
-
+
// 褰撴壂鐮佷綅鐜荤拑id涓虹┖鏃� 瀹藉害涓�0
if (queueid1 != null && questate == 0) {
// 鍐欏叆D01鐨勬暟鎹埌涓婄墖闃熷垪琛�
- if (glass1 == null) { // 褰撴病鏈夊�兼椂浼犵┖
+ if (glass1 == null ||glass1.getordernumber()==null) { // 褰撴病鏈夊�兼椂浼犵┖
spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 1);
} else {
@@ -187,7 +193,7 @@
if (queueid2 != null) {
// 鍐欏叆D02鐨勬暟鎹埌涓婄墖闃熷垪琛�
- if (glass2 == null) {
+ if (glass2 == null ||glass2.getordernumber()==null) {
spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 2);
} else {
spianMapper.Updatequeue(queueid2.toString(), glass2.getordernumber(), glass2.getlistnumber(),
@@ -198,11 +204,18 @@
}
}
+ System.out.println(spianService.result);
// 鏌ヨ鏁版嵁搴�
// 鎺ㄩ�佸埌鍓嶇
// }
+ } catch (InterruptedException e) {
+ // \\ TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
deleted file mode 100644
index 5c979bf..0000000
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package com.example.springboot.component;
-
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import com.example.springboot.service.JdbcConnections;
-import com.example.springboot.service.SpianService;
-import com.example.springboot.entity.north_glass_buffer1;
-import com.example.springboot.entity.device.PlcParameterObject;
-import com.example.springboot.mapper.AlarmMapper;
-import com.example.springboot.mapper.SpianMapper;
-
-public class PlcHoldNew extends Thread {
-
- private AlarmMapper alarmMapper;
-
- @Autowired
- private JdbcConnections jdbcConnections;
- private SpianMapper spianMapper;
- private SpianService spianService;
- int aaa;
-
- @Override
- public void run() {
-
- while (this != null) {
- try {
-
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // \\ TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- // if (S7control.getinstance().CheckConnected() == false) {
- spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
- spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
- jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
-
- //璇诲彇DB105鍖烘枃浠�
- PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
- //璇�106
- PlcParameterObject plcread=PLCAutoMes.PlcReadObject;
- //璇�103
- PlcParameterObject plcstate=PLCAutoMes.plcStateObject;
- String OutRequest=plcread.getPlcParameter("OutRequest").getValue();//鍑虹墖璇锋眰
- String OutActivate=plcmes.getPlcParameter("OutActivate").getValue();//鍑虹墖鍚姩
-
-
-
- S7control.getinstance().WriteWord( plcmes.getPlcParameter("1231").getAddress(plcmes.getPlcParameter("1231").getAddressIndex()), (short) 0);
- // 鍑虹墖浠诲姟
-
- if (OutActivate.equals("1") == false&&OutRequest.equals("1")==true) {
- S7control.getinstance().WriteWord("DB105.18", (short) 0);// 鍑虹墖浠诲姟鍚姩鏀逛负0
- }
- String FeedRequest=plcread.getPlcParameter("FeedRequest").getValue();// 杩涚墖璇锋眰瀛�
- String AddActivate=plcmes.getPlcParameter("AddActivate").getValue();// 杩涚墖鍚姩
- if (FeedRequest.equals("1") == false&&AddActivate.equals("1")==true) {
- S7control.getinstance().WriteWord("DB105.16", (short) 0);//杩涚墖浠诲姟鍚姩鏀逛负0
- }
-
- if (OutActivate.equals("1") == true) {
- // 鍒ゆ柇褰撳墠鏄惁鏈夋湭鎵ц鐨勪换鍔�
- int outnum = spianMapper.SelectOutSliceshu();//鏄惁鏈夋鍦ㄥ嚭鐗囩殑浠诲姟
- int cageoutsum = spianMapper.Selectcageout(3);//绗煎瓙鍐呮槸鍚﹁繕鏈夊湪鍑虹墖鐨勭幓鐠�
- // 褰撴病鏈変换鍔℃墽琛屽苟涓斿嚭鐗囪溅绌洪棽鏃�
- if (outnum == 0 && 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;
- } else { // 绂佺敤鏇存敼鐘舵�佸脊鍑烘彁绀�
- Plchome.isQueueWarning = true;
- }
-
- }
- }
-
- }
-
- ///////////// 杩涚墖浠诲姟
-
- String B01backs = plcread.getPlcParameter("B01CompleteTheReport").getValue();// b01姹囨姤
- String B02backs = plcread.getPlcParameter("B02CompleteTheReport").getValue();// b02姹囨姤
-
- String B01glassid = plcstate.getPlcParameter("B01ID1").getValue();// BO1鐨勭幓鐠僫d
- String B02glassid = plcstate.getPlcParameter("B02ID1").getValue();// B02鐨勭幓鐠僫d
-
- // 褰撹繘鐗囧皬杞﹀畬鎴愪换鍔℃椂
- if (B01backs.equals("1") == true) {
- // 鍒ゆ柇鏄惁姹囨姤姝g‘鐨刬d
- int HB = spianMapper.SelectHB(B01glassid.toString());
- if (HB > 0) {
- // 鎭㈠B01灏忚溅搴旂瓟鏀逛负1
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 1);
- String yingda =plcmes.getPlcParameter("B01report").getValue();// b01姹囨姤
- if (yingda.equals("1")) {
- spianService.overtask(B01glassid.toString());// 瀹屾垚浠诲姟
- }
- }
-
- }else{
- // 鎭㈠B01灏忚溅搴旂瓟鏀逛负0
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 0);
- }
-
- // 褰撳嚭鐗囧皬杞﹀畬鎴愪换鍔℃椂
- if (B02backs.equals("1") == true) {
- // 鍒ゆ柇鏄惁姹囨姤姝g‘鐨刬d
- int HB = spianMapper.SelectHB(B02glassid);
- if (HB > 0) {
- // 鎭㈠B02灏忚溅搴旂瓟鏀逛负1
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("B02report").getAddress(plcmes.getPlcParameter("B02report").getAddressIndex()), (short) 1);
- String yingda =plcmes.getPlcParameter("B01report").getValue();// b02搴旂瓟
- if (yingda.equals("1") == true) {
- spianService.overtask(B02glassid);// 瀹屾垚浠诲姟
- }
- }
- }else{
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("B02report").getAddress(plcmes.getPlcParameter("B02report").getAddressIndex()), (short) 0);
- }
-
-
- // 鑾峰彇DO1鏁版嵁
- String Do1ID=plcread.getPlcParameter("FeedID").getValue();// 鑾峰彇璇锋眰鐨刬d璺烡O1鍚屾椂娓�
- // 鑾峰彇DO2鏁版嵁
- String Do2ID=plcread.getPlcParameter("FeedID").getValue();// 鑾峰彇璇锋眰鐨刬d璺烡O1鍚屾椂娓�
-
-
- int questate = spianMapper.Selectquecount(Do1ID.toString());// 鍒ゆ柇鎵爜浣嶆槸鍚︽湁鐜荤拑宸茬‘璁�
- // queueid1.toString().isEmpty()
- north_glass_buffer1 glass1 = spianMapper.selectGlass(Do1ID);// D01鐨勭幓鐠冧俊鎭�
- north_glass_buffer1 glass2 = spianMapper.selectGlass(Do2ID);// D02鐜荤拑淇℃伅
- // 褰撴壂鐮佷綅鐜荤拑id涓虹┖鏃� 瀹藉害涓�0
- if (Do1ID != null && questate == 0) {
- // 鍐欏叆D01鐨勬暟鎹埌涓婄墖闃熷垪琛�
- if (glass1 == null) { // 褰撴病鏈夊�兼椂浼犵┖
- spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 1);
- } else {
- spianMapper.Updatequeue(Do1ID.toString(), glass1.getordernumber(), glass1.getlistnumber(),
- glass1.getboxnumber(), 0, glass1.getglasslengthmm().toString(), glass1.getglassheightmm().toString(),
- glass1.getglasslength().toString(), glass1.getglassheight().toString(), 1);
- }
-
- }
-
- if (Do2ID != null) {
- // 鍐欏叆D02鐨勬暟鎹埌涓婄墖闃熷垪琛�
- if (glass2 == null) {
- spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 2);
- } else {
- spianMapper.Updatequeue(Do2ID.toString(), glass2.getordernumber(), glass2.getlistnumber(),
- glass2.getboxnumber(), 0, glass2.getglasslengthmm().toString(), glass2.getglassheightmm().toString(),
- glass2.getglasslength().toString(), glass2.getglassheight().toString(), 2);
- spianMapper.overqueue2(Do2ID.toString(), 0, 1);// 鏇存敼鎵爜浣嶄换鍔¤〃鐨勭姸鎬佷负0
- S7control.getinstance().WriteWord("DB105.16", (short) 0);// 鍏抽棴浠诲姟鍚姩
- }
-
- }
-
- // 鏌ヨ鏁版嵁搴�
- // 鎺ㄩ�佸埌鍓嶇
-
- // }
- }
- }
-
-}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcInteractionState.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcInteractionState.java
index 4da5ad7..d39565b 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcInteractionState.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcInteractionState.java
@@ -15,95 +15,88 @@
config = new Configuration("config.properties");
}
-
// 鍒涘缓涓�涓嚜瀹氫箟鐨� S7 鎺у埗鍣ㄦ秷鎭鐞嗗櫒瀵硅薄
MessageHandler customS7Control = new MessageHandler();
-
-
-
-
@Override
public void run() {
while (this != null) {
try {
Thread.sleep(100);
+ // this.readValue();
+ // String PlcAddress = this.name;
+ // Integer Plccount = this.count;
+ List<String> addresses = Arrays
+ .asList(config.getProperty("PlcInteractionState.MESImporttask").split(","));
+
+ List<String> arraylist = S7control.getinstance().readStringsandword(addresses);
+ // System.out.println(arraylist);
+ List<String> addresses2 = Arrays
+ .asList(config.getProperty("PlcInteractionState.PLCImporttask").split(","));
+
+ List<String> arraylist2 = S7control.getinstance().readStringsandword(addresses2);
+
+ List<String> addresses3 = Arrays
+ .asList(config.getProperty("PlcInteractionState.MESProductiontask").split(","));
+
+ List<String> arraylist3 = S7control.getinstance().readStringsandword(addresses3);
+
+ List<String> addresses4 = Arrays
+ .asList(config.getProperty("PlcInteractionState.PLCProductiontask").split(","));
+
+ List<String> arraylist4 = S7control.getinstance().readStringsandword(addresses4);
+
+ List<String> addresses5 = Arrays
+ .asList(config.getProperty("PlcInteractionState.MEStaskinformation").split(","));
+ List<String> arraylist5 = S7control.getinstance().readStringsandword(addresses5);
+
+ List<String> addresses6 = Arrays
+ .asList(config.getProperty("PlcInteractionState.MEStaskinformation2").split(","));
+ List<String> arraylist6 = S7control.getinstance().readStringsandword(addresses6);
+
+ // String[] values = { ".x11","x21 ","x21 ","x21 ","x21 ","x21"};
+ // List<String> arraylist = new ArrayList<>(Arrays.asList(values));
+ // String[] values2 = { ".x11 ","x21 ","x21 ","x21 ","x21 ","x21 ","x21 "};
+ // List<String> arraylist2 = new ArrayList<>(Arrays.asList(values2));
+ // String[] values3 = { ".x11 ","x21 ","x21 ","x21 ","x21 ","x21 "};
+ // List<String> arraylist3 = new ArrayList<>(Arrays.asList(values3));
+ // String[] values4 = { ".x11 ","x21 ","x21 ","x21 "};
+ // List<String> arraylist4 = new ArrayList<>(Arrays.asList(values4));
+ // String[] values5 = { ".x11 ","x21 ","x21 ","b02","x21 ","x21 "};
+ // List<String> arraylist5 = new ArrayList<>(Arrays.asList(values5));
+ //
+ // String[] values6 = { "x21 ","x21 ","x21 ","x21 ","x21 ","x21 ","x21 "};
+ // List<String> arraylist6 = new ArrayList<>(Arrays.asList(values6));
+
+ JSONObject jsonObject = new JSONObject();
+ // System.out.println(arraylist6);
+ JSONArray jsonArray = new JSONArray();
+ jsonArray.put(arraylist);
+ jsonArray.put(arraylist2);
+ jsonArray.put(arraylist3);
+ jsonArray.put(arraylist4);
+ jsonArray.put(arraylist5);
+ jsonArray.put(arraylist6);
+ jsonObject.put("zuhe1", jsonArray);
+
+ // WebSocketServer sendwServer =
+ // WebSocketServer.sessionMap.get("ManualonePosition");
+ // if (sendwServer != null) {
+ // sendwServer.sendMessage(jsonObject.toString());
+ // }
+
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("InteractionState");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ webserver.sendMessage(jsonObject.toString());
+
+ }
+ }
} catch (InterruptedException e) {
e.printStackTrace();
}
- // this.readValue();
- // String PlcAddress = this.name;
- // Integer Plccount = this.count;
-
-
- List<String> addresses = Arrays.asList(config.getProperty("PlcInteractionState.MESImporttask").split(","));
-
- List<String> arraylist = S7control.getinstance().readStringsandword(addresses);
- // System.out.println(arraylist);
- List<String> addresses2 = Arrays.asList(config.getProperty("PlcInteractionState.PLCImporttask").split(","));
-
- List<String> arraylist2 = S7control.getinstance().readStringsandword(addresses2);
-
- List<String> addresses3 = Arrays.asList(config.getProperty("PlcInteractionState.MESProductiontask").split(","));
-
- List<String> arraylist3 = S7control.getinstance().readStringsandword(addresses3);
-
-
- List<String> addresses4 = Arrays.asList(config.getProperty("PlcInteractionState.PLCProductiontask").split(","));
-
- List<String> arraylist4 = S7control.getinstance().readStringsandword(addresses4);
-
-
- List<String> addresses5 = Arrays.asList(config.getProperty("PlcInteractionState.MEStaskinformation").split(","));
- List<String> arraylist5 = S7control.getinstance().readStringsandword(addresses5);
-
- List<String> addresses6 = Arrays.asList(config.getProperty("PlcInteractionState.MEStaskinformation2").split(","));
- List<String> arraylist6 = S7control.getinstance().readStringsandword(addresses6);
-
-
-// String[] values = { ".x11","x21 ","x21 ","x21 ","x21 ","x21"};
-// List<String> arraylist = new ArrayList<>(Arrays.asList(values));
-// String[] values2 = { ".x11 ","x21 ","x21 ","x21 ","x21 ","x21 ","x21 "};
-// List<String> arraylist2 = new ArrayList<>(Arrays.asList(values2));
-// String[] values3 = { ".x11 ","x21 ","x21 ","x21 ","x21 ","x21 "};
-// List<String> arraylist3 = new ArrayList<>(Arrays.asList(values3));
-// String[] values4 = { ".x11 ","x21 ","x21 ","x21 "};
-// List<String> arraylist4 = new ArrayList<>(Arrays.asList(values4));
-// String[] values5 = { ".x11 ","x21 ","x21 ","b02","x21 ","x21 "};
-// List<String> arraylist5 = new ArrayList<>(Arrays.asList(values5));
-//
-// String[] values6 = { "x21 ","x21 ","x21 ","x21 ","x21 ","x21 ","x21 "};
-// List<String> arraylist6 = new ArrayList<>(Arrays.asList(values6));
-
-
-
- JSONObject jsonObject = new JSONObject();
- // System.out.println(arraylist6);
- JSONArray jsonArray = new JSONArray();
- jsonArray.put(arraylist);
- jsonArray.put(arraylist2);
- jsonArray.put(arraylist3);
- jsonArray.put(arraylist4);
- jsonArray.put(arraylist5);
- jsonArray.put(arraylist6);
- jsonObject.put("zuhe1", jsonArray);
-
-
-// WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualonePosition");
-// if (sendwServer != null) {
-// sendwServer.sendMessage(jsonObject.toString());
-// }
-
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("InteractionState");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- webserver.sendMessage(jsonObject.toString());
-
-
- }
- }
}
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java
index 9e9128f..d95370c 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java
@@ -52,65 +52,62 @@
while (this != null) {
try {
Thread.sleep(1000);
+ JSONObject jsonObject = new JSONObject();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- JSONObject jsonObject = new JSONObject();
+ // 娉ㄥ叆mapper
- // 娉ㄥ叆mapper
+ homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
- homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
+ if (S7control.getinstance().CheckConnected() == true) {
+ // 鏌ヨ鎶ヨ淇℃伅
+ List<alarmmg> alarmmg = homeMapper.SelectAlarmmgInfo();
+ jsonObject.append("alarmmg", alarmmg);
- if (S7control.getinstance().CheckConnected() == true) {
-
-
-
- // 鏌ヨ鎶ヨ淇℃伅
- List<alarmmg> alarmmg = homeMapper.SelectAlarmmgInfo();
- jsonObject.append("alarmmg", alarmmg);
+ // 澶嶄綅鍊掕鏃�
+ // 鍦板潃104.9.6
+ List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
+ for (Boolean countdowns : countdown) {
+ jsonObject.append("countdown", countdowns);
+ }
+ // jsonObject.append("countdown", true);
+ // 澶嶄綅瀹屾垚淇″彿ss
+ List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
+ for (Boolean reset : resetss) {
+ jsonObject.append("reset", reset);
+ }
- // 澶嶄綅鍊掕鏃�
- // 鍦板潃104.9.6
- List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
- for (Boolean countdowns : countdown) {
- jsonObject.append("countdown", countdowns);
- }
- // jsonObject.append("countdown", true);
- // 澶嶄綅瀹屾垚淇″彿ss
- List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
- for (Boolean reset : resetss) {
- jsonObject.append("reset", reset);
- }
-
- // 鏄惁鎬ュ仠
- List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
- for (Boolean emergencystop : emergencystops) {
- jsonObject.append("emergencystop", emergencystop);
- }
-
- }
-
- // jsonObject.append("params", new short[] { 30, 40, });
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Layout");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- webserver.sendMessage(jsonObject.toString());
-
- if (webserver != null) {
-
- List<String> messages = webserver.getMessages();
-
- if (!messages.isEmpty()) {
- // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
- webserver.clearMessages();
- }
-
+ // 鏄惁鎬ュ仠
+ List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
+ for (Boolean emergencystop : emergencystops) {
+ jsonObject.append("emergencystop", emergencystop);
}
}
+
+ // jsonObject.append("params", new short[] { 30, 40, });
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Layout");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ webserver.sendMessage(jsonObject.toString());
+
+ if (webserver != null) {
+
+ List<String> messages = webserver.getMessages();
+
+ if (!messages.isEmpty()) {
+ // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ webserver.clearMessages();
+ }
+
+ }
+
+ }
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
+
}
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
index fa3faf1..f7f6910 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
@@ -54,11 +54,7 @@
while (this != null) {
try {
Thread.sleep(500);
-
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- // this.readValue();
+ // this.readValue();
// String PlcAddress = this.name;
// Integer Plccount = this.count;
@@ -245,6 +241,11 @@
}
}
}
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
}
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
index 72d225b..d2a6a67 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
@@ -52,11 +52,7 @@
while (this != null) {
try {
Thread.sleep(500);
-
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- // this.readValue();
+ // this.readValue();
// String PlcAddress = this.name;
// Integer Plccount = this.count;
@@ -215,6 +211,10 @@
}
}
}
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
}
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
index 766cc49..e5877fc 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
@@ -14,7 +14,6 @@
import java.util.Collections;
import java.util.List;
-
public class PlcParameter2 extends Thread {
@Autowired
StorageCageService storageCageService;
@@ -22,7 +21,6 @@
MessageHandler customS7Control = new MessageHandler();
// 鐢ㄤ簬瀛樺偍搴旂敤绋嬪簭鐨勯厤缃俊鎭�
private Configuration config;
-
public PlcParameter2() throws IOException {
config = new Configuration("config.properties");
@@ -33,251 +31,251 @@
while (this != null) {
try {
Thread.sleep(1000);
+ storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
+ // id
+ List<String> addressList1 = Arrays.asList(config.getProperty("Parameter2.id").split(","));
+ List<String> paramlist = S7control.getinstance().readStrings(addressList1);
+ // System.out.println(paramlist);
+ // 鎵嬪姩鐘舵��
+ List<String> addresses = Arrays.asList(config.getProperty("Parameter2.state").split(","));
+ List<Short> data = S7control.getinstance().readWords(addresses);
+ // 娓呴櫎id
+ List<String> addressList0 = Arrays.asList(config.getProperty("Parameter2.cleanid").split(","));
+ // 鎵爜鏋�
+ List<Boolean> data2 = S7control.getinstance().readBits(addressList0);
+ List<String> addressList3 = Arrays.asList(config.getProperty("Parameter2.scanner").split(","));
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
- // id
- List<String> addressList1 = Arrays.asList(config.getProperty("Parameter2.id").split(","));
- List<String> paramlist = S7control.getinstance().readStrings(addressList1);
- // System.out.println(paramlist);
- //鎵嬪姩鐘舵��
- List<String> addresses = Arrays.asList(config.getProperty("Parameter2.state").split(","));
- List<Short> data = S7control.getinstance().readWords(addresses);
- //娓呴櫎id
- List<String> addressList0 = Arrays.asList(config.getProperty("Parameter2.cleanid").split(","));
- // 鎵爜鏋�
- List<Boolean> data2 = S7control.getinstance().readBits(addressList0);
- List<String> addressList3 = Arrays.asList(config.getProperty("Parameter2.scanner").split(","));
+ // 鎬ュ仠鎸夐挳
+ List<String> niuanaddressList3 = Arrays.asList(config.getProperty("Parameter2.stop").split(","));
+ List<String> timeout = Arrays.asList(config.getProperty("Parameter2.timeout").split(","));
+ String timeout2 = config.getProperty("Parameter2.timeout");
-//鎬ュ仠鎸夐挳
- List<String> niuanaddressList3 = Arrays.asList(config.getProperty("Parameter2.stop").split(","));
- List<String> timeout = Arrays.asList(config.getProperty("Parameter2.timeout").split(","));
- String timeout2 = config.getProperty("Parameter2.timeout");
+ Long readtimeout = S7control.getinstance().readtime(timeout2);
+ List<Boolean> anniuread = S7control.getinstance().readBits(niuanaddressList3);
+ List<String> data3 = S7control.getinstance().readStrings(addressList3);
+ // A01 A02 B01 B02
+ List<String> addresses4 = Arrays.asList(config.getProperty("Parameter2.Currentcell").split(","));
+ List<Short> data4 = S7control.getinstance().readWords(addresses4);
+ // System.out.println(data);
+ // List<Long> TIME2 =
+ // Collections.singletonList(S7control.getinstance().readtime("DB100.194"));
+ // System.out.println("addressList锛�" + TIME2);
- Long readtimeout = S7control.getinstance().readtime(timeout2);
- List<Boolean> anniuread = S7control.getinstance().readBits(niuanaddressList3);
- List<String> data3 = S7control.getinstance().readStrings(addressList3);
-// A01 A02 B01 B02
- List<String> addresses4 = Arrays.asList(config.getProperty("Parameter2.Currentcell").split(","));
- List<Short> data4 = S7control.getinstance().readWords(addresses4);
- //System.out.println(data);
-// List<Long> TIME2 = Collections.singletonList(S7control.getinstance().readtime("DB100.194"));
-// System.out.println("addressList锛�" + TIME2);
+ //
+ //
+ // String[] values6 = { ".x1 ","x2
+ // ","x3",";;x4","x5","x6","x7","x8","x9","x10","x11"};
+ // List<String> paramlist = new ArrayList<>(Arrays.asList(values6));
+ // Short[] values1 = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ // List<Short> data = new ArrayList<>(Arrays.asList(values1));
+ // Boolean[] value4 = { false, false, false, false, false, false, false, false,
+ // false,
+ // false};
+ // List<Boolean> data2 = new ArrayList<>(Arrays.asList(value4));
+ // String[] values3 = { ".x11 ","x21 "};
+ // List<String> data3 = new ArrayList<>(Arrays.asList(values3));
+ // Short[] values4 = { 2,2,3,4};
+ // List<Short> data4 = new ArrayList<>(Arrays.asList(values4));
+ //
+ //
+ // JSONObject jsonObject = new JSONObject();
+ // short[] params = new short[data2.size()];
+ // for (int i = 0; i < data2.size(); i++) {
+ // boolean value = data2.get(i);
+ // params[i] = value ? (short) 1 : (short) 0;
+ // }
+ ////
+ // 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;
+ // }
+ // boolean杞负0 1
+ short[] params = customS7Control.convertBooleanListToShortArray(data2);
+ short[] anniuparams = customS7Control.convertBooleanListToShortArray(anniuread);
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.append("params", params);
+ jsonObject.append("params", paramlist);
+ jsonObject.append("params", data);
+ jsonObject.append("params", data3);
+ jsonObject.append("params", data4);
+ jsonObject.append("jiting", anniuparams);
+ jsonObject.append("timeout", readtimeout);
- //
+ // WebSocketServer sendwServer =
+ // WebSocketServer.getWebSocketServer("Parameter2");
+ // if (sendwServer != null) {
+ // JSONObject jsonObject = new JSONObject();
+ // jsonObject.set("message", "Hello, Parameter2!");
+ // sendwServer.sendMessage(jsonObject.toString());
+ // }
+ // HomeController controller = new HomeController();
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Parameter2");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ webserver.sendMessage(jsonObject.toString());
-//
-// String[] values6 = { ".x1 ","x2 ","x3",";;x4","x5","x6","x7","x8","x9","x10","x11"};
-// List<String> paramlist = new ArrayList<>(Arrays.asList(values6));
-// Short[] values1 = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1};
-// List<Short> data = new ArrayList<>(Arrays.asList(values1));
-// Boolean[] value4 = { false, false, false, false, false, false, false, false, false,
-// false};
-// List<Boolean> data2 = new ArrayList<>(Arrays.asList(value4));
-// String[] values3 = { ".x11 ","x21 "};
-// List<String> data3 = new ArrayList<>(Arrays.asList(values3));
-// Short[] values4 = { 2,2,3,4};
-// List<Short> data4 = new ArrayList<>(Arrays.asList(values4));
-//
-//
-// JSONObject jsonObject = new JSONObject();
-// short[] params = new short[data2.size()];
-// for (int i = 0; i < data2.size(); i++) {
-// boolean value = data2.get(i);
-// params[i] = value ? (short) 1 : (short) 0;
-// }
-////
-// 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;
-// }
- //boolean杞负0 1
- short[] params = customS7Control.convertBooleanListToShortArray(data2);
- short[] anniuparams = customS7Control.convertBooleanListToShortArray(anniuread);
- JSONObject jsonObject = new JSONObject();
- jsonObject.append("params", params);
- jsonObject.append("params", paramlist);
- jsonObject.append("params", data);
- jsonObject.append("params", data3);
- jsonObject.append("params", data4);
- jsonObject.append("jiting", anniuparams);
- jsonObject.append("timeout", readtimeout);
+ if (webserver != null) {
+ List<String> messages = webserver.getMessages();
-// WebSocketServer sendwServer = WebSocketServer.getWebSocketServer("Parameter2");
-// if (sendwServer != null) {
-// JSONObject jsonObject = new JSONObject();
-// jsonObject.set("message", "Hello, Parameter2!");
-// sendwServer.sendMessage(jsonObject.toString());
-// }
-// HomeController controller = new HomeController();
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Parameter2");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ String lastMessage = messages.get(messages.size() - 1);
+ // System.out.println("lastMessage锛�" + lastMessage);
+ JSONArray messageArray = new JSONArray(lastMessage);
+ // 娓呴櫎ID
+ // customS7Control.writeBitToPLC(messageArray, addressList0, 0);
- webserver.sendMessage(jsonObject.toString());
+ try {
+ // 妫�鏌ョ储寮曟槸鍚︽湁鏁�
+ if (messageArray.getJSONArray(0).size() > 0) {
+ // 鑾峰彇娑堟伅鏁扮粍
+ JSONArray jsonArray = messageArray.getJSONArray(0);
+ // 鍒涘缓涓�涓竷灏斿�煎垪琛�
+ List<Boolean> sValue = new ArrayList<>();
+ // 閬嶅巻娑堟伅鏁扮粍
+ for (int i = 0; i < jsonArray.size(); i++) {
+ // 鑾峰彇娑堟伅鏁扮粍涓殑鍊�
+ Object value = jsonArray.get(i);
+ // 妫�鏌ュ�兼槸鍚︽湁鏁�
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ // 绉婚櫎闈炴暟瀛楀拰鏁板瓧瀛楃
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ // 瑙f瀽涓哄竷灏斿��
+ boolean val = "1".equals(cleanedValue.trim());
+ // 灏嗗竷灏斿�兼坊鍔犲埌甯冨皵鍊煎垪琛ㄤ腑
+ sValue.add(val);
+ System.out.println(
+ "messageValue: " + Arrays.asList(val)
+ + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ // 瀹屾垚鍑虹墖
+ boolean containsOne = data.stream().anyMatch(number -> number == 1);
+ for (int i = 1; i <= 5; i++) {
+ boolean value = sValue.get(i);
+ String id = paramlist.get(i);
+ // 鍒ゆ柇鏄惁鑷姩鐘舵��
+ if (!containsOne) {
+ // 鍒ゆ柇id鏄惁鍖呭惈鏁板瓧
+ if (id.matches(".*\\d.*")) {
+ // 鍒ゆ柇娓呴櫎id鏄惁true
+ if (value) {
+ System.out.println(id);
+ switch (i) {
+ case 1:
+ storageCageService.UpdateTask(2, 0, paramlist.get(i));
+ break;
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ storageCageService.UpdateTask(3, 0, paramlist.get(i));
+ break;
+ default:
+ // 澶勭悊绱㈠紩鍊间笉鍦ㄨ寖鍥村唴鐨勬儏鍐�
+ break;
+ }
+ }
+ }
- if (webserver != null) {
+ // 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
+ if (!sValue.isEmpty()) {
- 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);
- //娓呴櫎ID
- // customS7Control.writeBitToPLC(messageArray, addressList0, 0);
-
-
- try {
- // 妫�鏌ョ储寮曟槸鍚︽湁鏁�
- if (messageArray.getJSONArray(0).size() > 0) {
- // 鑾峰彇娑堟伅鏁扮粍
- JSONArray jsonArray = messageArray.getJSONArray(0);
- // 鍒涘缓涓�涓竷灏斿�煎垪琛�
- List<Boolean> sValue = new ArrayList<>();
- // 閬嶅巻娑堟伅鏁扮粍
- for (int i = 0; i < jsonArray.size(); i++) {
- // 鑾峰彇娑堟伅鏁扮粍涓殑鍊�
- Object value = jsonArray.get(i);
- // 妫�鏌ュ�兼槸鍚︽湁鏁�
- if (value != null && !value.toString().equals("null")) {
- try {
- // 绉婚櫎闈炴暟瀛楀拰鏁板瓧瀛楃
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- // 瑙f瀽涓哄竷灏斿��
- boolean val = "1".equals(cleanedValue.trim());
- // 灏嗗竷灏斿�兼坊鍔犲埌甯冨皵鍊煎垪琛ㄤ腑
- sValue.add(val);
- System.out.println("messageValue: " + Arrays.asList(val) + " added to the list");
-
-
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
+ // 璋冪敤 S7control.getinstance().WriteBit 鏂规硶灏嗗竷灏斿�煎垪琛ㄥ啓鍏ュ湴鍧�鍒楄〃
+ S7control.getinstance().WriteBit(addressList0, sValue);
+ System.out
+ .println("Values " + sValue + " written to PLC at address "
+ + addressList0);
+ }
}
}
}
-//瀹屾垚鍑虹墖
- boolean containsOne = data.stream().anyMatch(number -> number == 1);
- for (int i = 1; i <= 5; i++) {
- boolean value = sValue.get(i);
- String id = paramlist.get(i);
- //鍒ゆ柇鏄惁鑷姩鐘舵��
- if (!containsOne) {
- //鍒ゆ柇id鏄惁鍖呭惈鏁板瓧
- if (id.matches(".*\\d.*")) {
- //鍒ゆ柇娓呴櫎id鏄惁true
- if (value) {
- System.out.println(id);
- switch (i) {
- case 1:
- storageCageService.UpdateTask(2, 0, paramlist.get(i));
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- storageCageService.UpdateTask(3, 0, paramlist.get(i));
- break;
- default:
- // 澶勭悊绱㈠紩鍊间笉鍦ㄨ寖鍥村唴鐨勬儏鍐�
- break;
- }
+ } catch (Exception e) {
+ System.err.println("An error occurred while writing bit to PLC: " + e.getMessage());
+ }
+
+ // 鎬ュ仠
+ // customS7Control.writeBitToPLC(messageArray, niuanaddressList3, 1);
+
+ try {
+ // 妫�鏌ョ储寮曟槸鍚︽湁鏁�
+ if (messageArray.getJSONArray(1).size() > 0) {
+ // 鑾峰彇娑堟伅鏁扮粍
+ JSONArray jsonArray = messageArray.getJSONArray(1);
+ // 鍒涘缓涓�涓竷灏斿�煎垪琛�
+ List<Boolean> sValue = new ArrayList<>();
+ // 閬嶅巻娑堟伅鏁扮粍
+ for (int i = 0; i < jsonArray.size(); i++) {
+ // 鑾峰彇娑堟伅鏁扮粍涓殑鍊�
+ Object value = jsonArray.get(i);
+ // 妫�鏌ュ�兼槸鍚︽湁鏁�
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ // 绉婚櫎闈炴暟瀛楀拰鏁板瓧瀛楃
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ // 瑙f瀽涓哄竷灏斿��
+ boolean val = "1".equals(cleanedValue.trim());
+ // 灏嗗竷灏斿�兼坊鍔犲埌甯冨皵鍊煎垪琛ㄤ腑
+ sValue.add(val);
+ System.out.println(
+ "messageValue: " + Arrays.asList(val)
+ + " added to the list");
+
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
}
}
+ }
+ // 缁堟杩涚墖浠诲姟
+ boolean Value1 = sValue.get(0);
+ boolean Value2 = sValue.get(1);
+ if (Value1) {
+ storageCageService.EndTask(0);
+ }
+ if (Value2) {
+ storageCageService.EndTask(1);
+
+ }
// 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
if (!sValue.isEmpty()) {
// 璋冪敤 S7control.getinstance().WriteBit 鏂规硶灏嗗竷灏斿�煎垪琛ㄥ啓鍏ュ湴鍧�鍒楄〃
- S7control.getinstance().WriteBit(addressList0, sValue);
- System.out.println("Values " + sValue + " written to PLC at address " + addressList0);
- }
+ S7control.getinstance().WriteBit(niuanaddressList3, sValue);
+ System.out.println(
+ "Values " + sValue + " written to PLC at address "
+ + niuanaddressList3);
}
}
+ } catch (Exception e) {
+ System.err.println("An error occurred while writing bit to PLC: " + e.getMessage());
}
- } catch (Exception e) {
- System.err.println("An error occurred while writing bit to PLC: " + e.getMessage());
+
+ // 瀛樼墖绛夊緟寤惰繜
+ customS7Control.Writetime(messageArray, timeout2, 2);
+
+ // 娓呯┖娑堟伅鍒楄〃
+ webserver.clearMessages();
}
-
-
- //鎬ュ仠
-// customS7Control.writeBitToPLC(messageArray, niuanaddressList3, 1);
-
- try {
- // 妫�鏌ョ储寮曟槸鍚︽湁鏁�
- if (messageArray.getJSONArray(1).size() > 0) {
- // 鑾峰彇娑堟伅鏁扮粍
- JSONArray jsonArray = messageArray.getJSONArray(1);
- // 鍒涘缓涓�涓竷灏斿�煎垪琛�
- List<Boolean> sValue = new ArrayList<>();
- // 閬嶅巻娑堟伅鏁扮粍
- for (int i = 0; i < jsonArray.size(); i++) {
- // 鑾峰彇娑堟伅鏁扮粍涓殑鍊�
- Object value = jsonArray.get(i);
- // 妫�鏌ュ�兼槸鍚︽湁鏁�
- if (value != null && !value.toString().equals("null")) {
- try {
- // 绉婚櫎闈炴暟瀛楀拰鏁板瓧瀛楃
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- // 瑙f瀽涓哄竷灏斿��
- boolean val = "1".equals(cleanedValue.trim());
- // 灏嗗竷灏斿�兼坊鍔犲埌甯冨皵鍊煎垪琛ㄤ腑
- sValue.add(val);
- System.out.println("messageValue: " + Arrays.asList(val) + " added to the list");
-
-
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
-// 缁堟杩涚墖浠诲姟
- boolean Value1 = sValue.get(0);
- boolean Value2 = sValue.get(1);
-
- if (Value1) {
- storageCageService.EndTask(0);
-
- }
- if (Value2) {
- storageCageService.EndTask(1);
-
- }
- // 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
- if (!sValue.isEmpty()) {
-
- // 璋冪敤 S7control.getinstance().WriteBit 鏂规硶灏嗗竷灏斿�煎垪琛ㄥ啓鍏ュ湴鍧�鍒楄〃
- S7control.getinstance().WriteBit(niuanaddressList3, sValue);
- System.out.println("Values " + sValue + " written to PLC at address " + niuanaddressList3);
- }
- }
- } catch (Exception e) {
- System.err.println("An error occurred while writing bit to PLC: " + e.getMessage());
- }
-
-
- //瀛樼墖绛夊緟寤惰繜
- customS7Control.Writetime(messageArray, timeout2, 2);
-
-
- // 娓呯┖娑堟伅鍒楄〃
- webserver.clearMessages();
}
}
}
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
+
}
}
}
-
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java
index 4b2c56f..82a5217 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java
@@ -24,31 +24,25 @@
// 鍒涘缓涓�涓嚜瀹氫箟鐨� S7 鎺у埗鍣ㄦ秷鎭鐞嗗櫒瀵硅薄
MessageHandler customS7Control = new MessageHandler();
-
public PlcPositioning1() throws IOException {
config = new Configuration("config.properties");
}
+
@Override
public void run() {
while (this != null) {
try {
Thread.sleep(1000);
-
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
-
- // System.out.println(stt);
- //瀛樼墖鏍� 鍑虹墖鏍艰鍙�
+ // System.out.println(stt);
+ // 瀛樼墖鏍� 鍑虹墖鏍艰鍙�
String address = config.getProperty("PlcPositioning1.address");
- List<Short> arraylist = S7control.getinstance().ReadWord(address, 33);
-// System.out.println(arraylist);
+ List<Short> arraylist = S7control.getinstance().ReadWord(address, 33);
+ // System.out.println(arraylist);
-
-// Short[] values1 = {1,1,1, 1,2, 3, 4, 5, 6, 7, 8, 9, 10,11, 12,13,14,15,16,17,18,19,20,11, 12,13,14,15,16,17,18,19,20 };
-// List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+ // Short[] values1 = {1,1,1, 1,2, 3, 4, 5, 6, 7, 8, 9, 10,11,
+ // 12,13,14,15,16,17,18,19,20,11, 12,13,14,15,16,17,18,19,20 };
+ // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
List<Short> arraylist5 = S7control.getinstance().ReadWord("DB106.0", 1);
List<Short> arraylist6 = S7control.getinstance().ReadWord("DB106.12", 1);
List<Short> arraylist7 = S7control.getinstance().ReadWord("DB106.40", 1);
@@ -58,17 +52,16 @@
arraylist5.addAll(arraylist8);
JSONObject jsonObject = new JSONObject();
-
jsonObject.append("params", arraylist);
jsonObject.append("shishi1", arraylist5);
+ // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Positioning1");
+ // if (sendwServer != null) {
+ // sendwServer.sendMessage(jsonObject.toString());
+ // }
-// WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Positioning1");
-// if (sendwServer != null) {
-// sendwServer.sendMessage(jsonObject.toString());
-// }
-
-// WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Positioning1");
+ // WebSocketServer webSocketServer =
+ // WebSocketServer.sessionMap.get("Positioning1");
ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Positioning1");
if (sendwServer != null) {
for (WebSocketServer webserver : sendwServer) {
@@ -76,13 +69,12 @@
if (webserver != null) {
List<String> messages = webserver.getMessages();
- //瀛樼墖鏍� 鍑虹墖鏍煎湴鍧�
-
+ // 瀛樼墖鏍� 鍑虹墖鏍煎湴鍧�
if (!messages.isEmpty()) {
// 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
String lastMessage = messages.get(messages.size() - 1);
-// System.out.println("lastMessage锛�" + lastMessage);
+ // System.out.println("lastMessage锛�" + lastMessage);
JSONArray messageArray = new JSONArray(lastMessage);
// 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
@@ -104,11 +96,11 @@
}
}
-
- // 鍐欏叆瀛樼墖鏍� 鍑虹墖鏍间綅缃瀹氭暟鎹�
+ // 鍐欏叆瀛樼墖鏍� 鍑虹墖鏍间綅缃瀹氭暟鎹�
if (!mergedList.isEmpty()) {
S7control.getinstance().WriteWord(address, mergedList);
- System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + address);
+ System.out.println(
+ "messageValue锛�" + mergedList + " written to PLC at address " + address);
}
// 娓呯┖娑堟伅鍒楄〃
@@ -117,8 +109,12 @@
}
}
-
}
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+
}
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
index e393f1c..facf708 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
@@ -12,19 +12,17 @@
public class PlcServoManualone extends Thread {
-
// 鐢ㄤ簬瀛樺偍搴旂敤绋嬪簭鐨勯厤缃俊鎭�
private Configuration config;
// 鍒涘缓涓�涓嚜瀹氫箟鐨� S7 鎺у埗鍣ㄦ秷鎭鐞嗗櫒瀵硅薄
MessageHandler customS7Control = new MessageHandler();
-
public PlcServoManualone() throws IOException {
config = new Configuration("config.properties");
}
- //灏嗗竷灏斿垪琛ㄨ浆鎹负浜岃繘鍒剁殑 short 鏁扮粍
+ // 灏嗗竷灏斿垪琛ㄨ浆鎹负浜岃繘鍒剁殑 short 鏁扮粍
public static class PLCBooleanConverter {
public static short[] convertListsToBinaryShortArray(List<Boolean>... lists) {
@@ -52,7 +50,7 @@
}
}
- //璇诲彇id
+ // 璇诲彇id
public StringBuilder queGlassid(String address, int count) {
StringBuilder writedstrIdOut = new StringBuilder();
byte[] writedglassidbytesOut = S7control.getinstance().ReadByte(address, count);
@@ -65,234 +63,220 @@
return writedstrIdOut;
}
-
@Override
public void run() {
while (this != null) {
try {
Thread.sleep(1000);
+ // A01缁勫悎涓湴鍧�琛ㄩ泦鍚�
+ List<String> addresses = Arrays.asList(config.getProperty("A01.addresses").split(","));
+ // System.out.println(addresses);
+ List<Short> arraylist = S7control.getinstance().readWords(addresses);
+
+ // A02缁勫悎涓湴鍧�琛ㄩ泦鍚�
+ List<String> addresses2 = Arrays.asList(config.getProperty("A02.addresses").split(","));
+ List<Short> arraylist2 = S7control.getinstance().readWords(addresses2);
+
+ // A01缈昏浆鍦板潃
+ List<String> addresses3 = Arrays.asList(config.getProperty("A01.flipAddress"));
+ List<Short> arraylist3 = S7control.getinstance().readWords(addresses3);
+
+ // A02缈昏浆鍦板潃
+ List<String> addresses4 = Arrays.asList(config.getProperty("A02.flipAddress"));
+
+ List<Short> arraylist4 = S7control.getinstance().readWords(addresses4);
+ // B01缁勫悎涓湴鍧�
+ String b01Address = config.getProperty("B01.address");
+ List<Short> arraylist5 = S7control.getinstance().ReadWord(b01Address, 2);
+ // B02缁勫悎鍦板潃
+ String b02Address = config.getProperty("B02.address");
+ List<Short> arraylist6 = S7control.getinstance().ReadWord(b02Address, 2);
+ // System.out.println(b02Address);
+ // 鎵�鏈夋晠闅滄寜閽湴鍧�
+ List<String> addresses7 = Arrays.asList(config.getProperty("faultButtonAddresses").split(","));
+ List<Boolean> arraylist7 = S7control.getinstance().readBits(addresses7);
+
+ // A01鍚姩鍦板潃
+ List<String> A01start = Arrays.asList(config.getProperty("A01start"));
+ // A02鍚姩鍦板潃
+ List<String> A02start = Arrays.asList(config.getProperty("A02start"));
+ // A01鍗婅嚜鍔ㄥ湴鍧�
+ List<String> A01Bstart = Arrays.asList(config.getProperty("A01Bstart"));
+ // A02鍗婅嚜鍔ㄥ湴鍧�
+ List<String> A02Bstart = Arrays.asList(config.getProperty("A02Bstart"));
+ //
+ List<String> abortresumeTasks = Arrays.asList(config.getProperty("abortresumeTasks"));
+ // 鍥為浂鎸夐挳鍦板潃
+ List<String> waddresses4 = Arrays.asList(config.getProperty("HomedButtonAddresses").split(","));
+ // 鎵�鏈夊浣嶆寜閽湴鍧�
+ List<String> Reset = Arrays.asList(config.getProperty("resetButtonAddresses").split(","));
+ // System.out.println(Reset);
+ // 鎵�鏈夋湭鍥為浂鎸夐挳鍦板潃
+ List<String> addresses8 = Arrays.asList(config.getProperty("notHomedButtonAddresses").split(","));
+ // 杩涚墖id鍦板潃
+ String inputGlassIdAddress = config.getProperty("inputGlassIdAddress");
+ String outputGlassIdAddress = config.getProperty("outputGlassIdAddress");
+ StringBuilder queueid1 = queGlassid(inputGlassIdAddress, 14);
+ // 瀛樼墖id鍦板潃
+ StringBuilder queueid2 = queGlassid(outputGlassIdAddress, 14);
+ // A01 A02鍚姩 鍗婅嚜鍔ㄥ惎鍔�
+ List<Boolean> A01readstart = S7control.getinstance().readBits(A01start);
+ List<Boolean> A02readstart = S7control.getinstance().readBits(A02start);
+ List<Boolean> A01readBstart = S7control.getinstance().readBits(A01Bstart);
+ List<Boolean> A02readsBtart = S7control.getinstance().readBits(A02Bstart);
+
+ List<Boolean> resumeTasks = S7control.getinstance().readBits(abortresumeTasks);
+
+ short[] combinedBinaryShortArray = PLCBooleanConverter.convertListsToBinaryShortArray(
+ A01readBstart, A01readstart, A02readsBtart, A02readstart);
+
+ // 鍥為浂鍦板潃
+
+ List<Boolean> readhuiling = S7control.getinstance().readBits(waddresses4);
+ short[] huiling7 = PlcManualonePosition.PLCBooleanConverter.convertListsToBinaryShortArray(readhuiling);
+
+ // System.out.println(A01readBstart);
+
+ // 鎵�鏈夋晠闅滄寜閽浆鎹负1鍜�0
+ short[] params2 = new short[arraylist7.size()];
+ for (int i = 0; i < arraylist7.size(); i++) {
+ boolean value = arraylist7.get(i);
+ params2[i] = value ? (short) 1 : (short) 0;
+ }
+
+ // 鎬ュ仠涓鎸夐挳
+ short[] resumeTask = new short[resumeTasks.size()];
+ for (int i = 0; i < resumeTasks.size(); i++) {
+ boolean value = resumeTasks.get(i);
+ resumeTask[i] = value ? (short) 1 : (short) 0;
+ }
+
+ List<Boolean> Reset1 = S7control.getinstance().readBits(Reset);
+ // System.out.println(Reset1);
+ // 鎵�鏈夋晠闅滄寜閽浆鎹负1鍜�0
+ short[] rReset = new short[Reset1.size()];
+ for (int i = 0; i < Reset1.size(); i++) {
+ boolean value = Reset1.get(i);
+ rReset[i] = value ? (short) 1 : (short) 0;
+ }
+
+ // 鎵�鏈夋湭鍥為浂鎸夐挳杞崲涓�1鍜�0
+ List<Boolean> arraylist8 = S7control.getinstance().readBits(addresses8);
+ short[] params = new short[arraylist8.size()];
+ for (int i = 0; i < arraylist8.size(); i++) {
+ boolean value = arraylist8.get(i);
+ params[i] = value ? (short) 1 : (short) 0;
+ }
+
+ // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7};
+ // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+ // Short[] values2 = { 1, 2, 3, 4, 5};
+ // List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2));
+ //
+ // Short[] values3 = {1};
+ // List<Short> arraylist3 = new ArrayList<>(Arrays.asList(values3));
+ // Short[] values4 = {2};
+ // List<Short> arraylist4 = new ArrayList<>(Arrays.asList(values4));
+ // Short[] values5 = {3,3};
+ // List<Short> arraylist5 = new ArrayList<>(Arrays.asList(values5));
+ // Short[] values6 = { 4,4};
+ // List<Short> arraylist6 = new ArrayList<>(Arrays.asList(values6));
+ // Boolean[] values7 = { false, true, true, true, true, true};
+ // List<Boolean> arraylist7 = new ArrayList<>(Arrays.asList(values7));
+ // Boolean[] values8 = { false, true, true, true, true, true};
+ // List<Boolean> arraylist8 = new ArrayList<>(Arrays.asList(values8));
+ //
+ // String queueid1 = "x1234567890123";
+ // String queueid2 = "x1234567890123";
+ //
+ // short[] params2 = new short[arraylist7.size()];
+ // for (int i = 0; i < arraylist7.size(); i++) {
+ // boolean value = arraylist7.get(i);
+ // params2[i] = value ? (short) 1 : (short) 0;
+ // }
+ //
+ //
+ // short[] params = new short[arraylist8.size()];
+ // for (int i = 0; i < arraylist8.size(); i++) {
+ // boolean value = arraylist8.get(i);
+ // params[i] = value ? (short) 1 : (short) 0;
+ // }
+
+ JSONObject jsonObject = new JSONObject();
+
+ jsonObject.append("zuhe1", arraylist);
+ jsonObject.append("zuhe2", arraylist2);
+ jsonObject.append("zuhe3", arraylist3);
+ jsonObject.append("zuhe4", arraylist4);
+ jsonObject.append("zuhe5", arraylist5);
+ jsonObject.append("zuhe6", arraylist6);
+ jsonObject.append("guzhang", params2);
+ jsonObject.append("weihuiling", params);
+ jsonObject.append("jinpianid", queueid1);
+ jsonObject.append("qupianid", queueid2);
+ jsonObject.append("fuwei", rReset);
+ jsonObject.append("qidong", combinedBinaryShortArray);
+ jsonObject.append("huiling", huiling7);
+
+ jsonObject.append("resumeTasks", resumeTask);
+
+ // WebSocketServer sendwServer =
+ // WebSocketServer.sessionMap.get("ServoManualone");
+ // if (sendwServer != null) {
+ // sendwServer.sendMessage(jsonObject.toString());
+ // }
+
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("ServoManualone");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ webserver.sendMessage(jsonObject.toString());
+
+ if (webserver != null) {
+ List<String> messages = webserver.getMessages();
+
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+ String lastMessage = messages.get(messages.size() - 1);
+ // System.out.println("lastMessage锛�" + lastMessage);
+ JSONArray messageArray = new JSONArray(lastMessage);
+
+ // 鍐欏叆AO1缁勫悎
+ customS7Control.WriteWordToPLC(messageArray, addresses, 0);
+
+ // 鍐欏叆AO2缁勫悎
+ customS7Control.WriteWordToPLC(messageArray, addresses2, 1);
+
+ // 澶嶄綅鎸夐挳鍐欏叆
+ customS7Control.writeBitToPLC(messageArray, Reset, 2);
+
+ // 鍥為浂鎸夐挳鍐欏叆
+ customS7Control.writeBitToPLC(messageArray, waddresses4, 3);
+
+ // 杩涚墖ID鍐欏叆
+ customS7Control.writeStringToPLC(messageArray, inputGlassIdAddress, 4);
+ // 鍙栫墖ID鍐欏叆
+ customS7Control.writeStringToPLC(messageArray, outputGlassIdAddress, 5);
+
+ // A01鍗婅嚜鍔�
+ customS7Control.writeBitToPLC(messageArray, A01Bstart, 6);
+ // A02鍗婅嚜鍔�
+ customS7Control.writeBitToPLC(messageArray, A02Bstart, 7);
+ // A01鍗婅嚜鍔ㄥ惎鍔�
+ customS7Control.writeBitToPLC(messageArray, A01start, 8);
+ // A02鍗婅嚜鍔ㄥ惎鍔�
+ customS7Control.writeBitToPLC(messageArray, A02start, 9);
+
+ // 娓呯┖娑堟伅鍒楄〃
+ webserver.clearMessages();
+ }
+ }
+ }
+ }
} catch (InterruptedException e) {
e.printStackTrace();
}
-
-//A01缁勫悎涓湴鍧�琛ㄩ泦鍚�
- List<String> addresses = Arrays.asList(config.getProperty("A01.addresses").split(","));
- //System.out.println(addresses);
-
- List<Short> arraylist = S7control.getinstance().readWords(addresses);
-
-//A02缁勫悎涓湴鍧�琛ㄩ泦鍚�
- List<String> addresses2 = Arrays.asList(config.getProperty("A02.addresses").split(","));
- List<Short> arraylist2 = S7control.getinstance().readWords(addresses2);
-
- //A01缈昏浆鍦板潃
- List<String> addresses3 = Arrays.asList(config.getProperty("A01.flipAddress"));
- List<Short> arraylist3 = S7control.getinstance().readWords(addresses3);
-
- //A02缈昏浆鍦板潃
- List<String> addresses4 = Arrays.asList(config.getProperty("A02.flipAddress"));
-
- List<Short> arraylist4 = S7control.getinstance().readWords(addresses4);
- //B01缁勫悎涓湴鍧�
- String b01Address = config.getProperty("B01.address");
- List<Short> arraylist5 = S7control.getinstance().ReadWord(b01Address, 2);
- //B02缁勫悎鍦板潃
- String b02Address = config.getProperty("B02.address");
- List<Short> arraylist6 = S7control.getinstance().ReadWord(b02Address, 2);
-// System.out.println(b02Address);
- // 鎵�鏈夋晠闅滄寜閽湴鍧�
- List<String> addresses7 = Arrays.asList(config.getProperty("faultButtonAddresses").split(","));
- List<Boolean> arraylist7 = S7control.getinstance().readBits(addresses7);
-
- //A01鍚姩鍦板潃
- List<String> A01start = Arrays.asList(config.getProperty("A01start"));
- //A02鍚姩鍦板潃
- List<String> A02start = Arrays.asList(config.getProperty("A02start"));
-//A01鍗婅嚜鍔ㄥ湴鍧�
- List<String> A01Bstart = Arrays.asList(config.getProperty("A01Bstart"));
- //A02鍗婅嚜鍔ㄥ湴鍧�
- List<String> A02Bstart = Arrays.asList(config.getProperty("A02Bstart"));
- //
- List<String> abortresumeTasks = Arrays.asList(config.getProperty("abortresumeTasks"));
- //鍥為浂鎸夐挳鍦板潃
- List<String> waddresses4 = Arrays.asList(config.getProperty("HomedButtonAddresses").split(","));
- // 鎵�鏈夊浣嶆寜閽湴鍧�
- List<String> Reset = Arrays.asList(config.getProperty("resetButtonAddresses").split(","));
-// System.out.println(Reset);
- // 鎵�鏈夋湭鍥為浂鎸夐挳鍦板潃
- List<String> addresses8 = Arrays.asList(config.getProperty("notHomedButtonAddresses").split(","));
- // 杩涚墖id鍦板潃
- String inputGlassIdAddress = config.getProperty("inputGlassIdAddress");
- String outputGlassIdAddress = config.getProperty("outputGlassIdAddress");
- StringBuilder queueid1 = queGlassid(inputGlassIdAddress, 14);
- // 瀛樼墖id鍦板潃
- StringBuilder queueid2 = queGlassid(outputGlassIdAddress, 14);
-//A01 A02鍚姩 鍗婅嚜鍔ㄥ惎鍔�
- List<Boolean> A01readstart = S7control.getinstance().readBits(A01start);
- List<Boolean> A02readstart = S7control.getinstance().readBits(A02start);
- List<Boolean> A01readBstart = S7control.getinstance().readBits(A01Bstart);
- List<Boolean> A02readsBtart = S7control.getinstance().readBits(A02Bstart);
-
- List<Boolean> resumeTasks = S7control.getinstance().readBits(abortresumeTasks);
-
- short[] combinedBinaryShortArray = PLCBooleanConverter.convertListsToBinaryShortArray(
- A01readBstart, A01readstart, A02readsBtart, A02readstart
- );
-
-
- // 鍥為浂鍦板潃
-
- List<Boolean> readhuiling = S7control.getinstance().readBits(waddresses4);
- short[] huiling7 = PlcManualonePosition.PLCBooleanConverter.convertListsToBinaryShortArray(readhuiling);
-
-// System.out.println(A01readBstart);
-
-// 鎵�鏈夋晠闅滄寜閽浆鎹负1鍜�0
- short[] params2 = new short[arraylist7.size()];
- for (int i = 0; i < arraylist7.size(); i++) {
- boolean value = arraylist7.get(i);
- params2[i] = value ? (short) 1 : (short) 0;
- }
-
-//鎬ュ仠涓鎸夐挳
- short[] resumeTask = new short[resumeTasks.size()];
- for (int i = 0; i < resumeTasks.size(); i++) {
- boolean value = resumeTasks.get(i);
- resumeTask[i] = value ? (short) 1 : (short) 0;
- }
-
- List<Boolean> Reset1 = S7control.getinstance().readBits(Reset);
- // System.out.println(Reset1);
-// 鎵�鏈夋晠闅滄寜閽浆鎹负1鍜�0
- short[] rReset = new short[Reset1.size()];
- for (int i = 0; i < Reset1.size(); i++) {
- boolean value = Reset1.get(i);
- rReset[i] = value ? (short) 1 : (short) 0;
- }
-
-
-//鎵�鏈夋湭鍥為浂鎸夐挳杞崲涓�1鍜�0
- List<Boolean> arraylist8 = S7control.getinstance().readBits(addresses8);
- short[] params = new short[arraylist8.size()];
- for (int i = 0; i < arraylist8.size(); i++) {
- boolean value = arraylist8.get(i);
- params[i] = value ? (short) 1 : (short) 0;
- }
-
-
-// Short[] values1 = { 1, 2, 3, 4, 5, 6, 7};
-// List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
-// Short[] values2 = { 1, 2, 3, 4, 5};
-// List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2));
-//
-// Short[] values3 = {1};
-// List<Short> arraylist3 = new ArrayList<>(Arrays.asList(values3));
-// Short[] values4 = {2};
-// List<Short> arraylist4 = new ArrayList<>(Arrays.asList(values4));
-// Short[] values5 = {3,3};
-// List<Short> arraylist5 = new ArrayList<>(Arrays.asList(values5));
-// Short[] values6 = { 4,4};
-// List<Short> arraylist6 = new ArrayList<>(Arrays.asList(values6));
-// Boolean[] values7 = { false, true, true, true, true, true};
-// List<Boolean> arraylist7 = new ArrayList<>(Arrays.asList(values7));
-// Boolean[] values8 = { false, true, true, true, true, true};
-// List<Boolean> arraylist8 = new ArrayList<>(Arrays.asList(values8));
-//
-// String queueid1 = "x1234567890123";
-// String queueid2 = "x1234567890123";
-//
-// short[] params2 = new short[arraylist7.size()];
-// for (int i = 0; i < arraylist7.size(); i++) {
-// boolean value = arraylist7.get(i);
-// params2[i] = value ? (short) 1 : (short) 0;
-// }
-//
-//
-// short[] params = new short[arraylist8.size()];
-// for (int i = 0; i < arraylist8.size(); i++) {
-// boolean value = arraylist8.get(i);
-// params[i] = value ? (short) 1 : (short) 0;
-// }
-
- JSONObject jsonObject = new JSONObject();
-
- jsonObject.append("zuhe1", arraylist);
- jsonObject.append("zuhe2", arraylist2);
- jsonObject.append("zuhe3", arraylist3);
- jsonObject.append("zuhe4", arraylist4);
- jsonObject.append("zuhe5", arraylist5);
- jsonObject.append("zuhe6", arraylist6);
- jsonObject.append("guzhang", params2);
- jsonObject.append("weihuiling", params);
- jsonObject.append("jinpianid", queueid1);
- jsonObject.append("qupianid", queueid2);
- jsonObject.append("fuwei", rReset);
- jsonObject.append("qidong", combinedBinaryShortArray);
- jsonObject.append("huiling", huiling7);
-
- jsonObject.append("resumeTasks", resumeTask);
-
-
-// WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ServoManualone");
-// if (sendwServer != null) {
-// sendwServer.sendMessage(jsonObject.toString());
-// }
-
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("ServoManualone");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- webserver.sendMessage(jsonObject.toString());
-
-
- if (webserver != null) {
- List<String> messages = webserver.getMessages();
-
-
- if (!messages.isEmpty()) {
- // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
- String lastMessage = messages.get(messages.size() - 1);
-// System.out.println("lastMessage锛�" + lastMessage);
- JSONArray messageArray = new JSONArray(lastMessage);
-
-
- // 鍐欏叆AO1缁勫悎
- customS7Control.WriteWordToPLC(messageArray, addresses, 0);
-
-
- // 鍐欏叆AO2缁勫悎
- customS7Control.WriteWordToPLC(messageArray, addresses2, 1);
-
-
- // 澶嶄綅鎸夐挳鍐欏叆
- customS7Control.writeBitToPLC(messageArray, Reset, 2);
-
- //鍥為浂鎸夐挳鍐欏叆
- customS7Control.writeBitToPLC(messageArray, waddresses4, 3);
-
- // 杩涚墖ID鍐欏叆
- customS7Control.writeStringToPLC(messageArray, inputGlassIdAddress, 4);
- //鍙栫墖ID鍐欏叆
- customS7Control.writeStringToPLC(messageArray, outputGlassIdAddress, 5);
-
- //A01鍗婅嚜鍔�
- customS7Control.writeBitToPLC(messageArray, A01Bstart, 6);
- //A02鍗婅嚜鍔�
- customS7Control.writeBitToPLC(messageArray, A02Bstart, 7);
- //A01鍗婅嚜鍔ㄥ惎鍔�
- customS7Control.writeBitToPLC(messageArray, A01start, 8);
- //A02鍗婅嚜鍔ㄥ惎鍔�
- customS7Control.writeBitToPLC(messageArray, A02start, 9);
-
-
-
- // 娓呯┖娑堟伅鍒楄〃
- webserver.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 6989dec..ddfdf88 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
@@ -78,11 +78,7 @@
while (this != null) {
try {
Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- this.readValue();
+ this.readValue();
String PlcAddress = this.name;
Integer Plccount = this.count;
@@ -141,7 +137,10 @@
}
}
}
- }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
- }
+ }
+ }
+}
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 f7eff5d..f294138 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
@@ -12,6 +12,8 @@
import java.util.Map;
import com.example.springboot.service.*;
+
+import org.apache.ibatis.annotations.Result;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.entity.Glass;
@@ -51,6 +53,8 @@
public static Boolean FeedState = false;
+ public static StringBuilder feedglassid;
+
// public Plchome() throws IOException {
// config = new Configuration("config.properties");
// }
@@ -61,11 +65,9 @@
public void run() {
while (this != null) {
JSONObject jsonObject = new JSONObject();
+ jsonObject.append("feedglassid", feedglassid);
try {
Thread.sleep(1000);
-
- String s1=S7controlalbia.getinstance().readStrings("DB14.38");
- String s2=S7controlalbia.getinstance().readStrings("DB14.40");
// 娉ㄥ叆mapper
homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
@@ -219,7 +221,7 @@
// }
// // 鑾峰彇閾濇idDB106.DBW64锛屾坊鍔犲埌鍑虹墖闃熷垪
// String frameno="X21763329601FB";
- String frameno = spianService.queGlassid("DB103.270", 14).toString();
+ String frameno = spianService.queGlassid("DB103.270", 11).toString();
if (!frameno.equals(Plchome.FrameNo)) {
Plchome.FrameNo = frameno;
try {
@@ -274,13 +276,17 @@
boolean D01ResponseState = D01respnse.contains((short) 1);
// jsonObject.append("D01RequestState", D01RequestState);
// 鑷姩杩涚墖
- isConfirm = true;
if (isConfirm == true && form3.getglassId() != null && form3.getglassId() != "") {
- if ((form3.getglassheight() < 380 || form3.getglasswidth() < 390
- || form3.getglassheight() > 1810
- || form3.getglasswidth() > 2760)
- || (form3.getglassheight() < 390 || form3.getglasswidth() < 380
- || form3.getglassheight() > 2760 || form3.getglasswidth() > 1810)) {
+ double width = 0;
+ double height = 0;
+ if (form3.getglassheight() < form3.getglasswidth()) {
+ height = form3.getglassheight();
+ width = form3.getglasswidth();
+ } else {
+ height = form3.getglasswidth();
+ width = form3.getglassheight();
+ }
+ if (height < 380 || width < 380 || height > 1810 || width > 2760) {
FeedState = true;
jsonObject.append("FeedState", FeedState);
FeedState = false;
@@ -290,41 +296,39 @@
}
}
}
-
}
+ boolean dbconnected = false;
+ try {
+ dbserve.getConn();
+ dbconnected = true;
+ } catch (Exception e) {
+ // TODO: handle exception
+ dbconnected = false;
+ }
+ jsonObject.append("dbconnected", dbconnected);
+ // jsonObject.append("params", new short[] { 30, 40, });
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Home");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ webserver.sendMessage(jsonObject.toString());
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ if (webserver != null) {
- boolean dbconnected = false;
- try {
- dbserve.getConn();
- dbconnected = true;
- } catch (Exception e) {
- // TODO: handle exception
- dbconnected = false;
- }
- jsonObject.append("dbconnected", dbconnected);
- // jsonObject.append("params", new short[] { 30, 40, });
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Home");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- webserver.sendMessage(jsonObject.toString());
+ List<String> messages = webserver.getMessages();
- if (webserver != null) {
+ if (!messages.isEmpty()) {
+ // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ webserver.clearMessages();
+ }
- List<String> messages = webserver.getMessages();
-
- if (!messages.isEmpty()) {
- // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
- webserver.clearMessages();
}
}
-
}
+ } catch (InterruptedException | SQLException e) {
+ e.printStackTrace();
}
+
}
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlchomeNew.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlchomeNew.java
index 3b03f97..eb48bf8 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlchomeNew.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlchomeNew.java
@@ -368,6 +368,9 @@
} catch (InterruptedException e) {
e.printStackTrace();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
boolean dbconnected = false;
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plclog.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plclog.java
index 3a312ca..e42ef08 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plclog.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plclog.java
@@ -15,11 +15,7 @@
while (this != null) {
try {
Thread.sleep(10);
- } catch (InterruptedException e) {
- // \\ TODO Auto-generated catch block
- e.printStackTrace();
- }
- spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
+ spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
StringBuilder B01glassid = spianService.queGlassid("DB103.184", 14);// BO1鐨勭幓鐠僫d
StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02鐨勭幓鐠僫d
@@ -42,6 +38,11 @@
}
b02 = B02backs;
}
+ } catch (InterruptedException e) {
+ // \\ TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
}
}
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 8329678..d436dbd 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
@@ -61,52 +61,53 @@
while (this != null) {
try {
Thread.sleep(1000);
+ // 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", 112);
+
+ // 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());
+ // }
+
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Sign");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ webserver.sendMessage(jsonObject.toString());
+ }
+ }
+ }
} catch (InterruptedException e) {
e.printStackTrace();
}
-// 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", 112);
-
-// 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());
-// }
-
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Sign");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- webserver.sendMessage(jsonObject.toString());
- }
- }
- }
}
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
index cf362da..b5aafb4 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
@@ -61,41 +61,41 @@
while (this != null) {
try {
Thread.sleep(1000);
+ // this.readValue();
+ // String PlcAddress = this.name;
+ // Integer Plccount = this.count;
+ // System.out.println(PlcAddress);
+
+ // 璇诲彇鐘舵�佹暟鎹�
+ List<Short> plclist = S7control.getinstance().ReadWord("DB103.0", 44);
+ // Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0,
+ // 1, 0, };
+ // List<Short> plclist = new ArrayList<>(Arrays.asList(values));
+ if (plclist != null) {
+
+ List<String> Intlist = new ArrayList<>();
+ for (Short value : plclist) {
+ Intlist.add(value == 1 ? "AUTO" : "Manual");
+
+ }
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.append("sta", Intlist);
+ // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("State");
+ // if (sendwServer != null) {
+ // sendwServer.sendMessage(jsonObject.toString());
+ // }
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("State");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ webserver.sendMessage(jsonObject.toString());
+ }
+ }
+
+ }
} catch (InterruptedException e) {
e.printStackTrace();
}
-// this.readValue();
-// String PlcAddress = this.name;
-// Integer Plccount = this.count;
- // System.out.println(PlcAddress);
-
- //璇诲彇鐘舵�佹暟鎹�
-List<Short> plclist = S7control.getinstance().ReadWord("DB103.0", 44);
-// Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0,
-// 1, 0, };
-// List<Short> plclist = new ArrayList<>(Arrays.asList(values));
- if (plclist != null) {
-
- List<String> Intlist = new ArrayList<>();
- for (Short value : plclist) {
- Intlist.add(value == 1 ? "AUTO" : "Manual");
-
- }
- JSONObject jsonObject = new JSONObject();
- jsonObject.append("sta", Intlist);
-// WebSocketServer sendwServer = WebSocketServer.sessionMap.get("State");
-// if (sendwServer != null) {
-// sendwServer.sendMessage(jsonObject.toString());
-// }
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("State");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- webserver.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 7e8087e..d15d033 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,27 +17,19 @@
//
System.out.println("鍚姩瀹屾垚");
- new PlcHold().start();
- // new PLCAutoMes().start();
-
- // new Plchome().start();
- // new PlcLayout().start();
- // new Plcalarm().start();
-
- // new Plcsign().start();
-
- // new Plcstate().start();
- // new PlcPositioning1().start();
-
- // new PlcParameter2().start();
- // new PLCAutomaticParameterSetting().start();
-
- // new PlcManualonePosition().start();
- // new PlcManualonePosition2().start();
- // new PlcServoManualone().start();
- // new PLCManualJog().start();
- // new Plclog().start();
-
-
+ new PlcHold().start();
+ new Plchome().start();
+ new PlcLayout().start();
+ new Plcalarm().start();
+ new Plcsign().start();
+ new Plcstate().start();
+ new PlcPositioning1().start();
+ new PlcParameter2().start();
+ new PLCAutomaticParameterSetting().start();
+ new PlcManualonePosition().start();
+ new PlcManualonePosition2().start();
+ new PlcServoManualone().start();
+ new PLCManualJog().start();
+ new PlcInteractionState().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 7a28788..8dbb53f 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
@@ -181,7 +181,7 @@
north_glass_buffer1 north_glass_buffer1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(glassid, "", "");
String flip = jdbcConnections.SelectFlipByFrameBarcode(north_glass_buffer1.getFrameBarcode());
- if (flip != null) {
+ if (flip != null&&flip != "") {
String position = jdbcConnections.SelectPositionByFrameBarcode(north_glass_buffer1.getFrameBarcode());
if (position != null) {
String framelength = jdbcConnections.SelectFrameLengthByFrameBarcode(north_glass_buffer1.getFrameBarcode());
@@ -274,7 +274,7 @@
// 鎵嬪姩娣诲姞鎵爜浣嶇幓鐠�
@PostMapping("/InsertQueueGlassId")
- public Result InsertQueueGlassId(Short id, @RequestBody Queue queue) {
+ public Result InsertQueueGlassId(Short id, @RequestBody Queue queue) throws SQLException {
return storageCageService.InsertQueueGlassId(id, queue);
}
@@ -329,6 +329,7 @@
// public Result AddOutSliceS(@RequestBody String[][] AluminumFrames) throws
// SQLException {
north_Glass_Buffer1Service.AddOutSliceS(FrameNo);
+ Plchome.AluminumFrame = null;
Map<String, Object> map = new HashMap<>();
map.put("message", "200");
return Result.success(map);
@@ -363,7 +364,7 @@
return Result.success(map);
}
- // 淇敼鍑虹墖闃熷垪鐘舵�佷笌鍑虹墖闃熷垪璋冨簭
+ // 淇槸鍚﹂渶瑕佺‘璁�
@PostMapping("/isConfirmStates")
public Result isConfirmStates(Boolean isConfirmStates) {
Plchome.isConfirm = isConfirmStates;
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java
deleted file mode 100644
index 0968120..0000000
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.example.springboot.controller;
-
-import com.example.springboot.mapper.SpianMapper;
-import com.example.springboot.service.SpianService;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-
-@RestController
-@RequestMapping("/spian")
-
-
-public class SpianController {
-
- @Autowired
- SpianMapper spianMapper;
- @Autowired
- SpianService spianservice;
- //鍑虹墖浠诲姟
-@GetMapping("/all2")
- public void selectdd(String orderid){
- SpianService service=new SpianService();
- service.selectout2(orderid);
-
-}
-
- @GetMapping("/all")
- //杩涚墖浠诲姟,浼犺鍗昳d
- //鎸夎鍗曚紭鍏堣繘鐗�
- public void selectAll(Short glassid){
- SpianService service=new SpianService();
- service.selectAll(Short.toString(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 b005c0a..b72ecf4 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
@@ -12,8 +12,8 @@
public interface SpianMapper {
// 鍒ゆ柇鐩搁偦绗煎瓙鏄惁鏈夌┖鏍�
- @Select("select COUNT(if(a.state1=0,cell,0))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) and disabled=0 GROUP BY cage ORDER BY cell desc LIMIT 1")
- int selectCage(int cage1);
+ @Select("select COUNT(if(a.state1=0,cell,0))as cell from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1 or a.cage=#{cage1})and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) and disabled=0 GROUP BY cage ORDER BY cell desc LIMIT 1")
+ StorageCage selectCage(int cage1);
// 鑾峰彇绗煎瓙鍙疯鍗曞彿鎺掑簭鐨勭┖璁㈠崟绗煎瓙
@Select("select a.cage,FrameBarcode,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1,max(a.state)as state2,disabled,FrameBarcode from storage_cage a left join (select COUNT(*)shu,cage from storage_cage where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c on a.cage=c.cage where (order_id=#{orderids} or ''='') and a.disabled=0 GROUP BY cage,cell HAVING state1=0 ORDER BY shu desc,shu2,state2 asc,cage asc;")
List<StorageCage> selectAll(String orderids,String Fbarcode);
@@ -79,7 +79,7 @@
void UpdataAddCage(String orderid, String glassid, double width, int cage, int cell, int id, int state);
@Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthmm},glassheight=#{glass.glassheightmm},glasswidthmm=#{glass.glasslength},glassheightmm=#{glass.glassheight},listid=#{glass.listnumber},boxid=#{glass.boxnumber},FrameBarcode=#{glass.frameBarcode} where id=#{id};")
- void UpdataAddCage2(String orderid, String glassid, north_glass_buffer1 glass, int cage, int cell, int id,int state);
+ void UpdataAddCage2(String orderid, String glassid, north_glass_buffer1 glass, int cage, int cell, int id,int state,Double widths);
// 淇敼绗煎瓙淇℃伅(澶氱墖杩涚墖)
@Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where cage=#{cage} and cell=#{cell} and tier=#{tier};")
@@ -100,6 +100,9 @@
// 璋冩嫧鏇存崲绗煎瓙淇℃伅
@Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=#{tier})as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=2,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid,a.FrameBarcode=b.FrameBarcode where a.id=#{id1}")
void UpdateDBCage(int id1, int cage, int cell, int tier);
+ // 杩涚墖鏇存崲绗煎瓙淇℃伅
+ @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 UpdateDBCageAdd(int id1, int cage, int cell, int tier);
// @Insert("insert into user(name, date, address, user_no) values (#{name},
// #{date}, #{address}, #{userNo})")
@@ -133,8 +136,8 @@
north_glass_buffer1 SelectDBOut();
// 鏍规嵁绗煎瓙鏍煎瓙灞傛暟鑾峰彇鐜荤拑id
- @Select("select glass_id from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;")
- String SelectGlassid(int cage, int cell);
+ @Select("select glass_id,glasswidth from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;")
+ StorageCage SelectGlassid(int cage, int cell);
// 鍒ゆ柇鏈夊嚑鍧楃幓鐠冭繕鍦ㄥ嚭鐗囦腑
@Select("SELECT COUNT(*) FROM `storage_cage` where state=3;")
@@ -231,7 +234,7 @@
int SelectCageTask(int state,int cage1,int cage2);
//鍒ゆ柇鐜荤拑鏄惁绂佺敤
@Select(" select disabled from storage_cage where glass_id=#{glassid} limit 1;")
- int SelectCageGlassState(String glassid);
+ StorageCage SelectCageGlassState(String glassid);
//鍒ゆ柇姹囨姤鐨刬d鏄惁姝g‘
@Select("SELECT count(*) FROM `storage_cage` where state!=0 and glass_id=#{glassid}")
int SelectHB(String glassid);
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java b/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java
index 1688d29..ff51d9e 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java
@@ -23,17 +23,17 @@
private static final String USERNAME = "root";
private static final String PASSWORD = "beibo.123/";
- private static Connection conn = null;
+ private static Connection conns = null;
private static PreparedStatement ps = null;
- private static ResultSet rs = null;
+ private static ResultSet rss = null;
public north_glass_buffer1 selectGlass(int glassid) throws SQLException {
- conn = getConn();
+ Connection conn = getConn();
north_glass_buffer1 glass=new north_glass_buffer1();
String sql = "select ordernumber from north_glass_buffer1 where glassid=?";
ps = conn.prepareStatement(sql);
ps.setInt(1, glassid);
- rs= ps.executeQuery();
+ ResultSet rs= ps.executeQuery();
while (rs.next()) {
glass.setordernumber(rs.getString("ordernumber"));
}
@@ -42,14 +42,14 @@
}
public north_glass_buffer1 SelectGlassByGlassIdOrderIdFrameId(String glassid,String orderid,String frameid) throws SQLException {
- conn = getConn();
+ Connection conn = getConn();
north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
String sql = "select * from north_glass_buffer1 where barcode=? or ordernumber=? or FrameBarcode=?";
ps = conn.prepareStatement(sql);
ps.setString(1, glassid);
ps.setString(2, orderid);
ps.setString(3, frameid);
- rs= ps.executeQuery();
+ ResultSet rs= ps.executeQuery();
while (rs.next()) {
north_glass_buffer1s.setId(rs.getInt("Id"));
north_glass_buffer1s.setordernumber(rs.getString("ordernumber"));
@@ -66,19 +66,49 @@
north_glass_buffer1s.setdatecreated(rs.getString("datecreated"));
north_glass_buffer1s.setFrameBarcode(rs.getString("FrameBarcode"));
}
- // conn.close();
+ conn.close();
return north_glass_buffer1s;
}
+
+ public north_glass_buffer1 SelectGlassByGlassIdOrderIdFrameIdplchold(String glassid,String orderid,String frameid) throws SQLException {
+ Connection conn = getConn();
+ north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
+ String sql = "select * from north_glass_buffer1 where barcode=? or ordernumber=? or FrameBarcode=?";
+ ps = conn.prepareStatement(sql);
+ ps.setString(1, glassid);
+ ps.setString(2, orderid);
+ ps.setString(3, frameid);
+ ResultSet rs= ps.executeQuery();
+ while (rs.next()) {
+ north_glass_buffer1s.setId(rs.getInt("Id"));
+ north_glass_buffer1s.setordernumber(rs.getString("ordernumber"));
+ north_glass_buffer1s.setlistnumber(rs.getString("listnumber"));
+ north_glass_buffer1s.setboxnumber(rs.getString("boxnumber"));
+ north_glass_buffer1s.setbarcode(rs.getString("barcode"));
+ north_glass_buffer1s.setglasslength(rs.getDouble("glasslength"));
+ north_glass_buffer1s.setglassheight(rs.getDouble("glassheight"));
+ north_glass_buffer1s.setglasslengthmm(rs.getDouble("glasslength_mm"));
+ north_glass_buffer1s.setglassheightmm(rs.getDouble("glassheight_mm"));
+ north_glass_buffer1s.setitemtype(rs.getString("itemtype"));
+ north_glass_buffer1s.setslotnumber(rs.getString("slotnumber"));
+ north_glass_buffer1s.setdatemodified(rs.getString("datemodified"));
+ north_glass_buffer1s.setdatecreated(rs.getString("datecreated"));
+ north_glass_buffer1s.setFrameBarcode(rs.getString("FrameBarcode"));
+ }
+ conn.close();
+ return north_glass_buffer1s;
+ }
+
//鏍规嵁鐜荤拑id锛岃鍗昳d锛岄摑妗唅d鏌ヨ瀹㈡埛鐜荤拑淇℃伅
public Queue SelectGlassByGlassIdOrderIdFrameIdQueue(String glassid,String orderid,String frameid) throws SQLException {
- conn = getConn();
+ Connection conn = getConn();
Queue queue=new Queue();
String sql = "select * from north_glass_buffer1 where barcode=? or ordernumber=? or FrameBarcode=?";
ps = conn.prepareStatement(sql);
ps.setString(1, glassid);
ps.setString(2, orderid);
ps.setString(3, frameid);
- rs= ps.executeQuery();
+ ResultSet rs= ps.executeQuery();
while (rs.next()) {
queue.setid(rs.getInt("Id"));
queue.setorderId(rs.getString("ordernumber"));
@@ -103,7 +133,7 @@
//鏍规嵁鐜荤拑id锛岃鍗昳d锛岄摑妗唅d鏌ヨ瀹㈡埛鐜荤拑淇℃伅
public List<north_glass_buffer1> SelectGlassByGlassIdOrderIdFrameIds(String glassid,String orderid,String frameid) throws SQLException {
- conn = getConn();
+ Connection conn = getConn();
// north_glass_buffer1 glass=new north_glass_buffer1();
List<north_glass_buffer1> glass=new ArrayList<north_glass_buffer1>();
String sql = "select * from north_glass_buffer1 where position(? in barcode) and position(? in ordernumber) and position(? in FrameBarcode)";
@@ -111,7 +141,7 @@
ps.setString(1, glassid);
ps.setString(2, orderid);
ps.setString(3, frameid);
- rs= ps.executeQuery();
+ ResultSet rs= ps.executeQuery();
while (rs.next()) {
north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
@@ -140,13 +170,13 @@
//鏍规嵁閾濇id鏌ヨ瀹㈡埛鐜荤拑淇℃伅
public List<north_glass_buffer1> SelectGlassByGlassIdOrderIdFrameIdss(String frameid) throws SQLException {
- conn = getConn();
+ Connection conn = getConn();
// north_glass_buffer1 glass=new north_glass_buffer1();
List<north_glass_buffer1> glass=new ArrayList<north_glass_buffer1>();
String sql = "select * from north_glass_buffer1 where FrameBarcode=?";
ps = conn.prepareStatement(sql);
ps.setString(1, frameid);
- rs= ps.executeQuery();
+ ResultSet rs= ps.executeQuery();
while (rs.next()) {
north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
@@ -175,13 +205,13 @@
//鏍规嵁閾濇id鏌ヨl閾濇鏄惁缈昏浆
public String SelectFlipByFrameBarcode(String frameBarcode) throws SQLException {
- conn = getConn();
+ Connection conn = getConn();
// north_glass_buffer1 glass=new north_glass_buffer1();
String flip="";
String sql1 = "select * from north_glass_buffer1_frames where Barcode=? limit 1";
ps = conn.prepareStatement(sql1);
ps.setString(1, frameBarcode);
- rs= ps.executeQuery();
+ ResultSet rs= ps.executeQuery();
while (rs.next()) {
flip=rs.getString("Flip");
@@ -191,15 +221,15 @@
}
//鏍规嵁閾濇id鏌ヨ鏄惁閾濇鎽嗘斁
public String SelectPositionByFrameBarcode(String frameBarcode) throws SQLException {
- conn = getConn();
+ Connection conn = getConn();
// north_glass_buffer1 glass=new north_glass_buffer1();
String position="";
String sql1 = "select * from north_glass_buffer1_frames where Barcode=? limit 1";
ps = conn.prepareStatement(sql1);
ps.setString(1, frameBarcode);
- rs= ps.executeQuery();
+ ResultSet rs= ps.executeQuery();
while (rs.next()) {
- position=rs.getString("position");
+ position=rs.getString("flip");
}
conn.close();
return position;
@@ -207,13 +237,13 @@
//鏍规嵁閾濇id鏌ヨ閾濇瀹�
public String SelectFrameLengthByFrameBarcode(String frameBarcode) throws SQLException {
- conn = getConn();
+ Connection conn = getConn();
// north_glass_buffer1 glass=new north_glass_buffer1();
String position="";
String sql1 = "select * from north_glass_buffer1_frames where Barcode=? limit 1";
ps = conn.prepareStatement(sql1);
ps.setString(1, frameBarcode);
- rs= ps.executeQuery();
+ ResultSet rs= ps.executeQuery();
while (rs.next()) {
position=rs.getString("framelength");
}
@@ -223,13 +253,13 @@
//鏍规嵁閾濇id鏌ヨ閾濇楂�
public String SelectFrameHeightByFrameBarcode(String frameBarcode) throws SQLException {
- conn = getConn();
+ Connection conn = getConn();
// north_glass_buffer1 glass=new north_glass_buffer1();
String position="";
String sql1 = "select * from north_glass_buffer1_frames where Barcode=? limit 1";
ps = conn.prepareStatement(sql1);
ps.setString(1, frameBarcode);
- rs= ps.executeQuery();
+ ResultSet rs= ps.executeQuery();
while (rs.next()) {
position=rs.getString("frameheight");
}
@@ -257,6 +287,7 @@
public static Connection getConn() throws SQLException {
Connection conn = null;
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/canadames?serverTimezone=GMT%2B8&characterEncoding=utf-8", "root", "beibo.123/");
+ // conn = DriverManager.getConnection("jdbc:mysql://192.168.102.9:3306/production?serverTimezone=GMT%2B8&characterEncoding=utf-8", "northglass", "n0rthgla55");
return conn;
}
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 4ebe6e8..359567d 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
@@ -97,7 +97,6 @@
}
}
homeMapper.DeleteByGlassID(glassid);
-
}
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 baf7fa9..2fb7429 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
@@ -7,6 +7,7 @@
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
+import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,15 +18,16 @@
import com.example.springboot.mapper.SpianMapper;
import com.google.common.primitives.Bytes;
-
@Service
public class SpianService {
@Autowired
private SpianMapper spianMapper;
-
+ public static List<String> result=new ArrayList<String>();
// @GetMapping("/all")
public Short selectAll(north_glass_buffer1 glasslist) {
-
+ try {
+
+
int cage1 = 0;
int cells;
int ids;
@@ -34,17 +36,23 @@
int prctier;
double width;
double minwidth = 0;
-
- //north_glass_buffer1 glasslist = spianMapper.selectGlass(glassid); // 鑾峰彇鐜荤拑鍙傛暟
+ double widths;
+ // north_glass_buffer1 glasslist = spianMapper.selectGlass(glassid); // 鑾峰彇鐜荤拑鍙傛暟
// 濡傛灉娌℃湁姝d鏃�
if (glasslist == null) {
return (300);
}
+ if(glasslist.getglasslengthmm()>glasslist.getglassheightmm()) {
+ widths= glasslist.getglasslengthmm();
+ }else{
+ widths= glasslist.getglassheightmm();
+ }
+ // Map result=new HashMap();
+
- double widths = glasslist.getglasslengthmm();
String orderids = glasslist.getordernumber();
String FrameBarcode = glasslist.getFrameBarcode();
- String glassid=glasslist.getbarcode();
+ String glassid = glasslist.getbarcode();
List<String> adddresslist = new ArrayList<>();
adddresslist.add("DB105.0");// 杩涚墖杞﹁捣濮嬩綅缃�
adddresslist.add("DB105.2");// 杩涚墖杞︾洰鏍囦綅缃�
@@ -70,10 +78,10 @@
// 淇濆瓨璁㈠崟浼樺厛椤哄簭绗煎瓙鍙�
cage1 = storageCage2.getCage();
// 鍒ゆ柇璇ョ瀛愬彿鐩搁偦鏈�澶х殑绌烘牸鏁�
- int cages = spianMapper.selectCage(cage1);
+ StorageCage cages = spianMapper.selectCage(cage1);
// 濡傛灉鐩搁偦绗煎瓙娌℃湁绌烘牸,鎴栬�呮湁姝e湪鎵ц鐨勫嚭鐗囦换鍔℃椂杩斿洖400
- if (cages == 0) {
+ if (cages == null) {
return (400);
}
StorageCage cages1;
@@ -86,13 +94,13 @@
}
// 鍒ゆ柇閫変腑绗煎瓙鏄惁鏈夊悎閫傚搴︾┖鏍�
// 鏈夊悎閫傜┖鏍兼椂杩涚墖
- if (cages1 != null && cages >= 1 && storageCage2.getDisabled() == 0) {
+ if (cages1 != null && cages.getCell() >= 1 && storageCage2.getDisabled() == 0) {
ids = cages1.getId();// 鏁版嵁搴揑D
tiers = cages1.getTier();// 鍐呭鐗�
cells = cages1.getCell();// 鏍煎瓙鍙�
prcid = cages1.getPrcId();// 浼犵粰prc鐨勭洰鏍囧湴id
width = cages1.getWidth();// 鏍煎瓙鍓╀綑瀹藉害
- widths = glasslist.getglasslengthmm();
+
// 鎵ц杩涚墖
datas.add((short) 1000);// 璧峰浣嶇疆
@@ -103,54 +111,66 @@
// 鑾峰彇璇ユ牸瀛愬唴鏄惁鏈夌幓鐠�
int cellint = spianMapper.selectcell(cage1, cells);
if (cellint == 1) {
- // 灏嗗鐗囩幓鐠冪殑鏁版嵁鏇存柊鍒板唴鐗�
- spianMapper.UpdateDBCage(ids, cage1, cells, 1);
- // 灏嗘柊鍏ョ殑鐜荤拑瀛樺叆澶栫墖
-
- spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1, cells, ids - 1, 2);
- spianMapper.UpdataAddCage1(widths, cage1, cells);// 鍑忓皯鏍煎瓙瀹藉害
-
+ result.add("杩涚墖浠诲姟|feedstart1:" + datas+ LocalDateTime.now());
+ outmesid(glassid, "DB105.20");
S7control.getinstance().WriteWord(adddresslist, datas);
boolean qidong = listbool("DB105.16");
int qidong2 = 0;
if (qidong == true) {
qidong2 = 1;
- }else{
+ } else {
while (qidong) {
S7control.getinstance().WriteWord("DB105.16", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
qidong = listbool("DB105.16");
}
}
- spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(), prctier,qidong2);// 鏂板浠诲姟
- System.out.println("杩涚墖浠诲姟|" + datas);
+ // 灏嗗鐗囩幓鐠冪殑鏁版嵁鏇存柊鍒板唴鐗�
+ spianMapper.UpdateDBCageAdd(ids, cage1, cells, 1);
+ // 灏嗘柊鍏ョ殑鐜荤拑瀛樺叆澶栫墖
+ spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1, cells, ids - 1, 2,widths);
+ spianMapper.UpdataAddCage1(widths, cage1, cells);// 鍑忓皯鏍煎瓙瀹藉害
+ spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(), prctier, qidong2);// 鏂板浠诲姟
+ result.add("杩涚墖浠诲姟|feedend1" + datas+ LocalDateTime.now());
+
} else {
// 鏁版嵁搴撲慨鏀圭瀛愯〃鏂板涓�鏉$幓鐠�
-
- spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1, cells, ids, 2);
- spianMapper.UpdataAddCage1(widths, cage1, cells);// 鍑忓皯鏍煎瓙瀹藉害
-
- S7control.getinstance().WriteWord(adddresslist, datas);
+ result.add("杩涚墖浠诲姟|feedstart2" + datas+ LocalDateTime.now());
+ outmesid(glassid, "DB105.20");
+ S7control.getinstance().WriteWord(adddresslist, datas);
boolean qidong = listbool("DB105.16");
int qidong2 = 0;
if (qidong == true) {
qidong2 = 1;
+ } else {
+ while (qidong) {
+ S7control.getinstance().WriteWord("DB105.16", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
+ qidong = listbool("DB105.16");
+ }
}
- spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(), prctier,qidong2);// 鏂板浠诲姟
- System.out.println("杩涚墖浠诲姟|" + datas);
+ spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1, cells, ids, 2,widths);
+ spianMapper.UpdataAddCage1(widths, cage1, cells);// 鍑忓皯鏍煎瓙瀹藉害
+ spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(), prctier, qidong2);// 鏂板浠诲姟
+ result.add("杩涚墖浠诲姟|feedend2" + datas+ LocalDateTime.now());
}
- outmesid(glassid, "DB105.20");
+
return (200);
}
}
return (400);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return (500);
+ // TODO: handle exception
+ }
}
public Short selectout2(String glassid) {
+ try {
// 瀹氫箟PRC鏁版嵁浼犻�佹暟缁�
List<String> adddresslist = new ArrayList<>();
char[] a = glassid.toCharArray();
@@ -189,14 +209,14 @@
spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
spianMapper.UpdataGlassCageState(glassid.toString(), 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
- System.out.println("鍑虹墖浠诲姟|" + datas);
+ result.add("鍑虹墖浠诲姟|outstart1" + datas+ LocalDateTime.now());
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
- S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
+ //S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
boolean qidong = listbool("DB105.18");
int qidong2 = 0;
if (qidong == true) {
qidong2 = 1;
- }else{
+ } else {
while (qidong) {
S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
qidong = listbool("DB105.18");
@@ -204,7 +224,7 @@
}
spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, state, qidong2);// 鏂板浠诲姟
outmesid(glassid, "DB105.34");// 娲惧彂鍑虹墖ID
-
+ result.add("鍑虹墖浠诲姟|outend1" + datas+ LocalDateTime.now());
return (200);// 缁撴潫
} else {
// 鑾峰彇鏍煎瓙鐨勭幓鐠冩暟閲�
@@ -216,26 +236,25 @@
datas.add((short) 1000);
datas.add((short) 1);
datas.add((short) 1);
- spianMapper.OverOutSlice(glassid.toString(), 1, 0);// 鏇存柊鍑虹墖闃熷垪浠诲姟鐘舵�佷负杩涜涓�
-
- spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCageState(glassid, 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
-
- System.out.println("鍑虹墖浠诲姟|" + datas);
+ result.add("鍑虹墖浠诲姟|outstart2" + datas+ LocalDateTime.now());
outmesid(glassid, "DB105.34");// 娲惧彂鍑虹墖ID
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
- S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
+ //S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
boolean qidong = listbool("DB105.18");
int qidong2 = 0;
if (qidong == true) {
qidong2 = 1;
- }else{
+ } else {
while (qidong) {
S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
qidong = listbool("DB105.18");
}
}
+ spianMapper.OverOutSlice(glassid.toString(), 1, 0);// 鏇存柊鍑虹墖闃熷垪浠诲姟鐘舵�佷负杩涜涓�
+ spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
+ spianMapper.UpdataGlassCageState(glassid, 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, 1, qidong2);// 鏂板浠诲姟
+ result.add("鍑虹墖浠诲姟|outend2" + datas+ LocalDateTime.now());
return (200);// 缁撴潫
} else {
@@ -257,29 +276,29 @@
datas.add((short) 2);
datas.add((short) 1);
// 鏇存崲鐜荤拑鐨勭瀛�
- String glassids = spianMapper.SelectGlassid(cage, cell); // 鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
- spianMapper.UpdataGlassCageState(glassids, 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
- spianMapper.UpdateDBCage(ids, cage, cell, 2);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
- spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 鍑忓皯鏂版牸瀛愬搴�
- spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
- // 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- System.out.println("鍑虹墖浠诲姟|" + datas);
- S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
- S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
- outmesid(glassids, "DB105.34");// 娲惧彂璋冩嫧鐜荤拑ID
+ StorageCage glassids = spianMapper.SelectGlassid(cage, cell); // 鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
+ // 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
+ result.add("鍑虹墖浠诲姟|outstart3" + datas+ LocalDateTime.now());
+ outmesid(glassids.getGlassId(), "DB105.34");// 娲惧彂璋冩嫧鐜荤拑ID
+ S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
+ //S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
boolean qidong = listbool("DB105.18");
int qidong2 = 0;
if (qidong == true) {
qidong2 = 1;
- }else{
+ } else {
while (qidong) {
S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
qidong = listbool("DB105.18");
}
}
- spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassids, 2, qidong2);// 鏂板璋冨害浠诲姟
-
+ spianMapper.UpdataGlassCageState(glassids.getGlassId(), 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
+ spianMapper.UpdateDBCage(ids, cage, cell, 2);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
+ spianMapper.UpdataAddCage1(glassids.getGlassWidth(), cages, cells);// 鍑忓皯鏂版牸瀛愬搴�
+ spianMapper.UpdataOutCage1(glassids.getGlassWidth(), cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
+ spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassids.getGlassId(), 2, qidong2);// 鏂板璋冨害浠诲姟
+ result.add("鍑虹墖浠诲姟|outend3" + datas+ LocalDateTime.now());
return (200); // 缁撴潫
} else {// 绗煎瓙鍙峰ぇ浜�5鏃�
@@ -297,39 +316,45 @@
datas.add((short) prcid2);
datas.add((short) 2);
datas.add((short) 1);
- String glassids = spianMapper.SelectGlassid(cage, cell); // 鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
+ StorageCage glassids = spianMapper.SelectGlassid(cage, cell); // 鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
- System.out.println("鍑虹墖浠诲姟|" + datas);
+ result.add("鍑虹墖浠诲姟|outstart4" + datas+ LocalDateTime.now());
+ outmesid(glassids.getGlassId(), "DB105.34");// 娲惧彂璋冩嫧鐜荤拑ID
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
- S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
-
- outmesid(glassids, "DB105.34");// 娲惧彂璋冩嫧鐜荤拑ID
- spianMapper.UpdataGlassCageState(glassids, 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
+ //S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
boolean qidong = listbool("DB105.18");
int qidong2 = 2;
if (qidong == true) {
qidong2 = 1;
- }else{
+ } else {
while (qidong) {
S7control.getinstance().WriteWord("DB105.18", (short) 1);// 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
qidong = listbool("DB105.18");
}
}
- spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassids, 2, qidong2);// 鏂板璋冨害浠诲姟
+ spianMapper.UpdataGlassCageState(glassids.getGlassId(), 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
spianMapper.UpdateDBCage(ids, cage, cell, 2);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
- spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 鍑忓皯鏂版牸瀛愬搴�
- spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
-
+ spianMapper.UpdataAddCage1(glassids.getGlassWidth(), cages, cells);// 鍑忓皯鏂版牸瀛愬搴�
+ spianMapper.UpdataOutCage1(glassids.getGlassWidth(), cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
+ spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassids.getGlassId(), 2, qidong2);// 鏂板璋冨害浠诲姟
+ result.add("鍑虹墖浠诲姟|outend4" + datas+ LocalDateTime.now());
return (200);// 缁撴潫
}
}
}
-
+ } catch (Exception e) {
+ e.printStackTrace();
+ return (500);
+ // TODO: handle exception
}
+}
// 娲惧彂浠诲姟鐜荤拑id
public void outmesid(String glassid, String address) {
+ try {
+
+
// System.out.println("outmesid:" + glassid);
List<Byte> glassidlist = new ArrayList();
char ds[] = glassid.toCharArray();
@@ -339,7 +364,9 @@
byte[] bytes = Bytes.toArray(glassidlist);
System.out.println("outmesidbytes:" + bytes.length);
S7control.getinstance().WriteByte(address, bytes);// 娲惧彂鍑虹墖id
-
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
// 鑾峰彇鍦板潃鍐呯殑鐜荤拑id杞瓧绗︿覆
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java b/springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java
deleted file mode 100644
index a584239..0000000
--- a/springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java
+++ /dev/null
@@ -1,321 +0,0 @@
-package com.example.springboot.service;
-
-
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.example.springboot.component.PLCAutoMes;
-import com.example.springboot.component.S7control;
-import com.example.springboot.entity.StorageCage;
-import com.example.springboot.entity.north_glass_buffer1;
-import com.example.springboot.entity.device.PlcParameterObject;
-import com.example.springboot.mapper.SpianMapper;
-import com.google.common.primitives.Bytes;
-
-
-@Service
-public class SpianServiceNew {
- @Autowired
- private SpianMapper spianMapper;
-
- // @GetMapping("/all")
- public Short selectAll(String glassid) {
- //璇诲彇DB105鍖烘枃浠�
- PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
- //璇�106
- PlcParameterObject plcread=PLCAutoMes.PlcReadObject;
- int cage1 = 0;
- int cells;
- int ids;
- int prcid;
- int tiers;
- int prctier;
- double width;
- double minwidth = 0;
-
- north_glass_buffer1 glasslist = spianMapper.selectGlass(glassid); // 鑾峰彇鐜荤拑鍙傛暟
- // 濡傛灉娌℃湁姝d鏃�
- if (glasslist == null) {
- return (300);
- }
-
- double widths = glasslist.getglasslengthmm();
- String orderids = glasslist.getordernumber();
- String FrameBarcode = glasslist.getFrameBarcode();
- // 鑾峰彇閾濇鐩稿叧搴︽渶楂樼殑绗煎瓙鎺掑簭
- List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode, widths, 400);
- // 鍒ゆ柇閾濇鎸囧畾绌烘牸鏄惁闇�瑕侀棿闅旂┖闂�
- if (storageCage.size() == 0) {
- storageCage = spianMapper.selectAll(orderids, FrameBarcode);
- }
- if (storageCage == null) {
- return (400);
- }
- for (StorageCage storageCage2 : storageCage) {
- // 淇濆瓨璁㈠崟浼樺厛椤哄簭绗煎瓙鍙�
- cage1 = storageCage2.getCage();
- // 鍒ゆ柇璇ョ瀛愬彿鐩搁偦鏈�澶х殑绌烘牸鏁�
- int cages = spianMapper.selectCage(cage1);
-
- // 濡傛灉鐩搁偦绗煎瓙娌℃湁绌烘牸,鎴栬�呮湁姝e湪鎵ц鐨勫嚭鐗囦换鍔℃椂杩斿洖400
- if (cages == 0) {
- return (400);
- }
- 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);
- }
- // 鍒ゆ柇閫変腑绗煎瓙鏄惁鏈夊悎閫傚搴︾┖鏍�
- // 鏈夊悎閫傜┖鏍兼椂杩涚墖
- if (cages1 != null && cages >= 1 && storageCage2.getDisabled() == 0) {
- ids = cages1.getId();// 鏁版嵁搴揑D
- tiers = cages1.getTier();// 鍐呭鐗�
- cells = cages1.getCell();// 鏍煎瓙鍙�
- prcid = cages1.getPrcId();// 浼犵粰prc鐨勭洰鏍囧湴id
- width = cages1.getWidth();// 鏍煎瓙鍓╀綑瀹藉害
- widths = glasslist.getglasslengthmm();
-
- // 鎵ц杩涚墖
-
- // 鑾峰彇璇ユ牸瀛愬唴鏄惁鏈夌幓鐠�
- int cellint = spianMapper.selectcell(cage1, cells);
- if (cellint == 1) {
- // 灏嗗鐗囩幓鐠冪殑鏁版嵁鏇存柊鍒板唴鐗�
- spianMapper.UpdateDBCage(ids, cage1, cells, 1);
- // 灏嗘柊鍏ョ殑鐜荤拑瀛樺叆澶栫墖
- spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1, cells, ids - 1, 2);
- spianMapper.UpdataAddCage1(widths, cage1, cells);// 鍑忓皯鏍煎瓙瀹藉害
- } else {
- // 鏁版嵁搴撲慨鏀圭瀛愯〃鏂板涓�鏉$幓鐠�
- spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1, cells, ids, 2);
- spianMapper.UpdataAddCage1(widths, cage1, cells);// 鍑忓皯鏍煎瓙瀹藉害
- }
- // 杩涚墖杞﹁捣濮嬩綅缃�
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddStart").getAddress(plcmes.getPlcParameter("AddStart").getAddressIndex()), (short) 1000);
- // 杩涚墖杞︾洰鏍囦綅缃�
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("Addgoal").getAddress(plcmes.getPlcParameter("Addgoal").getAddressIndex()), (short) prcid);
- // 杩涚墖鐜荤拑瀹�
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddLength").getAddress(plcmes.getPlcParameter("AddLength").getAddressIndex()), (short) widths);
- // 杩涚墖绗煎唴宸叉湁鐜荤拑鏁�
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddCount").getAddress(plcmes.getPlcParameter("AddCount").getAddressIndex()), (short) prctier);
- // 杩涚墖杞﹀惎鍔� 1涓哄惎鍔�
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddActivate").getAddress(plcmes.getPlcParameter("AddActivate").getAddressIndex()), (short) 1);
- String activate =plcmes.getPlcParameter("AddActivate").getValue();// 鍒ゆ柇鍚姩鏄惁鍐欏叆
- int activate2 = 0;
- if (activate.equals("1")) {
- activate2 = 1;
- }else{
- while (activate.equals("1")) {
- // 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddActivate").getAddress(plcmes.getPlcParameter("AddActivate").getAddressIndex()), (short) 1);
- activate =plcmes.getPlcParameter("AddActivate").getValue();// 鍒ゆ柇鍚姩鏄惁鍐欏叆
- }
- }
- outmesid(glassid, "FeedID");//娲惧彂id
- spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(), prctier,activate2);// 鏂板浠诲姟
- return (200);
-
- }
-
- }
- return (400);
-
- }
-
- public Short selectout2(String glassid) {
- //璇诲彇DB105鍖烘枃浠�
- PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
- //璇�106
- PlcParameterObject plcread=PLCAutoMes.PlcReadObject;
-
- char[] a = glassid.toCharArray();
- List<Short> datas = new ArrayList<>();
- // 鑾峰彇浼樺厛鍑虹墖鐨勪綅缃�
- StorageCage cageout = spianMapper.selectOut2(glassid);
- if (cageout == null) {
- return (300);
- }
-
- int cage = cageout.getCage(); // 鍌ㄥ瓨鍑虹墖浣嶇疆锛岀瀛愭牸瀛愬嚑鍙风幓鐠�
- int cell = cageout.getCell();// 鍑虹墖鏍煎彿
- int tier = cageout.getTier();// 鍑虹墖鍐呭鐗�
- int prcid = cageout.getPrcId();// prcid
- int prcid2;
- int ids;
- int cages;
- int cells;
- double glasswidth = cageout.getGlassWidth();
- int state = spianMapper.selectGlassState(cage, cell);// 鑾峰彇鏍煎瓙鏁伴噺
- // 鍒ゆ柇鐜荤拑鍐呭鐗�
- if (tier == 2) {
-
- // 鍒ゆ柇鐜荤拑鍙洿鎺ュ嚭鐗囨椂
- spianMapper.OverOutSlice(glassid.toString(), 1, 0);// 鏇存柊鍑虹墖闃熷垪浠诲姟鐘舵�佷负杩涜涓�
- spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCageState(glassid.toString(), 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
- spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, state, 3);// 鏂板浠诲姟
-
- } else {
- // 鑾峰彇鏍煎瓙鐨勭幓鐠冩暟閲�
-
- // 鍒ゆ柇鍐呯墖鏄惁闇�瑕佽皟鎷�
- if (state == 1) {
- spianMapper.OverOutSlice(glassid.toString(), 1, 0);// 鏇存柊鍑虹墖闃熷垪浠诲姟鐘舵�佷负杩涜涓�
- spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
- spianMapper.UpdataGlassCageState(glassid, 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
- spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, 1,3);// 鏂板浠诲姟
-
-
- } else {
- // 鐜荤拑闇�瑕佽皟鎷ㄦ椂锛屽垽鏂睘浜庡摢涓崐鍖虹殑绗煎瓙
- if (cage < 6) {
- StorageCage cagecell = spianMapper.selectGlassCage(cage, glasswidth, 0, 6, cell);
- if (cagecell == null) {
- return (300);
- }
- // 鑾峰彇璋冩嫧浣嶇疆杩涜璋冩嫧
- prcid2 = cagecell.getPrcId();// 璋冩嫧鐩爣浣峆RCID
- ids = cagecell.getId();// 璋冩嫧鐩爣浣岻D
- cages = cagecell.getCage();// 璋冩嫧鐩爣浣嶇瀛�
- cells = cagecell.getCell();// 璋冩嫧鐩爣浣嶆牸瀛�
- // 鏇存崲鐜荤拑鐨勭瀛�
- String glassids = spianMapper.SelectGlassid(cage, cell); // 鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
- spianMapper.UpdataGlassCageState(glassids, 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
- spianMapper.UpdateDBCage(ids, cage, cell, 2);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
- spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 鍑忓皯鏂版牸瀛愬搴�
- spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
- spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassids, 2, 3);// 鏂板璋冨害浠诲姟
-
- } else {// 绗煎瓙鍙峰ぇ浜�5鏃�
- StorageCage cagecell = spianMapper.selectGlassCage(cage, glasswidth, 5, 11, cell);
- if (cagecell == null) {
- return (300);
- }
- // 鑾峰彇璋冩嫧浣嶇疆杩涜璋冩嫧
- prcid2 = cagecell.getPrcId();// 璋冩嫧鐩爣浣峱rcID
- ids = cagecell.getId();// 璋冩嫧鐩爣浣岻D
- cages = cagecell.getCage();// 璋冩嫧鐩爣浣嶇瀛�
- cells = cagecell.getCell();// 璋冩嫧鐩爣浣嶆牸瀛�
- String glassids = spianMapper.SelectGlassid(cage, cell); // 鑾峰彇琚皟鎷ㄧ殑鐜荤拑id
- spianMapper.UpdataGlassCageState(glassids, 3);// 鏇存敼绗煎瓙琛ㄧ殑鐜荤拑鐘舵��
- spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassids, 2, 3);// 鏂板璋冨害浠诲姟
- spianMapper.UpdateDBCage(ids, cage, cell, 2);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
- spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 鍑忓皯鏂版牸瀛愬搴�
- spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
-
-
- }
- //鍙戦�乸lc浠诲姟
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddStart").getAddress(plcmes.getPlcParameter("AddStart").getAddressIndex()), (short) prcid);
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("Addgoal").getAddress(plcmes.getPlcParameter("Addgoal").getAddressIndex()), (short) prcid2);
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddCount").getAddress(plcmes.getPlcParameter("AddCount").getAddressIndex()), (short) state);
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddActivate").getAddress(plcmes.getPlcParameter("AddActivate").getAddressIndex()), (short) 1);
- String activate =plcmes.getPlcParameter("AddActivate").getValue();// 鍒ゆ柇鍚姩鏄惁鍐欏叆
- int activate2 = 0;
- if (activate.equals("1")) {
- activate2 = 1;
- }else{
- while (activate.equals("1")) {
- // 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddActivate").getAddress(plcmes.getPlcParameter("AddActivate").getAddressIndex()), (short) 1);
- activate =plcmes.getPlcParameter("AddActivate").getValue();// 鍒ゆ柇鍚姩鏄惁鍐欏叆
- }
- }
- outmesid(glassid, "ReleaseID");//娲惧彂id
- //鍙戦�佸畬鍊掔墖缁撴潫
- return (200); // 缁撴潫
- }
- }
- // 鍑虹墖杞﹁捣濮嬩綅缃�
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddStart").getAddress(plcmes.getPlcParameter("OutStart").getAddressIndex()), (short) prcid);
- // 鍑虹墖杞︾洰鏍囦綅缃�
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("Addgoal").getAddress(plcmes.getPlcParameter("Outgoal").getAddressIndex()), (short) 1000);
- // 鍑虹墖绗煎唴宸叉湁鐜荤拑鏁�
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddCount").getAddress(plcmes.getPlcParameter("OutCount").getAddressIndex()), (short) state);
- // 鍑虹墖杞﹀惎鍔� 1涓哄惎鍔�
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddActivate").getAddress(plcmes.getPlcParameter("OutActivate").getAddressIndex()), (short) 1);
- String activate =plcmes.getPlcParameter("AddActivate").getValue();// 鍒ゆ柇鍚姩鏄惁鍐欏叆
- int activate2 = 0;
- if (activate.equals("1")) {
- activate2 = 1;
- }else{
- while (activate.equals("1")) {
- // 鍑虹墖浠诲姟鍙戦�佸瓧鏀逛负1
- S7control.getinstance().WriteWord(plcmes.getPlcParameter("AddActivate").getAddress(plcmes.getPlcParameter("AddActivate").getAddressIndex()), (short) 1);
-
- activate =plcmes.getPlcParameter("AddActivate").getValue();// 鍒ゆ柇鍚姩鏄惁鍐欏叆
- }
- }
- outmesid(glassid, "ReleaseID");//娲惧彂id
- //鐩存帴鍑虹墖缁撴潫
- return(200);// 缁撴潫
- }
-
- // 娲惧彂浠诲姟鐜荤拑id
- public void outmesid(String glassid, String address) {
- //璇诲彇DB105鍖烘枃浠�
- PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
- // System.out.println("outmesid:" + glassid);
- List<Byte> glassidlist = new ArrayList();
- char ds[] = glassid.toCharArray();
- for (char iditem : ds) {
- glassidlist.add((byte) iditem);
- }
- byte[] bytes = Bytes.toArray(glassidlist);
- System.out.println("outmesidbytes:" + bytes.length);
- S7control.getinstance().WriteByte(plcmes.getPlcParameter(address).getAddress(plcmes.getPlcParameter(address).getAddressIndex()),bytes);
- //S7control.getinstance().WriteByte(address, bytes);// 娲惧彂鍑虹墖id
-
- }
-
- // 鑾峰彇鍦板潃鍐呯殑鐜荤拑id杞瓧绗︿覆
- public StringBuilder queGlassid(String address, int count) {
- StringBuilder writedstrIdOut = new StringBuilder();
- byte[] writedglassidbytesOut = S7control.getinstance().ReadByte(address, count);
- if (writedglassidbytesOut != null) {
- // 鑾峰彇鐜荤拑id
- for (byte iditem : writedglassidbytesOut) {
- writedstrIdOut.append((char) iditem);
- }
- }
- return writedstrIdOut;
- }
-
- // char鏁扮粍杞寲鎴恇it鏁扮粍
- public static byte[] toBytes(char[] chars) {
- String s = new String(chars);
- return s.getBytes(StandardCharsets.UTF_8);
- }
-
- // bit鏁扮粍杞寲鎴恈har鏁扮粍
- public static char[] toChars(byte[] bytes) {
- String s = new String(bytes, StandardCharsets.UTF_8);
- return s.toCharArray();
- }
-
- // 鍒ゆ柇闆嗗悎閲屾槸鍚︿负1
- public boolean listbool(String address) {
- List<Short> list = S7control.getinstance().ReadWord(address, 1);// 杩斿洖涓簍ure鏃朵负1
- boolean listbool = list.contains((short) 1);
- return listbool;
- }
-
- // 鏍规嵁鐜荤拑id瀹屾垚鍦ㄨ繘琛屼腑鐨勪换鍔�
- public void overtask(String glassid) {
-
- spianMapper.UpdatetaskOut(glassid.toString());// 瀹屾垚涓婁竴娆� 鍑虹墖鎴栬�呰繘鐗囦换鍔�
- spianMapper.OverOutSlice(glassid.toString(), 2, 1);// 瀹屾垚鍑虹墖闃熷垪浠诲姟
- spianMapper.UpdataGlassCage(glassid.toString(), 0);// 娓呴櫎鍑虹墖鏍煎瓙鐜荤拑淇℃伅
- spianMapper.UpdateCageOver(glassid.toString(), 0);// 鏇存敼绗煎瓙琛ㄥ嚭鐗囩姸鎬�
- spianMapper.UpdateCageadd(glassid.toString(), 1);// 鏇存敼绗煎瓙琛ㄨ繘鐗囩姸鎬�
- spianMapper.UpdateAddQueue(glassid.toString());// 鎶婅繘鐗囩殑鐜荤拑鏇存柊鍒板嚭鐗囬槦鍒椾腑
- }
-
-}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
index df711b9..d007afd 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -1,5 +1,6 @@
package com.example.springboot.service;
+import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -14,6 +15,7 @@
import com.example.springboot.entity.Queue;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.StorageTask;
+import com.example.springboot.entity.north_glass_buffer1;
import com.example.springboot.mapper.HomeMapper;
@Service
@@ -27,12 +29,16 @@
@Autowired
private SpianService spianService;
+ @Autowired
+ private JdbcConnections jdbcConnections;
+
public void EndTask(int types) {
String A01glassid1 = spianService.queGlassid("DB103.128", 14).toString();
String A01glassid2 = spianService.queGlassid("DB103.142", 14).toString();
String A02glassid1 = spianService.queGlassid("DB103.156", 14).toString();
String B01glassid = spianService.queGlassid("DB103.184", 14).toString();
String B02glassid = spianService.queGlassid("DB103.212", 14).toString();
+ String D02glassid = spianService.queGlassid("DB103.58", 14).toString();
List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
if (types == 0) {// 缁堟杩涚墖浠诲姟
List<StorageTask> cageList = homeMapper.SelectTaskByState(types);
@@ -49,6 +55,10 @@
}
if (storageTask.getGlassId().equals(B02glassid) && DeviceList.get(3) == 0) {
ClearGlassId("DB101.10.3");
+ outSliceServive.StopTask(storageTask.getGlassId(), types);
+ }
+ if (storageTask.getGlassId().equals(D02glassid) && DeviceList.get(1) == 0) {
+ ClearGlassId("DB101.9.3");
outSliceServive.StopTask(storageTask.getGlassId(), types);
}
}
@@ -179,7 +189,7 @@
return Result.success(map);
}
- public Result InsertQueueGlassId(Short id, Queue queue) {
+ public Result InsertQueueGlassId(Short id, Queue queue) throws SQLException {
Map<String, Object> map = new HashMap<>();
Short zhi = 200;
@@ -189,7 +199,8 @@
} else {
if (id == 1) {
// 璋冪敤浼嶅瓨鍌ㄨ繃绋�
- zhi = spianService.selectAll(queue.getglassId());
+ north_glass_buffer1 north_glass_buffer1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(queue.getglassId(), "", "");
+ zhi = spianService.selectAll(north_glass_buffer1);
if (zhi == 200) {
homeMapper.InsertQueueGlassId(queue, id);
}
--
Gitblit v1.8.0