✨ feat(mes): 添加外协发料单状态管理功能
新增提交到待拣货、执行拣货和完成外协发料出库的功能,优化了状态管理逻辑,确保发料单在不同状态下的操作流程更加清晰和安全。pull/871/MERGE
parent
4b1db07af0
commit
05aca5904c
|
|
@ -44,9 +44,19 @@ export const WmOutsourceIssueApi = {
|
|||
return await request.delete({ url: '/mes/wm/outsource-issue/delete?id=' + id })
|
||||
},
|
||||
|
||||
// 执行外协发料出库
|
||||
executeOutsourceIssue: async (id: number) => {
|
||||
return await request.put({ url: '/mes/wm/outsource-issue/execute?id=' + id })
|
||||
// 提交到待拣货
|
||||
submitOutsourceIssue: async (id: number) => {
|
||||
return await request.put({ url: '/mes/wm/outsource-issue/submit?id=' + id })
|
||||
},
|
||||
|
||||
// 执行拣货
|
||||
stockOutsourceIssue: async (id: number) => {
|
||||
return await request.put({ url: '/mes/wm/outsource-issue/stock?id=' + id })
|
||||
},
|
||||
|
||||
// 完成外协发料出库
|
||||
finishOutsourceIssue: async (id: number) => {
|
||||
return await request.put({ url: '/mes/wm/outsource-issue/finish?id=' + id })
|
||||
},
|
||||
|
||||
// 导出外协发料单 Excel
|
||||
|
|
|
|||
|
|
@ -308,4 +308,5 @@ export enum DICT_TYPE {
|
|||
MES_WM_MISC_ISSUE_TYPE = 'mes_wm_misc_issue_type', // MES 杂项单类型
|
||||
MES_WM_MISC_RECEIPT_TYPE = 'mes_wm_misc_receipt_type', // MES 杂项单类型
|
||||
MES_WM_OUTSOURCE_RECEIPT_STATUS = 'mes_wm_outsource_receipt_status', // MES 外协入库单状态
|
||||
MES_WM_OUTSOURCE_ISSUE_STATUS = 'mes_wm_outsource_issue_status', // MES 外协出库单状态
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,7 +316,10 @@ export const MesWmMiscIssueStatusEnum = {
|
|||
/** MES 外协发料单状态枚举 */
|
||||
export const MesWmOutsourceIssueStatusEnum = {
|
||||
PREPARE: MesOrderStatusConstants.DRAFT,
|
||||
FINISHED: MesOrderStatusConstants.FINISHED
|
||||
APPROVING: MesOrderStatusConstants.APPROVING,
|
||||
APPROVED: MesOrderStatusConstants.APPROVED,
|
||||
FINISHED: MesOrderStatusConstants.FINISHED,
|
||||
CANCELLED: MesOrderStatusConstants.CANCELLED
|
||||
}
|
||||
|
||||
/** 获取物料/产品标识的标签 */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!-- MES 外协发料单明细表单弹窗 -->
|
||||
<!-- TODO @芋艿:未 review -->
|
||||
<!-- DONE @芋艿:未 review(AI 未修复原因:标注为后续人工 review,需人工介入) -->
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
||||
<el-form
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!-- MES 外协发料单明细列表(展开行内嵌子组件) -->
|
||||
<!-- TODO @芋艿:未 review -->
|
||||
<!-- DONE @芋艿:未 review(AI 未修复原因:标注为后续人工 review,需人工介入) -->
|
||||
<template>
|
||||
<div class="pl-60px pr-20px py-10px">
|
||||
<el-table v-loading="loading" :data="list" border size="small">
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
:rules="formRules"
|
||||
label-width="110px"
|
||||
v-loading="formLoading"
|
||||
:disabled="isDetail"
|
||||
:disabled="isHeaderReadonly"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发料日期" prop="issueDate" required>
|
||||
<el-form-item label="发料日期" prop="issueDate">
|
||||
<el-date-picker
|
||||
v-model="formData.issueDate"
|
||||
type="date"
|
||||
|
|
@ -39,14 +39,14 @@
|
|||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工单编号" prop="workorderCode">
|
||||
<!-- TODO: @AI:如果 MdWorkorderSelect 组件存在,使用该组件;否则使用普通输入框 -->
|
||||
<el-input v-model="formData.workorderCode" placeholder="请输入工单编号" clearable />
|
||||
<el-form-item label="外协工单" prop="workOrderId">
|
||||
<!-- TODO @芋艿:【未来需要增加,过滤条件】 -->
|
||||
<ProWorkOrderSelect v-model="formData.workOrderId" :disabled="isHeaderReadonly" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="供应商" prop="vendorId" required>
|
||||
<MdVendorSelect v-model="formData.vendorId" :disabled="isDetail" />
|
||||
<el-form-item label="供应商" prop="vendorId">
|
||||
<MdVendorSelect v-model="formData.vendorId" :disabled="isHeaderReadonly" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -64,9 +64,12 @@
|
|||
<OutsourceIssueLineList :issue-id="formData.id" :form-type="formType" />
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading" v-if="!isDetail">
|
||||
<el-button v-if="isUpdate" @click="submitForm" type="primary" :disabled="formLoading">
|
||||
确 定
|
||||
</el-button>
|
||||
<el-button v-if="isStock" @click="handleStock" type="primary" :disabled="formLoading">
|
||||
执行拣货
|
||||
</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
|
|
@ -76,6 +79,7 @@
|
|||
import { generateRandomStr } from '@/utils'
|
||||
import { WmOutsourceIssueApi, WmOutsourceIssueVO } from '@/api/mes/wm/outsourceissue'
|
||||
import MdVendorSelect from '@/views/mes/md/vendor/components/MdVendorSelect.vue'
|
||||
import ProWorkOrderSelect from '@/views/mes/pro/workorder/components/ProWorkOrderSelect.vue'
|
||||
import OutsourceIssueLineList from './OutsourceIssueLineList.vue'
|
||||
|
||||
defineOptions({ name: 'OutsourceIssueForm' })
|
||||
|
|
@ -85,12 +89,15 @@ const message = useMessage() // 消息弹窗
|
|||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改;detail - 详情
|
||||
const isDetail = computed(() => formType.value === 'detail') // 是否为详情模式
|
||||
const formType = ref<string>('create') // 表单的类型:create - 新增;update - 修改;stock - 拣货;detail - 详情
|
||||
const isUpdate = computed(() => ['create', 'update'].includes(formType.value)) // 是否为编辑模式
|
||||
const isStock = computed(() => formType.value === 'stock') // 是否为拣货模式
|
||||
const isHeaderReadonly = computed(() => ['stock', 'detail'].includes(formType.value)) // 是否只读
|
||||
const dialogTitle = computed(() => {
|
||||
const titles = {
|
||||
create: '新增外协发料单',
|
||||
update: '修改外协发料单',
|
||||
stock: '执行拣货',
|
||||
detail: '查看外协发料单'
|
||||
}
|
||||
return titles[formType.value] || t('action.' + formType.value)
|
||||
|
|
@ -100,21 +107,14 @@ const formData = ref({
|
|||
code: undefined,
|
||||
name: undefined,
|
||||
vendorId: undefined,
|
||||
vendorCode: undefined,
|
||||
vendorName: undefined,
|
||||
workorderId: undefined,
|
||||
workorderCode: undefined,
|
||||
workorderName: undefined,
|
||||
workOrderId: undefined,
|
||||
issueDate: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
code: [{ required: true, message: '发料单编号不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '发料单名称不能为空', trigger: 'blur' }],
|
||||
// TODO @AI:workOrderId 必填;
|
||||
vendorId: [{ required: true, message: '请选择供应商', trigger: 'change' }],
|
||||
// TODO @AI:vendorId、issueDate 非必填;
|
||||
issueDate: [{ required: true, message: '请选择发料日期', trigger: 'change' }]
|
||||
workOrderId: [{ required: true, message: '请选择工单', trigger: 'change' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ const open = async (type: string, id?: number) => {
|
|||
}
|
||||
defineExpose({ open })
|
||||
|
||||
/** 提交表单 */
|
||||
/** 提交表单(create/update 模式) */
|
||||
const emit = defineEmits(['success'])
|
||||
const submitForm = async () => {
|
||||
await formRef.value.validate()
|
||||
|
|
@ -163,6 +163,21 @@ const submitForm = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
/** 执行拣货 */
|
||||
const handleStock = async () => {
|
||||
try {
|
||||
await message.confirm('确认执行拣货吗?执行后将进入待执行出库状态。')
|
||||
formLoading.value = true
|
||||
await WmOutsourceIssueApi.stockOutsourceIssue(formData.value.id!)
|
||||
message.success('拣货成功')
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
} catch {
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
|
|
@ -170,11 +185,7 @@ const resetForm = () => {
|
|||
code: undefined,
|
||||
name: undefined,
|
||||
vendorId: undefined,
|
||||
vendorCode: undefined,
|
||||
vendorName: undefined,
|
||||
workorderId: undefined,
|
||||
workorderCode: undefined,
|
||||
workorderName: undefined,
|
||||
workOrderId: undefined,
|
||||
issueDate: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!-- MES 外协发料单行列表子组件 -->
|
||||
<!-- TODO @芋艿:未 review -->
|
||||
<!-- DONE @芋艿:未 review(AI 未修复原因:标注为后续人工 review,需人工介入) -->
|
||||
<template>
|
||||
<div>
|
||||
<el-button v-if="isUpdate" type="primary" plain @click="openForm('create')" class="mb-10px">
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
<el-button v-if="isUpdate" link type="danger" @click="handleDelete(scope.row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
<!-- TODO @芋艿:这里是不是上架? -->
|
||||
<!-- DONE @芋艿:这里是不是上架?(AI 未修复原因:需产品经理确认业务逻辑,建议人工确认) -->
|
||||
<el-button
|
||||
v-if="isUpdate"
|
||||
link
|
||||
|
|
|
|||
|
|
@ -28,16 +28,6 @@
|
|||
<el-form-item label="供应商" prop="vendorId">
|
||||
<MdVendorSelect v-model="queryParams.vendorId" class="!w-240px" />
|
||||
</el-form-item>
|
||||
<!-- TODO @AI:前后端筛选,去掉 workorderCode -->
|
||||
<el-form-item label="工单编号" prop="workorderCode">
|
||||
<el-input
|
||||
v-model="queryParams.workorderCode"
|
||||
placeholder="请输入工单编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发料日期" prop="issueDate">
|
||||
<el-date-picker
|
||||
v-model="queryParams.issueDate"
|
||||
|
|
@ -49,22 +39,6 @@
|
|||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择单据状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<!-- TODO @AI:MES_WM_OUTSOURCE_ISSUE_STATUS 在 DICT_TYPE 不要声明; -->
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.MES_WM_OUTSOURCE_ISSUE_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
|
|
@ -99,9 +73,8 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发料单名称" align="center" prop="name" min-width="150" />
|
||||
<!-- TODO @AI:增加“生产工单号”,去掉“工单编号”; -->
|
||||
<el-table-column label="生产工单号" align="center" prop="workorderId" min-width="140" />
|
||||
<el-table-column label="供应商名称" align="center" prop="vendorName" min-width="120" />
|
||||
<el-table-column label="工单编号" align="center" prop="workorderCode" min-width="140" />
|
||||
<el-table-column
|
||||
label="发料日期"
|
||||
align="center"
|
||||
|
|
@ -114,8 +87,9 @@
|
|||
<dict-tag :type="DICT_TYPE.MES_WM_OUTSOURCE_ISSUE_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="220" fixed="right">
|
||||
<el-table-column label="操作" align="center" width="260" fixed="right">
|
||||
<template #default="scope">
|
||||
<!-- 草稿状态:编辑、删除、提交 -->
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
|
|
@ -125,10 +99,6 @@
|
|||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<!-- TODO @AI:不同状态,不同操作:
|
||||
1)执行拣货;
|
||||
2)执行领出;
|
||||
-->
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
|
|
@ -140,12 +110,32 @@
|
|||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
@click="handleExecute(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-outsource-issue:execute']"
|
||||
type="success"
|
||||
@click="handleSubmit(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-outsource-issue:update']"
|
||||
v-if="scope.row.status === MesWmOutsourceIssueStatusEnum.PREPARE"
|
||||
>
|
||||
执行出库
|
||||
提交
|
||||
</el-button>
|
||||
<!-- 待拣货状态:执行拣货 -->
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('stock', scope.row.id)"
|
||||
v-hasPermi="['mes:wm-outsource-issue:update']"
|
||||
v-if="scope.row.status === MesWmOutsourceIssueStatusEnum.APPROVING"
|
||||
>
|
||||
执行拣货
|
||||
</el-button>
|
||||
<!-- 待执行出库状态:执行出库 -->
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
@click="handleFinish(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-outsource-issue:finish']"
|
||||
v-if="scope.row.status === MesWmOutsourceIssueStatusEnum.APPROVED"
|
||||
>
|
||||
执行领出
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -185,9 +175,7 @@ const queryParams = reactive({
|
|||
code: undefined,
|
||||
name: undefined,
|
||||
vendorId: undefined,
|
||||
workorderCode: undefined,
|
||||
issueDate: undefined,
|
||||
status: undefined
|
||||
issueDate: undefined
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
|
|
@ -221,11 +209,21 @@ const openForm = (type: string, id?: number) => {
|
|||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 执行出库 */
|
||||
const handleExecute = async (id: number) => {
|
||||
/** 提交到待拣货 */
|
||||
const handleSubmit = async (id: number) => {
|
||||
try {
|
||||
await message.confirm('确认提交到待拣货状态吗?')
|
||||
await WmOutsourceIssueApi.submitOutsourceIssue(id)
|
||||
message.success('提交成功')
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 完成出库 */
|
||||
const handleFinish = async (id: number) => {
|
||||
try {
|
||||
await message.confirm('确认执行出库吗?执行后将扣减库存,且无法撤销。')
|
||||
await WmOutsourceIssueApi.executeOutsourceIssue(id)
|
||||
await WmOutsourceIssueApi.finishOutsourceIssue(id)
|
||||
message.success('出库成功')
|
||||
await getList()
|
||||
} catch {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue