add:添加agv交互逻辑和驱动更新

This commit is contained in:
2024-02-02 09:39:02 +08:00
parent f7f27a4f58
commit e846b623fa
15 changed files with 1412 additions and 92 deletions

View File

@@ -27,13 +27,41 @@
</el-form-item>
<el-form-item
:label="$t('angle.table.start_device_code')"
prop="start_point_code"
>
<el-input v-model="form.start_device_code" :disabled="crud.status.edit > 0" style="width: 370px;" />
<el-select
v-model="form.start_point_code"
style="width: 370px;"
filterable
:placeholder="$t('task.select.Placeholder')"
@change="showStartStorage"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_code"
:value="item.device_code"
/>
</el-select>
</el-form-item>
<el-form-item
:label="$t('angle.table.next_device_code')"
prop="next_point_code"
>
<el-input v-model="form.next_device_code" :disabled="crud.status.edit > 0" style="width: 370px;" />
<el-select
v-model="form.next_point_code"
style="width: 370px;"
filterable
:placeholder="$t('task.select.Placeholder')"
@change="showEndStorage"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_code"
:value="item.device_code"
/>
</el-select>
</el-form-item>
<el-form-item
:label="$t('angle.table.next_point_angle')"
@@ -138,6 +166,9 @@ import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import crudAcsPointAngle from '@/api/acs/angle/acsPointAngle'
import deviceCrud from '@/api/acs/device/device'
import routeCurd from '@/api/acs/route/routePlan'
import { getDicts } from '@/views/system/dict/dict'
const defaultForm = {
id: null,
@@ -173,7 +204,46 @@ export default {
edit: ['admin', 'acsPointAngle:edit'],
del: ['admin', 'acsPointAngle:del']
},
form: {
deviceList: [],
task_id: null,
vehicle_code: null,
vehicle_type: null,
task_type: '1',
storage_task_type: '',
task_status: null,
priority: 1,
start_point_code: null,
start_point_code2: null,
start_device_code: null,
start_device_code2: null,
next_point_code: null,
next_point_code2: null,
remark: null,
material: null,
route_plan_code: 'normal',
from_x: null,
from_y: null,
from_z: null,
to_x: null,
to_y: null,
to_z: null,
from_x2: null,
from_y2: null,
from_z2: null,
to_x2: null,
to_y2: null,
to_z2: null,
agv_system_type: '1',
interactionJson: null
},
rules: {
start_point_code: [
{ required: true, message: '起点不能为空', trigger: 'change' }
],
next_point_code: [
{ required: true, message: '终点不能为空', trigger: 'change' }
],
is_active: [
{
required: true,
@@ -184,17 +254,124 @@ export default {
}
}
},
created() {
deviceCrud.selectDeviceList().then(data => {
this.deviceList = data
})
routeCurd.selectList().then(data => {
this.routeList = data
})
getDicts().then(data => {
this.dicts = data
})
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
showStartStorage(val) {
let obj = {}
obj = this.deviceList.find((item) => {
return item.device_code === val
})
if (obj.device_type === 'storage') {
this.start_flag = true
let storage_obj = {}
deviceCrud.queryStorageExtra(obj.device_code).then(data => {
storage_obj = data
const n1 = storage_obj.minY
const n2 = storage_obj.maxY
const m1 = storage_obj.minZ
const m2 = storage_obj.maxZ
const from_y = []
const from_z = []
for (let i = n1; i <= n2; i++) {
const y = {}
if (i < 10) {
y.id = '0' + i
} else {
y.id = i
}
y.value = i + '列'
from_y.push(y)
}
for (let i = m1; i <= m2; i++) {
const z = {}
if (i < 10) {
z.id = '0' + i
} else {
z.id = i
}
z.value = i + '层'
from_z.push(z)
}
this.fromYList = from_y
this.fromZList = from_z
this.form.from_x = storage_obj.tunnel
})
} else {
this.start_flag = false
this.form.from_x = ''
this.form.from_y = ''
this.form.from_z = ''
}
this.isDisabled = false
},
updateIsOn(id, is_active) {
crudAcsPointAngle.updateOn(id, is_active).then(res => {
this.notify('保存成功', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
showEndStorage(val) {
let obj = {}
obj = this.deviceList.find((item) => {
return item.device_code === val
})
if (obj.device_type === 'storage') {
this.end_flag = true
let storage_obj = {}
deviceCrud.queryStorageExtra(obj.device_code).then(data => {
storage_obj = data
const n1 = storage_obj.minY
const n2 = storage_obj.maxY
const m1 = storage_obj.minZ
const m2 = storage_obj.maxZ
const to_y = []
const to_z = []
for (let i = n1; i <= n2; i++) {
const y = {}
if (i < 10) {
y.id = '0' + i
} else {
y.id = i
}
y.value = i + '列'
to_y.push(y)
}
for (let i = m1; i <= m2; i++) {
const z = {}
if (i < 10) {
z.id = '0' + i
} else {
z.id = i
}
z.value = i + '层'
to_z.push(z)
}
this.toYList = to_y
this.toZList = to_z
this.form.to_x = storage_obj.tunnel
})
} else {
this.end_flag = false
this.form.to_x = ''
this.form.to_y = ''
this.form.to_z = ''
}
this.isDisabled = false
}
}
}