Commit 7f3b1bc2 by qinjianhui

fix: 修改排单逻辑

parent 28982397
......@@ -1758,10 +1758,65 @@ const handleArrange = async () => {
const productIdList = getSelectedIds()
.map((v) => Number(v))
.filter((n) => Number.isFinite(n)) as number[]
const productMarks = Array.from(
new Set(
cardSelectList.value.map((item) => item.productMark).filter(Boolean),
),
)
if (productMarks.length > 1) {
return await ElMessageBox.confirm(
'无法排单,你选择的操作单包含多种商品类型,排单不支持多种商品类型混排,请选择同一类型的商品对应的生产单后再试!',
'错误提示',
{
confirmButtonText: '确定',
type: 'warning',
},
)
}
if (productMarks[0] === 'custom_part') {
const craftTypes = Array.from(
new Set(
cardSelectList.value.map((item) => item.craftType).filter(Boolean),
),
)
if (craftTypes.length > 1) {
await ElMessageBox.confirm(
'选中排单的操作单存在多个工艺类型, 是否继续排单?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
}
arrangeDialogRef.value?.open({
productIdList,
showAutoSwitch: true,
})
return
}
await ElMessageBox.confirm('确认对所选择的操作单进行排单?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await submitArrangeFinishApi({ productIdList })
if (res.code !== 200) return
ElMessage.success(res.message)
refreshCurrentView({ isRefreshTree: true })
} catch (e: unknown) {
console.error(e)
} finally {
loading.close()
}
}
const submitArrangeFinishApi = (params: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment