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

批量复制的偏移量改为按实际坐标偏移
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>
<div class="current-item-list">
<!-- 楼层展开 -->
<!--
暂时去除所有发起任务的校验
<div
v-for="(floor, floorIndex) in currentMapItemList"
:key="floorIndex"
@ -77,6 +79,16 @@
? '#FFE2E2'
: '#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 class="mt-4px">库位号: {{ floor.locationNo }}</div>
@ -343,26 +355,27 @@ const choosePoint = (item) => {
}
const chooseLocationPoint = (item) => {
if (item.locationEnable === 0) {
message.warning('该库位已被禁用')
return
}
//
// if (item.locationEnable === 0) {
// message.warning('')
// return
// }
if (item.locationLock === 0) {
message.warning('该库位已被锁定')
return
}
// if (item.locationLock === 0) {
// message.warning('')
// return
// }
// locationUseStatus 1 0
if (item.locationUseStatus === 1 && locationTypeStr.value === 'release') {
message.warning('该库位已被占用')
return
}
// // locationUseStatus 1 0
// if (item.locationUseStatus === 1 && locationTypeStr.value === 'release') {
// message.warning('')
// return
// }
if (item.locationUseStatus === 0 && locationTypeStr.value === 'take') {
message.warning('该库位没有货物')
return
}
// if (item.locationUseStatus === 0 && locationTypeStr.value === 'take') {
// message.warning('')
// return
// }
currentItem.value = item
}

View File

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

View File

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