fix: 惠氏任务生成

This commit is contained in:
yanps
2023-12-26 10:22:13 +08:00
parent 09056a403f
commit 2739f60512
4 changed files with 637 additions and 159 deletions

View File

@@ -28,6 +28,28 @@
<groupId>org.openscada.utgard</groupId>
<artifactId>org.openscada.opc.lib</artifactId>
<version>1.5.0</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12.1</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.50</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>

View File

@@ -173,6 +173,14 @@ export function cleans2(data) {
})
}
export function cleans3(data) {
return request({
url: 'api/device/cleans3',
method: 'post',
data
})
}
export function enterSite1(data) {
return request({
url: 'api/device/enterSite1',
@@ -189,14 +197,22 @@ export function enterSite2(data) {
})
}
export function cleans3(data) {
export function enterSite3(data) {
return request({
url: 'api/device/cleans3',
url: 'api/device/enterSite3',
method: 'post',
data
})
}
// export function cleans3(data) {
// return request({
// url: 'api/device/cleans3',
// method: 'post',
// data
// })
// }
export function selectAGVList() {
return request({
url: 'api/device/selectAGVList',
@@ -212,6 +228,14 @@ export function agvTaskType(data) {
})
}
export function getEndPoint(data) {
return request({
url: 'api/device/endPoint',
method: 'post',
data
})
}
export default { add, edit, del, selectDeviceList, selectDeviceListByRegion, callAgv, responseAgv, selectDeviceDevicerInfo, autoCreateTask,
changeDeviceStatus, cleanTask, queryStorageExtra, selectConDeviceList, saveBarcode, selectDeviceListOne, selectDeviceListTwo, selectDeviceListThree,
addMaterial, cleanMaterial, changeFenceStatus,reload, cleans1, cleans2, enterSite1, enterSite2, cleans3, selectAGVList, agvTaskType}
addMaterial, cleanMaterial, changeFenceStatus, reload, cleans1, cleans2, enterSite1, enterSite2, enterSite3, cleans3, selectAGVList, agvTaskType, getEndPoint }

View File

@@ -1,10 +1,23 @@
<template>
<div style="border: 1px solid #938d8d;margin-left: 10px;margin-right: 10px;">
<div style="border: 1px solid #938d8d; margin-left: 10px; margin-right: 10px">
<el-row
style="border: 1px solid chartreuse;margin-left: 10px;margin-right: 10px;margin-bottom: 10px;margin-top: 20px;min-height: 600px"
style="
border: 1px solid chartreuse;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 10px;
margin-top: 20px;
min-height: 600px;
"
>
<form id="myForm" name="testForm" style="margin-top: 100px;">
<el-row :gutter="5" type="flex" justify="center" align="middle" style="min-height: 40px">
<form id="myForm" name="testForm" style="margin-top: 100px">
<el-row
:gutter="5"
type="flex"
justify="center"
align="middle"
style="min-height: 40px"
>
<el-col :span="10">
<el-button type="primary" @click="enterSite1">进入</el-button>
<el-button type="primary" @click="outSite1">离开</el-button>
@@ -13,45 +26,89 @@
</el-row>
<el-row :gutter="5" type="flex" justify="center" align="middle">
<el-col :span="20">
<el-checkbox @change="checkeds" v-model="resultAll1" class="fla">全选</el-checkbox>
<div v-for="(item,i) in deviceList">
<el-checkbox
v-model="resultAll1"
class="fla"
@change="checkeds"
>全选</el-checkbox>
<div v-for="(item) in deviceList" :key="item.id">
<div
v-if="item.islock"
style="float: left;margin-right: 5px;width: 120px;height: 120px;background-color: #FEC171;border-radius: 10%;"
style="
float: left;
margin-right: 5px;
width: 120px;
height: 120px;
background-color: #fec171;
border-radius: 10%;
"
>
<el-checkbox v-model="item.checked" style="margin-left: 20px;"/>
<el-button size="mini" round style="margin-left: 18px; margin-block-end: 10px">
{{ '设备:' + item.device_code }}
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button
size="mini"
round
style="margin-left: 18px; margin-block-end: 10px"
>
{{ "设备:" + item.device_code }}
</el-button>
</div>
<div
v-else-if="item.hasGood !== 0"
style="float: left;margin-right: 5px;width: 120px;height: 120px;background-color: rgb(0, 238, 153);border-radius: 10%;"
style="
float: left;
margin-right: 5px;
width: 120px;
height: 120px;
background-color: rgb(0, 238, 153);
border-radius: 10%;
"
>
<!-- <div style="font-size: 15px; margin-left: 30px">{{ item.device_code }}</div>-->
<el-checkbox v-model="item.checked" style="margin-left: 20px;"/>
<el-button size="mini" round style="margin-left: 18px;">
{{ '设备:' + item.device_code }}
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button size="mini" round style="margin-left: 18px">
{{ "设备:" + item.device_code }}
</el-button>
<div style="font-size: 8px; margin-left: 10px; margin-block-end: 15px; margin-top: 18px">
{{ '物料类型:' + item.material_type }}
<div
style="
font-size: 8px;
margin-left: 10px;
margin-block-end: 15px;
margin-top: 18px;
"
>
{{ "物料类型:" + item.material_type }}
</div>
<div style="font-size: 8px; margin-left: 10px">
{{ "物料数量:" + item.quantity }}
</div>
<div style="font-size: 8px; margin-left: 10px;">{{ '物料数量:' + item.quantity }}</div>
</div>
<div
v-else-if="item.hasGood === 0"
style="float: left;margin-right: 5px; width: 120px;height: 120px;background-color: beige;border-radius: 10%;"
style="
float: left;
margin-right: 5px;
width: 120px;
height: 120px;
background-color: beige;
border-radius: 10%;
"
>
<el-checkbox v-model="item.checked" style="margin-left: 20px;"/>
<el-button size="mini" round style="margin-left: 18px;">
{{ '设备:' + item.device_code }}
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button size="mini" round style="margin-left: 18px">
{{ "设备:" + item.device_code }}
</el-button>
</div>
</div>
</el-col>
</el-row>
<el-row :gutter="5" type="flex" justify="center" align="middle" style="min-height: 40px; margin-top: 50px">
<el-row
:gutter="5"
type="flex"
justify="center"
align="middle"
style="min-height: 40px; margin-top: 50px"
>
<el-col :span="10">
<el-button type="primary" @click="enterSite2">进入</el-button>
<el-button type="primary" @click="outSite2">离开</el-button>
@@ -60,37 +117,165 @@
</el-row>
<el-row :gutter="5" type="flex" align="bottom" justify="center">
<el-col :span="20">
<el-checkbox @change="checkeds2" v-model="resultAll12" class="fla">全选</el-checkbox>
<div v-for="(item,i) in deviceList2">
<el-checkbox
v-model="resultAll12"
class="fla"
@change="checkeds2"
>全选</el-checkbox>
<div v-for="(item) in deviceList2" :key="item.id">
<div
v-if="item.islock"
style="float: left;margin-right: 5px;width: 120px;height: 120px;background-color: #FEC171;border-radius: 10%;"
style="
float: left;
margin-right: 5px;
width: 120px;
height: 120px;
background-color: #fec171;
border-radius: 10%;
"
>
<el-checkbox v-model="item.checked" style="margin-left: 20px;"/>
<el-button size="mini" round style="margin-left: 18px; margin-block-end: 10px">
{{ '设备:' + item.device_code }}
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button
size="mini"
round
style="margin-left: 18px; margin-block-end: 10px"
>
{{ "设备:" + item.device_code }}
</el-button>
</div>
<div
v-else-if="item.hasGood != 0"
style="float: left;margin-right: 5px;width: 120px;height: 120px;background-color: rgb(0, 238, 153);border-radius: 10%;"
style="
float: left;
margin-right: 5px;
width: 120px;
height: 120px;
background-color: rgb(0, 238, 153);
border-radius: 10%;
"
>
<el-checkbox v-model="item.checked" style="margin-left: 20px;"/>
<el-button size="mini" round style="margin-left: 18px;">
{{ '设备:' + item.device_code }}
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button size="mini" round style="margin-left: 18px">
{{ "设备:" + item.device_code }}
</el-button>
<div style="font-size: 8px; margin-left: 10px; margin-block-end: 15px; margin-top: 18px">
{{ '物料类型:' + item.material_type }}
<div
style="
font-size: 8px;
margin-left: 10px;
margin-block-end: 15px;
margin-top: 18px;
"
>
{{ "物料类型:" + item.material_type }}
</div>
<div style="font-size: 8px; margin-left: 10px">
{{ "物料数量:" + item.quantity }}
</div>
<div style="font-size: 8px; margin-left: 10px;">{{ '物料数量:' + item.quantity }}</div>
</div>
<div
v-else-if="item.hasGood === 0"
style="float: left;margin-right: 5px;width: 120px;height: 120px;background-color: beige;border-radius: 10%;"
style="
float: left;
margin-right: 5px;
width: 120px;
height: 120px;
background-color: beige;
border-radius: 10%;
"
>
<el-checkbox v-model="item.checked" style="margin-left: 20px;"/>
<el-button size="mini" round style="margin-left: 18px;">
{{ '设备:' + item.device_code }}
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button size="mini" round style="margin-left: 18px">
{{ "设备:" + item.device_code }}
</el-button>
</div>
</div>
</el-col>
</el-row>
<el-row
:gutter="5"
type="flex"
justify="center"
align="middle"
style="min-height: 40px; margin-top: 50px"
>
<el-col :span="10">
<el-button type="primary" @click="enterSite3">进入</el-button>
<el-button type="primary" @click="outSite3">离开</el-button>
<el-button type="primary" @click="cleans3">清空货位</el-button>
</el-col>
</el-row>
<el-row :gutter="5" type="flex" align="bottom" justify="center">
<el-col :span="20">
<el-checkbox
v-model="resultAll13"
class="fla"
@change="checkeds3"
>全选</el-checkbox>
<div v-for="(item) in deviceList3" :key="item.id">
<div
v-if="item.islock"
style="
float: left;
margin-right: 5px;
width: 120px;
height: 120px;
background-color: #fec171;
border-radius: 10%;
"
>
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button
size="mini"
round
style="margin-left: 18px; margin-block-end: 10px"
>
{{ "设备:" + item.device_code }}
</el-button>
</div>
<div
v-else-if="item.hasGood != 0"
style="
float: left;
margin-right: 5px;
width: 120px;
height: 120px;
background-color: rgb(0, 238, 153);
border-radius: 10%;
"
>
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button size="mini" round style="margin-left: 18px">
{{ "设备:" + item.device_code }}
</el-button>
<div
style="
font-size: 8px;
margin-left: 10px;
margin-block-end: 15px;
margin-top: 18px;
"
>
{{ "物料类型:" + item.material_type }}
</div>
<div style="font-size: 8px; margin-left: 10px">
{{ "物料数量:" + item.quantity }}
</div>
</div>
<div
v-else-if="item.hasGood === 0"
style="
float: left;
margin-right: 5px;
width: 120px;
height: 120px;
background-color: beige;
border-radius: 10%;
"
>
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button size="mini" round style="margin-left: 18px">
{{ "设备:" + item.device_code }}
</el-button>
</div>
</div>
@@ -99,13 +284,12 @@
</form>
</el-row>
</div>
</template>
<script>
import deviceCrud from '@/api/acs/device/device'
import { get } from '@/api/system/dictDetail'
import crudTask, { ordinaryTaskCreate } from '@/api/acs/task/task'
// import crudTask, { ordinaryTaskCreate } from '@/api/acs/task/task'
import CRUD, { crud } from '@crud/crud'
export default {
@@ -114,6 +298,7 @@ export default {
return {
resultAll1: false,
resultAll12: false,
resultAll13: false,
requestDialogVisible: false,
requestDialogVisible2: false,
responseDialogVisible: false,
@@ -140,6 +325,14 @@ export default {
quantity: 0,
remark: ''
},
form3: {
device_id: '',
device_code: '',
device_name: '',
material_type: '',
quantity: 0,
remark: ''
},
testdata: {
check: null,
device_code: null
@@ -147,8 +340,10 @@ export default {
material_types: [],
deviceList: [],
deviceList2: [],
deviceList3: [],
deviceListOne: [],
deviceListTwo: [],
deviceListThree: [],
currentDate: new Date(),
getTime: '',
getDate: ''
@@ -158,24 +353,29 @@ export default {
this.webSocket()
// 获取物料类型字典
get('material_type').then(data => {
get('material_type').then((data) => {
this.material_types = data.content
})
// 获取区域类型
get('region_type').then(data => {
get('region_type').then((data) => {
this.regions = data.content
console.log(this.regions)
})
this.$nextTick(() => {
deviceCrud.selectDeviceListOne().then(data => {
deviceCrud.selectDeviceListOne().then((data) => {
this.deviceListOne = data
})
})
this.$nextTick(() => {
deviceCrud.selectDeviceListTwo().then(data => {
deviceCrud.selectDeviceListTwo().then((data) => {
this.deviceListTwo = data
})
})
/* this.$nextTick(() => {
deviceCrud.selectDeviceListThree().then(data => {
this.deviceListThree = data
})
}) */
},
methods: {
cleans1() {
@@ -187,9 +387,9 @@ export default {
}
}
const data = {
'data': arr1
data: arr1
}
deviceCrud.cleans1(data).then(res => {
deviceCrud.cleans1(data).then(() => {
this.$notify({
title: '操作成功',
type: 'success',
@@ -198,7 +398,7 @@ export default {
for (let i = 0; i < arr1.length; i++) {
arr1[i].checked = false
}
this.resultAll1 = false
this.resultAll1 = false
})
},
cleans2() {
@@ -210,10 +410,10 @@ export default {
}
}
const data = {
'data': arr
data: arr
}
deviceCrud.cleans2(data).then(res => {
deviceCrud.cleans2(data).then(() => {
this.$notify({
title: '操作成功',
type: 'success',
@@ -225,24 +425,54 @@ export default {
this.resultAll12 = false
})
},
cleans3() {
var obj = this.deviceList3
var arr = []
for (let i = 0; i < obj.length; i++) {
if (obj[i].checked) {
arr.push(obj[i])
}
}
const data = {
data: arr
}
deviceCrud.cleans3(data).then(() => {
this.$notify({
title: '操作成功',
type: 'success',
duration: 3000
})
for (let i = 0; i < arr.length; i++) {
arr[i].checked = false
}
this.resultAll13 = false
})
},
checkeds(value) {
this.deviceList.forEach((item) => {
item.checked = value
})
this.$forceUpdate();
this.$forceUpdate()
},
checkeds2(value) {
this.deviceList2.forEach((item) => {
item.checked = value
})
this.$forceUpdate();
this.$forceUpdate()
},
checkeds3(value) {
this.deviceList3.forEach((item) => {
item.checked = value
})
this.$forceUpdate()
},
enterSite1() {
const data = {
'data': this.deviceList,
'islock': 'true'
data: this.deviceList,
islock: 'true'
}
deviceCrud.enterSite1(data).then(res => {
deviceCrud.enterSite1(data).then(() => {
this.$notify({
title: '操作成功',
type: 'success',
@@ -252,10 +482,10 @@ export default {
},
outSite1() {
const data = {
'data': this.deviceList,
'islock': 'false'
data: this.deviceList,
islock: 'false'
}
deviceCrud.enterSite1(data).then(res => {
deviceCrud.enterSite1(data).then(() => {
this.$notify({
title: '操作成功',
type: 'success',
@@ -265,10 +495,10 @@ export default {
},
enterSite2() {
const data = {
'data': this.deviceList2,
'islock': 'true'
data: this.deviceList2,
islock: 'true'
}
deviceCrud.enterSite2(data).then(res => {
deviceCrud.enterSite2(data).then(() => {
this.$notify({
title: '操作成功',
type: 'success',
@@ -278,10 +508,36 @@ export default {
},
outSite2() {
const data = {
'data': this.deviceList2,
'islock': 'false'
data: this.deviceList2,
islock: 'false'
}
deviceCrud.enterSite2(data).then(res => {
deviceCrud.enterSite2(data).then(() => {
this.$notify({
title: '操作成功',
type: 'success',
duration: 3000
})
})
},
enterSite3() {
const data = {
data: this.deviceList3,
islock: 'true'
}
deviceCrud.enterSite3(data).then(() => {
this.$notify({
title: '操作成功',
type: 'success',
duration: 3000
})
})
},
outSite3() {
const data = {
data: this.deviceList3,
islock: 'false'
}
deviceCrud.enterSite3(data).then(() => {
this.$notify({
title: '操作成功',
type: 'success',
@@ -290,30 +546,36 @@ export default {
})
},
saveRequest() {
deviceCrud.addMaterial(this.form).then(res => {
this.$notify({
title: '操作成功',
type: 'success',
duration: 3000
deviceCrud
.addMaterial(this.form)
.then(() => {
this.$notify({
title: '操作成功',
type: 'success',
duration: 3000
})
this.requestDialogVisible = false
})
.catch((err) => {
this.requestDialogVisible = false
console.log(err.response.data.message)
})
this.requestDialogVisible = false
}).catch(err => {
this.requestDialogVisible = false
console.log(err.response.data.message)
})
},
saveRequest2() {
deviceCrud.addMaterial(this.form2).then(res => {
this.$notify({
title: '操作成功',
type: 'success',
duration: 3000
deviceCrud
.addMaterial(this.form2)
.then(() => {
this.$notify({
title: '操作成功',
type: 'success',
duration: 3000
})
this.requestDialogVisible2 = false
})
.catch((err) => {
this.requestDialogVisible2 = false
console.log(err.response.data.message)
})
this.requestDialogVisible2 = false
}).catch(err => {
this.requestDialogVisible2 = false
console.log(err.response.data.message)
})
},
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
@@ -321,7 +583,7 @@ export default {
},
webSocket() {
const that = this
if (typeof (WebSocket) === 'undefined') {
if (typeof WebSocket === 'undefined') {
this.$notify({
title: '提示',
message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器!',
@@ -333,7 +595,10 @@ export default {
// 获取token保存到vuex中的用户信息此处仅适用于本项目注意删除或修改
// 实例化socket这里我把用户名传给了后台使后台能判断要把消息发给哪个用户其实也可以后台直接获取用户IP来判断并推送
// const wsUri = process.env.VUE_APP_WS_API + '/webSocket/' + id
const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + id
const wsUri =
window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') +
'/webSocket/' +
id
this.socket = new WebSocket(wsUri)
// 监听socket打开
@@ -347,7 +612,7 @@ export default {
const item = data.msg.device[i]
// 刷新页面第一次加载数据
if (that.deviceList.length != data.msg.device.length) {
if (that.deviceList.length !== data.msg.device.length) {
const obj = {
device_code: item.device_code,
hasGood: item.hasGood,
@@ -360,21 +625,21 @@ export default {
that.deviceList.push(obj)
} else {
for (let j = 0; j < that.deviceList.length; j++) {
if (that.deviceList[j].device_code == item.device_code) {
if (that.deviceList[j].hasGood != item.hasGood) {
if (that.deviceList[j].device_code === item.device_code) {
if (that.deviceList[j].hasGood !== item.hasGood) {
that.deviceList[j].device_code = item.device_code
that.deviceList[j].hasGood = item.hasGood
}
if (that.deviceList[j].material_type != item.material_type) {
if (that.deviceList[j].material_type !== item.material_type) {
that.deviceList[j].material_type = item.material_type
}
if (that.deviceList[j].quantity != item.quantity) {
if (that.deviceList[j].quantity !== item.quantity) {
that.deviceList[j].quantity = item.quantity
}
if (that.deviceList[j].remark != item.remark) {
if (that.deviceList[j].remark !== item.remark) {
that.deviceList[j].remark = item.remark
}
if (that.deviceList[j].islock != item.islock) {
if (that.deviceList[j].islock !== item.islock) {
that.deviceList[j].islock = item.islock
}
}
@@ -385,7 +650,7 @@ export default {
const item = data.msg.device2[i]
// 刷新页面第一次加载数据
if (that.deviceList2.length != data.msg.device2.length) {
if (that.deviceList2.length !== data.msg.device2.length) {
const obj = {
device_code: item.device_code,
hasGood: item.hasGood,
@@ -398,27 +663,65 @@ export default {
that.deviceList2.push(obj)
} else {
for (let j = 0; j < that.deviceList2.length; j++) {
if (that.deviceList2[j].device_code == item.device_code) {
if (that.deviceList2[j].hasGood != item.hasGood) {
if (that.deviceList2[j].device_code === item.device_code) {
if (that.deviceList2[j].hasGood !== item.hasGood) {
that.deviceList2[j].device_code = item.device_code
that.deviceList2[j].hasGood = item.hasGood
}
if (that.deviceList2[j].material_type != item.material_type) {
if (that.deviceList2[j].material_type !== item.material_type) {
that.deviceList2[j].material_type = item.material_type
}
if (that.deviceList2[j].quantity != item.quantity) {
if (that.deviceList2[j].quantity !== item.quantity) {
that.deviceList2[j].quantity = item.quantity
}
if (that.deviceList2[j].remark != item.remark) {
if (that.deviceList2[j].remark !== item.remark) {
that.deviceList2[j].remark = item.remark
}
if (that.deviceList2[j].islock != item.islock) {
if (that.deviceList2[j].islock !== item.islock) {
that.deviceList2[j].islock = item.islock
}
}
}
}
}
for (let i = 0; i < data.msg.device3.length; i++) {
const item = data.msg.device3[i]
// 刷新页面第一次加载数据
if (that.deviceList3.length !== data.msg.device3.length) {
const obj = {
device_code: item.device_code,
hasGood: item.hasGood,
material_type: item.material_type,
quantity: item.quantity,
remark: item.remark,
islock: item.islock,
checked: false
}
that.deviceList3.push(obj)
} else {
for (let j = 0; j < that.deviceList3.length; j++) {
if (that.deviceList3[j].device_code === item.device_code) {
if (that.deviceList3[j].hasGood !== item.hasGood) {
that.deviceList3[j].device_code = item.device_code
that.deviceList3[j].hasGood = item.hasGood
}
if (that.deviceList3[j].material_type !== item.material_type) {
that.deviceList3[j].material_type = item.material_type
}
if (that.deviceList3[j].quantity !== item.quantity) {
that.deviceList3[j].quantity = item.quantity
}
if (that.deviceList3[j].remark !== item.remark) {
that.deviceList3[j].remark = item.remark
}
if (that.deviceList3[j].islock !== item.islock) {
that.deviceList3[j].islock = item.islock
}
}
}
}
}
}
// 监听socket错误
this.socket.onerror = function() {
@@ -440,5 +743,4 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -1,10 +1,23 @@
<template>
<div style="border: 1px solid #938d8d;margin-left: 10px;margin-right: 10px;">
<div style="border: 1px solid #938d8d; margin-left: 10px; margin-right: 10px">
<el-row
style="border: 1px solid chartreuse;margin-left: 10px;margin-right: 10px;margin-bottom: 10px;margin-top: 20px;min-height: 580px"
style="
border: 1px solid chartreuse;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 10px;
margin-top: 20px;
min-height: 580px;
"
>
<form id="myForm" name="testForm" style="margin-top: 100px;">
<el-row :gutter="5" type="flex" justify="center" align="middle" style="min-height: 40px">
<form id="myForm" name="testForm" style="margin-top: 100px">
<el-row
:gutter="5"
type="flex"
justify="center"
align="middle"
style="min-height: 40px"
>
<el-col :span="10">
<el-button type="primary" @click="hssavetask">任务生成</el-button>
<el-button type="primary" @click="cleans3">清空货位</el-button>
@@ -12,34 +25,92 @@
</el-row>
<el-row :gutter="5" type="flex" justify="center" align="middle">
<el-col :span="18">
<div v-for="(item,i) in deviceList">
<div v-for="(item, i) in deviceList" :key="item.id">
<div
v-if="item.islock"
style="float: left;margin-right: 5px;width: 125px;height: 125px;background-color: #FEC171;border-radius: 10%;"
style="
float: left;
margin-right: 5px;
width: 150px;
height: 150px;
background-color: #fec171;
border-radius: 10%;
"
>
<el-checkbox v-model="item.checked" style="margin-left: 20px;"/>
<el-button size="mini" round style="margin-left: 6px; margin-block-end: 10px" @click="request(i)">
{{ '设备:' + item.device_code }}
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button
size="mini"
round
style="margin-left: 6px; margin-block-end: 10px"
@click="request(i)"
>
{{ "设备:" + item.device_code }}
</el-button>
</div>
<div
v-else-if="item.hasGood !== 0"
style="float: left;margin-right: 5px;width: 125px;height: 125px;background-color: rgb(0, 238, 153);border-radius: 10%;"
style="
float: left;
margin-right: 5px;
width: 125px;
height: 125px;
background-color: rgb(0, 238, 153);
border-radius: 10%;
"
>
<!-- <div style="font-size: 15px; margin-left: 30px">{{ item.device_code }}</div>-->
<el-checkbox v-model="item.checked" style="margin-left: 20px;"/>
<el-button size="mini" round style="margin-left: 6px; margin-block-end: 10px" @click="request(i)">
{{ '设备:' + item.device_code }}
<el-checkbox v-model="item.checked" style="margin-left: 20px" />
<el-button
size="mini"
round
style="margin-left: 6px; margin-block-end: 8px"
@click="request(i)"
>
{{ "设备:" + item.device_code }}
</el-button>
<div style="font-size: 8px; margin-left: 10px; margin-block-end: 20px; margin-top: 10px">{{ '物料类型:' + item.material_type }}</div>
<div style="font-size: 8px; margin-left: 10px;">{{ '物料数量:' + item.quantity }}</div>
<div
style="
font-size: 8px;
margin-left: 10px;
margin-block-end: 8px;
margin-top: 10px;
"
>
{{ "物料类型:" + item.material_type }}
</div>
<div style="font-size: 8px; margin-left: 10px">
{{ "物料数量:" + item.quantity }}
</div>
<div
v-if="item.next_code !== ''"
style="
font-size: 8px;
margin-left: 10px;
margin-block-end: 8px;
margin-top: 10px;
"
>
{{ "终点:" + item.next_code }}
</div>
</div>
<div
v-else-if="item.hasGood === 0"
style="float: left;margin-right: 5px; width: 125px;height: 125px;background-color: beige;border-radius: 10%;"
style="
float: left;
margin-right: 5px;
width: 125px;
height: 125px;
background-color: beige;
border-radius: 10%;
"
>
<el-button size="mini" round style="margin-left: 6px;" @click="request(i)">
{{ '设备:' + item.device_code }}
<el-button
size="mini"
round
style="margin-left: 6px"
@click="request(i)"
>
{{ "设备:" + item.device_code }}
</el-button>
</div>
</div>
@@ -49,13 +120,25 @@
</el-row>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="添加物料信息" :visible.sync="requestDialogVisible" width="500px">
<el-dialog
title="添加物料信息"
:visible.sync="requestDialogVisible"
width="500px"
>
<el-form :model="form" size="small" label-width="80px">
<el-form-item label="设备名字" prop="description">
<el-input v-model="form.device_name" :disabled="true" style="width: 370px;" />
<el-input
v-model="form.device_name"
:disabled="true"
style="width: 370px"
/>
</el-form-item>
<el-form-item label="物料类型" prop="material_type">
<el-select v-model="form.material_type" style="width: 370px" placeholder="请选择">
<el-select
v-model="form.material_type"
style="width: 370px"
placeholder="请选择"
>
<el-option
v-for="item in material_types"
:key="item.id"
@@ -65,7 +148,25 @@
</el-select>
</el-form-item>
<el-form-item label="物料数量" prop="quantity">
<el-input v-model="form.quantity" style="width: 370px;" />
<el-input v-model="form.quantity" style="width: 370px" />
</el-form-item>
<el-form-item
v-if="form.device_code.includes('BCQHW')"
label="选择终点"
prop="value"
>
<el-select
v-model="form.next_code"
style="width: 370px"
placeholder="请选择"
>
<el-option
v-for="item in resultList"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -73,16 +174,15 @@
<el-button type="primary" @click="saveRequest"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import deviceCrud from '@/api/acs/device/device'
import { get } from '@/api/system/dictDetail'
import crudTask, { ordinaryTaskCreate } from '@/api/acs/task/task'
import crudTask from '@/api/acs/task/task'
import CRUD, { crud } from '@crud/crud'
// import axios from 'axios'
export default {
mixins: [crud()],
@@ -103,7 +203,8 @@ export default {
device_name: '',
material_type: '',
quantity: 0,
remark: ''
remark: '',
next_code: ''
},
testdata: {
check: null,
@@ -113,23 +214,25 @@ export default {
deviceList: [],
currentDate: new Date(),
getTime: '',
getDate: ''
getDate: '',
currentIndex: 0,
resultList: []
}
},
created() {
this.webSocket()
// 获取物料类型字典
get('material_type').then(data => {
get('material_type').then((data) => {
this.material_types = data.content
})
// 获取区域类型
get('region_type').then(data => {
get('region_type').then((data) => {
this.regions = data.content
console.log(this.regions)
})
this.$nextTick(() => {
deviceCrud.selectDeviceListThree().then(data => {
deviceCrud.selectDeviceListThree().then((data) => {
this.deviceList = data
})
})
@@ -137,7 +240,7 @@ export default {
methods: {
request(index) {
this.$nextTick(() => {
deviceCrud.selectDeviceListThree().then(data => {
deviceCrud.selectDeviceListThree().then((data) => {
this.deviceList = data
const clickObj = this.deviceList[index]
this.requestDialogVisible = true
@@ -147,21 +250,33 @@ export default {
this.form.device_id = clickObj.device_id
this.form.device_code = clickObj.device_code
this.form.device_name = clickObj.device_name
this.form.next_code = clickObj.next_code
this.currentIndex = index
this.selectEndPoint()
})
})
},
saveRequest() {
deviceCrud.addMaterial(this.form).then(res => {
this.$notify({
title: '操作成功',
type: 'success',
duration: 3000
console.log('index:' + this.currentIndex)
deviceCrud
.addMaterial(this.form)
.then((res) => {
this.$notify({
title: '操作成功',
type: 'success',
duration: 3000
})
this.requestDialogVisible = false
this.deviceList[this.currentIndex].next_code = this.form.next_code
this.deviceList[this.currentIndex].quantity = this.form.quantity
this.deviceList[this.currentIndex].material_type =
this.form.material_type
// location.reload()
})
.catch((err) => {
this.requestDialogVisible = false
console.log(err.response.data.message)
})
this.requestDialogVisible = false
}).catch(err => {
this.requestDialogVisible = false
console.log(err.response.data.message)
})
},
cleans3() {
var obj1 = this.deviceList
@@ -174,9 +289,9 @@ export default {
}
}
const data = {
'data': arr1
data: arr1
}
deviceCrud.cleans3(data).then(res => {
deviceCrud.cleans3(data).then((res) => {
this.$notify({
title: '操作成功',
type: 'success',
@@ -198,9 +313,9 @@ export default {
}
}
const data = {
'data': arr1
data: arr1
}
crudTask.hssavetask(data).then(res => {
crudTask.hssavetask(data).then((res) => {
this.$notify({
title: '保存成功',
type: 'success',
@@ -215,9 +330,22 @@ export default {
[CRUD.HOOK.beforeRefresh]() {
return true
},
selectEndPoint() {
const params = { start_code: this.form.device_code } // 用对象来存储请求参数
deviceCrud
.getEndPoint(params)
.then((response) => {
this.resultList = response
console.log(this.resultList)
// 将请求返回的集合数据存储到组件的 resultList 数据中
})
.catch((error) => {
console.log(error)
})
},
webSocket() {
const that = this
if (typeof (WebSocket) === 'undefined') {
if (typeof WebSocket === 'undefined') {
this.$notify({
title: '提示',
message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器!',
@@ -229,7 +357,10 @@ export default {
// 获取token保存到vuex中的用户信息此处仅适用于本项目注意删除或修改
// 实例化socket这里我把用户名传给了后台使后台能判断要把消息发给哪个用户其实也可以后台直接获取用户IP来判断并推送
// const wsUri = process.env.VUE_APP_WS_API + '/webSocket/' + id
const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + id
const wsUri =
window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') +
'/webSocket/' +
id
this.socket = new WebSocket(wsUri)
// 监听socket打开
@@ -243,7 +374,7 @@ export default {
const item = data.msg.device[i]
// 刷新页面第一次加载数据
if (that.deviceList.length != data.msg.device.length) {
if (that.deviceList.length !== data.msg.device.length) {
const obj = {
device_code: item.device_code,
hasGood: item.hasGood,
@@ -255,21 +386,21 @@ export default {
that.deviceList.push(obj)
} else {
for (let j = 0; j < that.deviceList.length; j++) {
if (that.deviceList[j].device_code == item.device_code) {
if (that.deviceList[j].hasGood != item.hasGood) {
if (that.deviceList[j].device_code === item.device_code) {
if (that.deviceList[j].hasGood !== item.hasGood) {
that.deviceList[j].device_code = item.device_code
that.deviceList[j].hasGood = item.hasGood
}
if (that.deviceList[j].material_type != item.material_type) {
if (that.deviceList[j].material_type !== item.material_type) {
that.deviceList[j].material_type = item.material_type
}
if (that.deviceList[j].quantity != item.quantity) {
if (that.deviceList[j].quantity !== item.quantity) {
that.deviceList[j].quantity = item.quantity
}
if (that.deviceList[j].remark != item.remark) {
if (that.deviceList[j].remark !== item.remark) {
that.deviceList[j].remark = item.remark
}
if (that.deviceList[j].islock != item.islock) {
if (that.deviceList[j].islock !== item.islock) {
that.deviceList[j].islock = item.islock
}
}
@@ -297,5 +428,4 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>