为了便于车机的调试,去除所有发起任务的校验

批量复制的偏移量改为按实际坐标偏移
This commit is contained in:
yyy 2025-06-17 11:55:34 +08:00
parent c349dcdbe3
commit b5a5827f89
3 changed files with 186 additions and 134 deletions

View File

@ -62,6 +62,8 @@
</template> </template>
<div class="current-item-list"> <div class="current-item-list">
<!-- 楼层展开 --> <!-- 楼层展开 -->
<!--
暂时去除所有发起任务的校验
<div <div
v-for="(floor, floorIndex) in currentMapItemList" v-for="(floor, floorIndex) in currentMapItemList"
:key="floorIndex" :key="floorIndex"
@ -77,6 +79,16 @@
? '#FFE2E2' ? '#FFE2E2'
: '#F6FFEF' : '#F6FFEF'
}" }"
> -->
<div
v-for="(floor, floorIndex) in currentMapItemList"
:key="floorIndex"
class="current-item"
:class="currentItem && currentItem.id == floor.id ? 'tool-active' : ''"
@click="chooseLocationPoint(floor)"
:style="{
background: '#F6FFEF'
}"
> >
<div>层数: {{ floor.locationStorey }}</div> <div>层数: {{ floor.locationStorey }}</div>
<div class="mt-4px">库位号: {{ floor.locationNo }}</div> <div class="mt-4px">库位号: {{ floor.locationNo }}</div>
@ -343,26 +355,27 @@ const choosePoint = (item) => {
} }
const chooseLocationPoint = (item) => { const chooseLocationPoint = (item) => {
if (item.locationEnable === 0) { //
message.warning('该库位已被禁用') // if (item.locationEnable === 0) {
return // message.warning('')
} // return
// }
if (item.locationLock === 0) { // if (item.locationLock === 0) {
message.warning('该库位已被锁定') // message.warning('')
return // return
} // }
// locationUseStatus 1 0 // // locationUseStatus 1 0
if (item.locationUseStatus === 1 && locationTypeStr.value === 'release') { // if (item.locationUseStatus === 1 && locationTypeStr.value === 'release') {
message.warning('该库位已被占用') // message.warning('')
return // return
} // }
if (item.locationUseStatus === 0 && locationTypeStr.value === 'take') { // if (item.locationUseStatus === 0 && locationTypeStr.value === 'take') {
message.warning('该库位没有货物') // message.warning('')
return // return
} // }
currentItem.value = item currentItem.value = item
} }

View File

@ -7,8 +7,8 @@
class="batch-copying-dialog-form" class="batch-copying-dialog-form"
@close="dialogClose" @close="dialogClose"
> >
<el-form :model="batchCopyingForm" label-width="100" ref="BatchCopyingFormRef" :rules="rules"> <el-form :model="batchCopyingForm" label-width="120" ref="BatchCopyingFormRef" :rules="rules">
<el-form-item label="X轴偏移量" prop="x" required> <el-form-item label="X轴偏移量(实际点位)" prop="x" required>
<el-input-number <el-input-number
v-model="batchCopyingForm.x" v-model="batchCopyingForm.x"
placeholder="请输入" placeholder="请输入"
@ -18,7 +18,7 @@
/> />
<el-text type="info" size="small">X轴往左为负值往右为正值</el-text> <el-text type="info" size="small">X轴往左为负值往右为正值</el-text>
</el-form-item> </el-form-item>
<el-form-item label="Y轴偏移量" prop="y" required> <el-form-item label="Y轴偏移量(实际点位)" prop="y" required>
<el-input-number <el-input-number
v-model="batchCopyingForm.y" v-model="batchCopyingForm.y"
placeholder="请输入" placeholder="请输入"
@ -60,8 +60,10 @@ const BatchCopyingFormRef = ref()
const dialogFormVisible = ref(false) // const dialogFormVisible = ref(false) //
const validateXValue = (rule, value, callback) => { const validateXValue = (rule, value, callback) => {
let maxLeft = -Number(boundaryValue.value.left) const { resolution, width } = props.imgBgObj
let maxRight = Number(props.imgBgObj.width) - Number(boundaryValue.value.right)
let maxLeft = -(Number(boundaryValue.value.left) / Number(resolution))
let maxRight = (Number(width) - Number(boundaryValue.value.right)) / Number(resolution)
if (value < maxLeft || value > maxRight) { if (value < maxLeft || value > maxRight) {
callback(new Error(`不能超出地图宽度,可偏移范围为${maxLeft}${maxRight}`)) callback(new Error(`不能超出地图宽度,可偏移范围为${maxLeft}${maxRight}`))
} else { } else {
@ -69,8 +71,10 @@ const validateXValue = (rule, value, callback) => {
} }
} }
const validateYValue = (rule, value, callback) => { const validateYValue = (rule, value, callback) => {
let maxTop = -Number(boundaryValue.value.top) const { resolution, height } = props.imgBgObj
let maxBottom = Number(props.imgBgObj.height) - Number(boundaryValue.value.bottom)
let maxTop = -(Number(boundaryValue.value.top) / Number(resolution))
let maxBottom = (Number(height) - Number(boundaryValue.value.bottom)) / Number(resolution)
if (value < maxTop || value > maxBottom) { if (value < maxTop || value > maxBottom) {
callback(new Error(`不能超出地图宽度,可偏移范围为${maxTop}${maxBottom}`)) callback(new Error(`不能超出地图宽度,可偏移范围为${maxTop}${maxBottom}`))
} else { } else {
@ -105,11 +109,23 @@ const submitLineLibraryForm = async () => {
await BatchCopyingFormRef.value.validate(async (valid, fields) => { await BatchCopyingFormRef.value.validate(async (valid, fields) => {
if (valid) { if (valid) {
dialogFormVisible.value = false dialogFormVisible.value = false
emit('submitBatchCopyingFormSuccess', batchCopyingForm.value) const x = roundToThree(
safeNumber(batchCopyingForm.value.x) / safeNumber(props.imgBgObj.resolution)
)
const y = roundToThree(
safeNumber(batchCopyingForm.value.y) / safeNumber(props.imgBgObj.resolution)
)
emit('submitBatchCopyingFormSuccess', {
x: x,
y: y
})
} }
}) })
} }
const safeNumber = (value) => Number(value || 0)
const roundToThree = (num) => Math.round(Number(num) * 1000) / 1000
defineExpose({ open }) // open defineExpose({ open }) // open
</script> </script>

View File

@ -159,11 +159,20 @@
placeholder="请选择" placeholder="请选择"
@change="taskTypeChange(detailItem, index)" @change="taskTypeChange(detailItem, index)"
> >
<el-option <!--
暂时去除所有发起任务的校验
<el-option
v-for="item in detailItem.taskTypeList" v-for="item in detailItem.taskTypeList"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> -->
<el-option
v-for="item in allTaskTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -772,7 +781,7 @@
<locationSelectionDialog <locationSelectionDialog
:positionMapId="null" :positionMapId="null"
ref="locationSelectionDialogRef" ref="locationSelectionDialogRef"
@locationSelectionDialogSuccess="locationSelectionDialogSuccess" @location-selection-dialog-success="locationSelectionDialogSuccess"
/> />
</div> </div>
</template> </template>
@ -783,13 +792,23 @@ import { RefreshRight, Position } from '@element-plus/icons-vue'
import * as MapTaskAPi from '@/api/map/mapTask' import * as MapTaskAPi from '@/api/map/mapTask'
import locationSelectionDialog from '../components/locationSelectionDialog.vue' import locationSelectionDialog from '../components/locationSelectionDialog.vue'
defineOptions({ name: 'taskManagementCreateTask' }) defineOptions({ name: 'TaskManagementCreateTask' })
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const { push } = useRouter() const { push } = useRouter()
const allTaskTypeList = ref([
{ label: '取放货', value: 1 },
{ label: '停车', value: 2 },
{ label: '充电', value: 3 },
{ label: '移动', value: 4 },
{ label: '仅取货', value: 5 },
{ label: '仅放货', value: 6 },
{ label: '移动到点位', value: 9 }
])
const formData = ref({ const formData = ref({
montageTask: 1, //01 montageTask: 1, //01
montageNumber: 1, // montageNumber: 1, //
@ -1101,118 +1120,122 @@ const montageTaskChange = (e) => {
// //
const doMoveAllChange = (e) => { const doMoveAllChange = (e) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (formData.value.doMoveAll === 1) { resolve(true)
if (formData.value.doCycle === 1) { //
formData.value.taskDetailList.forEach((item, index) => { // if (formData.value.doMoveAll === 1) {
item.taskTypeList = [ // if (formData.value.doCycle === 1) {
{ label: '取放货', value: 1 }, // formData.value.taskDetailList.forEach((item, index) => {
{ label: '移动', value: 4 }, // item.taskTypeList = [
{ label: '移动到点位', value: 9 } // { label: '', value: 1 },
] // { label: '', value: 4 },
}) // { label: '', value: 9 }
} else { // ]
formData.value.taskDetailList.forEach((item, index) => { // })
item.taskType = undefined // } else {
if (index === 0) { // formData.value.taskDetailList.forEach((item, index) => {
item.taskTypeList = [ // item.taskType = undefined
{ label: '取放货', value: 1 }, // if (index === 0) {
{ label: '停车', value: 2 }, // item.taskTypeList = [
{ label: '充电', value: 3 }, // { label: '', value: 1 },
{ label: '移动', value: 4 }, // { label: '', value: 2 },
{ label: '仅取货', value: 5 }, // { label: '', value: 3 },
{ label: '仅放货', value: 6 }, // { label: '', value: 4 },
{ label: '移动到点位', value: 9 } // { label: '', value: 5 },
] // { label: '', value: 6 },
} else { // { label: '', value: 9 }
item.taskTypeList = [] // ]
} // } else {
}) // item.taskTypeList = []
} // }
resolve(true) // })
} else { // }
try { // resolve(true)
ElMessageBox.confirm('开启搬空所选线库/区域,任务类型只能选择取放货,是否切换?', '提示', { // } else {
confirmButtonText: '确定', // try {
cancelButtonText: '取消', // ElMessageBox.confirm('线/?', '', {
type: 'warning' // confirmButtonText: '',
}) // cancelButtonText: '',
.then(async () => { // type: 'warning'
resolve(true) // })
formData.value.taskDetailList.forEach((item) => { // .then(async () => {
item.taskType = undefined // resolve(true)
item.taskTypeList = [{ label: '取放货', value: 1 }] // formData.value.taskDetailList.forEach((item) => {
}) // item.taskType = undefined
}) // item.taskTypeList = [{ label: '', value: 1 }]
.catch(() => { // })
ElMessage({ // })
type: 'info', // .catch(() => {
message: '取消成功' // ElMessage({
}) // type: 'info',
reject(false) // message: ''
}) // })
} catch (err) { // reject(false)
reject(false) // })
} // } catch (err) {
} // reject(false)
// }
// }
}) })
} }
// //
const doCycleChange = () => { const doCycleChange = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (formData.value.doCycle === 1) { resolve(true)
formData.value.cycleNumber = 0 // //
formData.value.taskDetailList.forEach((item, index) => { // if (formData.value.doCycle === 1) {
item.taskType = undefined // formData.value.cycleNumber = 0 //
if (index === 0) { // formData.value.taskDetailList.forEach((item, index) => {
item.taskTypeList = [ // item.taskType = undefined
{ label: '取放货', value: 1 }, // if (index === 0) {
{ label: '停车', value: 2 }, // item.taskTypeList = [
{ label: '充电', value: 3 }, // { label: '', value: 1 },
{ label: '移动', value: 4 }, // { label: '', value: 2 },
{ label: '仅取货', value: 5 }, // { label: '', value: 3 },
{ label: '仅放货', value: 6 }, // { label: '', value: 4 },
{ label: '移动到点位', value: 9 } // { label: '', value: 5 },
] // { label: '', value: 6 },
} else { // { label: '', value: 9 }
item.taskTypeList = [] // ]
} // } else {
}) // item.taskTypeList = []
resolve(true) // }
} else { // })
try { // resolve(true)
ElMessageBox.confirm('开启循环任务,任务类型只能选择取放货和移动,是否切换?', '提示', { // } else {
confirmButtonText: '确定', // try {
cancelButtonText: '取消', // ElMessageBox.confirm('?', '', {
type: 'warning' // confirmButtonText: '',
}) // cancelButtonText: '',
.then(async () => { // type: 'warning'
resolve(true) // })
formData.value.cycleNumber = 1 // // .then(async () => {
formData.value.taskDetailList.forEach((item) => { // resolve(true)
item.taskType = undefined // formData.value.cycleNumber = 1 //
if (formData.value.doMoveAll === 1) { // formData.value.taskDetailList.forEach((item) => {
item.taskTypeList = [{ label: '取放货', value: 1 }] // item.taskType = undefined
} else { // if (formData.value.doMoveAll === 1) {
item.taskTypeList = [ // item.taskTypeList = [{ label: '', value: 1 }]
{ label: '取放货', value: 1 }, // } else {
{ label: '移动', value: 4 }, // item.taskTypeList = [
{ label: '移动到点位', value: 9 } // { label: '', value: 1 },
] // { label: '', value: 4 },
} // { label: '', value: 9 }
}) // ]
}) // }
.catch(() => { // })
ElMessage({ // })
type: 'info', // .catch(() => {
message: '取消成功' // ElMessage({
}) // type: 'info',
reject(false) // message: ''
}) // })
} catch (err) { // reject(false)
reject(false) // })
} // } catch (err) {
} // reject(false)
// }
// }
}) })
} }