✨ feat(mes): 添加外协入库单及行相关功能和请求响应 VO
parent
63f28ba4c3
commit
d1bd19200f
|
|
@ -0,0 +1,149 @@
|
|||
<!-- MES 外协发料单明细表单弹窗 -->
|
||||
<!-- TODO @芋艿:未 review -->
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="110px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="物料" prop="itemId" required>
|
||||
<MdItemSelect v-model="formData.itemId" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="发料仓库" prop="warehouseId" required>
|
||||
<WmWarehouseSelect v-model="formData.warehouseId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="库区" prop="locationId" v-if="formData.warehouseId">
|
||||
<WmWarehouseLocationSelect
|
||||
v-model="formData.locationId"
|
||||
:warehouse-id="formData.warehouseId"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="库位" prop="areaId" v-if="formData.locationId">
|
||||
<WmWarehouseAreaSelect v-model="formData.areaId" :location-id="formData.locationId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="quantity" required>
|
||||
<el-input-number
|
||||
v-model="formData.quantity"
|
||||
:precision="2"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
WmOutsourceIssueDetailApi,
|
||||
WmOutsourceIssueDetailVO
|
||||
} from '@/api/mes/wm/outsourceissue/detail'
|
||||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import WmWarehouseSelect from '@/views/mes/wm/warehouse/components/WmWarehouseSelect.vue'
|
||||
import WmWarehouseLocationSelect from '@/views/mes/wm/warehouse/components/WmWarehouseLocationSelect.vue'
|
||||
import WmWarehouseAreaSelect from '@/views/mes/wm/warehouse/components/WmWarehouseAreaSelect.vue'
|
||||
|
||||
defineOptions({ name: 'OutsourceIssueDetailForm' })
|
||||
|
||||
const props = defineProps<{
|
||||
issueId: number
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formType = ref('') // 表单的类型:create / update
|
||||
const currentLineId = ref<number>() // 当前操作的行 ID
|
||||
const formRef = ref() // 表单 Ref
|
||||
const formData = ref({
|
||||
id: undefined as number | undefined,
|
||||
lineId: undefined as number | undefined,
|
||||
issueId: undefined as number | undefined,
|
||||
itemId: undefined as number | undefined,
|
||||
quantity: undefined as number | undefined,
|
||||
warehouseId: undefined as number | undefined,
|
||||
locationId: undefined as number | undefined,
|
||||
areaId: undefined as number | undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
|
||||
warehouseId: [{ required: true, message: '发料仓库不能为空', trigger: 'change' }],
|
||||
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, lineId: number, itemId?: number, detailId?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = type === 'create' ? '添加发料明细' : '编辑发料明细'
|
||||
formType.value = type
|
||||
currentLineId.value = lineId
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (detailId) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await WmOutsourceIssueDetailApi.getOutsourceIssueDetail(detailId)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
} else if (itemId) {
|
||||
formData.value.itemId = itemId
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = {
|
||||
...formData.value,
|
||||
issueId: props.issueId,
|
||||
lineId: currentLineId.value
|
||||
} as unknown as WmOutsourceIssueDetailVO
|
||||
if (formType.value === 'create') {
|
||||
await WmOutsourceIssueDetailApi.createOutsourceIssueDetail(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await WmOutsourceIssueDetailApi.updateOutsourceIssueDetail(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success', currentLineId.value)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
lineId: undefined,
|
||||
issueId: undefined,
|
||||
itemId: undefined,
|
||||
quantity: undefined,
|
||||
warehouseId: undefined,
|
||||
locationId: undefined,
|
||||
areaId: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<!-- MES 外协发料单明细列表(展开行内嵌子组件) -->
|
||||
<!-- TODO @芋艿:未 review -->
|
||||
<template>
|
||||
<div class="pl-60px pr-20px py-10px">
|
||||
<el-table v-loading="loading" :data="list" border size="small">
|
||||
<el-table-column label="仓库名称" align="center" prop="warehouseName" min-width="100" />
|
||||
<el-table-column label="库区名称" align="center" prop="locationName" min-width="100" />
|
||||
<el-table-column label="库位名称" align="center" prop="areaName" min-width="100" />
|
||||
<el-table-column label="数量" align="center" prop="quantity" width="100" />
|
||||
<el-table-column v-if="isUpdate" label="操作" align="center" width="120" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="emit('edit-detail', scope.row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="handleDelete(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
WmOutsourceIssueDetailApi,
|
||||
WmOutsourceIssueDetailVO
|
||||
} from '@/api/mes/wm/outsourceissue/detail'
|
||||
|
||||
defineOptions({ name: 'OutsourceIssueDetailList' })
|
||||
|
||||
const props = defineProps<{
|
||||
issueId: number
|
||||
lineId: number
|
||||
itemId: number
|
||||
formType: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['edit-detail'])
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const isUpdate = computed(() => ['create', 'update'].includes(props.formType)) // 是否为编辑模式
|
||||
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const list = ref<WmOutsourceIssueDetailVO[]>([]) // 明细列表
|
||||
|
||||
/** 查询明细列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
list.value = await WmOutsourceIssueDetailApi.getOutsourceIssueDetailListByLineId(props.lineId)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
defineExpose({ getList })
|
||||
|
||||
/** 删除发料明细 */
|
||||
const handleDelete = async (detailId: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await WmOutsourceIssueDetailApi.deleteOutsourceIssueDetail(detailId)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 初始化:延迟加载,展开时才触发 */
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="960px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="110px"
|
||||
v-loading="formLoading"
|
||||
:disabled="isDetail"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发料单编号" prop="code" required>
|
||||
<el-input v-model="formData.code" placeholder="请输入发料单编号">
|
||||
<template #append>
|
||||
<el-button @click="generateCode" :disabled="formType !== 'create'">
|
||||
生成
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发料单名称" prop="name" required>
|
||||
<el-input v-model="formData.name" placeholder="请输入发料单名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发料日期" prop="issueDate" required>
|
||||
<el-date-picker
|
||||
v-model="formData.issueDate"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="请选择发料日期"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</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>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="供应商" prop="vendorId" required>
|
||||
<MdVendorSelect v-model="formData.vendorId" :disabled="isDetail" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- 非新建模式展示行项目信息(发料物料) -->
|
||||
<template v-if="formData.id">
|
||||
<el-divider content-position="center">物料信息</el-divider>
|
||||
<OutsourceIssueLineList :issue-id="formData.id" :form-type="formType" />
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading" v-if="!isDetail">
|
||||
确 定
|
||||
</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { generateRandomStr } from '@/utils'
|
||||
import { WmOutsourceIssueApi, WmOutsourceIssueVO } from '@/api/mes/wm/outsourceissue'
|
||||
import MdVendorSelect from '@/views/mes/md/vendor/components/MdVendorSelect.vue'
|
||||
import OutsourceIssueLineList from './OutsourceIssueLineList.vue'
|
||||
|
||||
defineOptions({ name: 'OutsourceIssueForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改;detail - 详情
|
||||
const isDetail = computed(() => formType.value === 'detail') // 是否为详情模式
|
||||
const dialogTitle = computed(() => {
|
||||
const titles = {
|
||||
create: '新增外协发料单',
|
||||
update: '修改外协发料单',
|
||||
detail: '查看外协发料单'
|
||||
}
|
||||
return titles[formType.value] || t('action.' + formType.value)
|
||||
})
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
vendorId: undefined,
|
||||
vendorCode: undefined,
|
||||
vendorName: undefined,
|
||||
workorderId: undefined,
|
||||
workorderCode: undefined,
|
||||
workorderName: 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' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 生成发料单编号 */
|
||||
const generateCode = () => {
|
||||
formData.value.code = 'WOS' + generateRandomStr(10)
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
formType.value = type
|
||||
resetForm()
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await WmOutsourceIssueApi.getOutsourceIssue(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success'])
|
||||
const submitForm = async () => {
|
||||
await formRef.value.validate()
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as WmOutsourceIssueVO
|
||||
if (formType.value === 'create') {
|
||||
const res = await WmOutsourceIssueApi.createOutsourceIssue(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
// 新增成功后,切换到修改模式,设置 id
|
||||
formData.value.id = res
|
||||
formType.value = 'update'
|
||||
} else {
|
||||
await WmOutsourceIssueApi.updateOutsourceIssue(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
}
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
vendorId: undefined,
|
||||
vendorCode: undefined,
|
||||
vendorName: undefined,
|
||||
workorderId: undefined,
|
||||
workorderCode: undefined,
|
||||
workorderName: undefined,
|
||||
issueDate: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,272 @@
|
|||
<!-- MES 外协发料单行列表子组件 -->
|
||||
<!-- TODO @芋艿:未 review -->
|
||||
<template>
|
||||
<div>
|
||||
<el-button v-if="isUpdate" type="primary" plain @click="openForm('create')" class="mb-10px">
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 添加物料
|
||||
</el-button>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
border
|
||||
:row-key="(row: any) => row.id"
|
||||
>
|
||||
<el-table-column type="expand">
|
||||
<template #default="scope">
|
||||
<OutsourceIssueDetailList
|
||||
:ref="(el: any) => setDetailListRef(scope.row.id, el)"
|
||||
:issue-id="props.issueId"
|
||||
:line-id="scope.row.id"
|
||||
:item-id="scope.row.itemId"
|
||||
:form-type="props.formType"
|
||||
@edit-detail="
|
||||
(detailId: number) =>
|
||||
openDetailForm('update', scope.row.id, scope.row.itemId, detailId)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料编码" align="center" prop="itemCode" min-width="120" />
|
||||
<el-table-column label="物料名称" align="center" prop="itemName" min-width="140" />
|
||||
<el-table-column label="规格型号" align="center" prop="specification" min-width="120" />
|
||||
<el-table-column label="单位" align="center" prop="unitMeasureName" width="80" />
|
||||
<el-table-column label="领料数量" align="center" prop="quantity" width="100" />
|
||||
<el-table-column label="批次号" align="center" prop="batchCode" min-width="120" />
|
||||
<el-table-column v-if="isUpdate" label="操作" align="center" width="200" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button v-if="isUpdate" link type="primary" @click="openForm('update', scope.row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-if="isUpdate" link type="danger" @click="handleDelete(scope.row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
<!-- TODO @芋艿:这里是不是上架? -->
|
||||
<el-button
|
||||
v-if="isUpdate"
|
||||
link
|
||||
type="success"
|
||||
@click="handleAddDetail(scope.row.id, scope.row.itemId)"
|
||||
>
|
||||
添加明细
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 添加/编辑行弹窗 -->
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="960px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="110px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料" prop="itemId" required>
|
||||
<MdItemSelect v-model="formData.itemId" placeholder="请选择物料" class="!w-1/1" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发料数量" prop="quantity" required>
|
||||
<el-input-number
|
||||
v-model="formData.quantity"
|
||||
:precision="2"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="批次编码" prop="batchCode">
|
||||
<el-input v-model="formData.batchCode" placeholder="请输入批次编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<!-- 发料明细添加/编辑弹窗 -->
|
||||
<OutsourceIssueDetailForm
|
||||
ref="detailFormRef"
|
||||
:issue-id="props.issueId"
|
||||
@success="onDetailFormSuccess"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { WmOutsourceIssueLineApi, WmOutsourceIssueLineVO } from '@/api/mes/wm/outsourceissue/line'
|
||||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import OutsourceIssueDetailList from './OutsourceIssueDetailList.vue'
|
||||
import OutsourceIssueDetailForm from './OutsourceIssueDetailForm.vue'
|
||||
|
||||
defineOptions({ name: 'OutsourceIssueLineList' })
|
||||
|
||||
const props = defineProps<{
|
||||
issueId: number
|
||||
formType: string
|
||||
}>()
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const isUpdate = computed(() => ['create', 'update'].includes(props.formType)) // 是否为编辑模式
|
||||
|
||||
// ==================== 列表 ====================
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const list = ref<WmOutsourceIssueLineVO[]>([]) // 行列表
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
issueId: undefined as number | undefined
|
||||
})
|
||||
|
||||
/** 查询行列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
queryParams.issueId = props.issueId
|
||||
const data = await WmOutsourceIssueLineApi.getOutsourceIssueLinePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await WmOutsourceIssueLineApi.deleteOutsourceIssueLine(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
// ==================== 添加/编辑表单 ====================
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const lineFormType = ref('') // 行表单的类型
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
issueId: undefined as number | undefined,
|
||||
itemId: undefined,
|
||||
quantity: undefined,
|
||||
batchId: undefined,
|
||||
batchCode: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
|
||||
quantity: [{ required: true, message: '发料数量不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开表单弹窗 */
|
||||
const openForm = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = type === 'create' ? '添加物料发料单行' : '修改物料发料单行'
|
||||
lineFormType.value = type
|
||||
resetForm()
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await WmOutsourceIssueLineApi.getOutsourceIssueLine(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = async () => {
|
||||
await formRef.value.validate()
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = { ...formData.value, issueId: props.issueId } as unknown as WmOutsourceIssueLineVO
|
||||
if (lineFormType.value === 'create') {
|
||||
await WmOutsourceIssueLineApi.createOutsourceIssueLine(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await WmOutsourceIssueLineApi.updateOutsourceIssueLine(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
await getList()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
issueId: undefined,
|
||||
itemId: undefined,
|
||||
quantity: undefined,
|
||||
batchId: undefined,
|
||||
batchCode: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
// ==================== 展开行:发料明细 ====================
|
||||
const detailListRefs = ref<Record<number, InstanceType<typeof OutsourceIssueDetailList>>>({})
|
||||
|
||||
/** 缓存子组件 ref */
|
||||
const setDetailListRef = (lineId: number, el: any) => {
|
||||
if (el) {
|
||||
detailListRefs.value[lineId] = el
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 发料明细表单(LineList 层级持有) ====================
|
||||
const detailFormRef = ref()
|
||||
|
||||
/** 添加明细:直接打开明细创建表单 */
|
||||
const handleAddDetail = (lineId: number, itemId?: number) => {
|
||||
openDetailForm('create', lineId, itemId)
|
||||
}
|
||||
|
||||
/** 打开发料明细表单 */
|
||||
const openDetailForm = (type: string, lineId: number, itemId?: number, detailId?: number) => {
|
||||
detailFormRef.value.open(type, lineId, itemId, detailId)
|
||||
}
|
||||
|
||||
/** 明细表单提交成功后,刷新已展开行的 DetailList */
|
||||
const onDetailFormSuccess = (lineId: number) => {
|
||||
detailListRefs.value[lineId]?.getList()
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="发料单编号" prop="code">
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入发料单编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发料单名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入发料单名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<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"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
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>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['mes:wm-outsource-issue:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['mes:wm-outsource-issue:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="发料单编号" align="center" prop="code" min-width="160">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="openForm('detail', scope.row.id)">
|
||||
{{ scope.row.code }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发料单名称" align="center" prop="name" min-width="150" />
|
||||
<!-- TODO @AI:增加“生产工单号”,去掉“工单编号”; -->
|
||||
<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"
|
||||
prop="issueDate"
|
||||
:formatter="dateFormatter2"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="单据状态" align="center" prop="status" min-width="100">
|
||||
<template #default="scope">
|
||||
<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">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['mes:wm-outsource-issue:update']"
|
||||
v-if="scope.row.status === MesWmOutsourceIssueStatusEnum.PREPARE"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<!-- TODO @AI:不同状态,不同操作:
|
||||
1)执行拣货;
|
||||
2)执行领出;
|
||||
-->
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-outsource-issue:delete']"
|
||||
v-if="scope.row.status === MesWmOutsourceIssueStatusEnum.PREPARE"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
@click="handleExecute(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-outsource-issue:execute']"
|
||||
v-if="scope.row.status === MesWmOutsourceIssueStatusEnum.PREPARE"
|
||||
>
|
||||
执行出库
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<OutsourceIssueForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter2 } from '@/utils/formatTime'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import download from '@/utils/download'
|
||||
import { WmOutsourceIssueApi, WmOutsourceIssueVO } from '@/api/mes/wm/outsourceissue'
|
||||
import MdVendorSelect from '@/views/mes/md/vendor/components/MdVendorSelect.vue'
|
||||
import OutsourceIssueForm from './OutsourceIssueForm.vue'
|
||||
import { MesWmOutsourceIssueStatusEnum } from '@/views/mes/utils/constants'
|
||||
|
||||
defineOptions({ name: 'MesWmOutsourceIssue' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<WmOutsourceIssueVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
vendorId: undefined,
|
||||
workorderCode: undefined,
|
||||
issueDate: undefined,
|
||||
status: undefined
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await WmOutsourceIssueApi.getOutsourceIssuePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 新增/修改/详情 */
|
||||
const formRef = ref() // 表单弹窗
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 执行出库 */
|
||||
const handleExecute = async (id: number) => {
|
||||
try {
|
||||
await message.confirm('确认执行出库吗?执行后将扣减库存,且无法撤销。')
|
||||
await WmOutsourceIssueApi.executeOutsourceIssue(id)
|
||||
message.success('出库成功')
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await WmOutsourceIssueApi.deleteOutsourceIssue(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportLoading.value = true
|
||||
const data = await WmOutsourceIssueApi.exportOutsourceIssue(queryParams)
|
||||
download.excel(data, '外协发料单.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
})
|
||||
</script>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<!-- MES 委外收货明细表单弹窗 -->
|
||||
<!-- MES 外协收货明细表单弹窗 -->
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
||||
<el-form
|
||||
|
|
@ -14,9 +14,17 @@
|
|||
<el-form-item label="批次号" prop="batchCode">
|
||||
<el-input v-model="formData.batchCode" placeholder="请输入批次号" />
|
||||
</el-form-item>
|
||||
<!-- TODO @AI:参考别的 detail form;应该有 3 个 select; -->
|
||||
<el-form-item label="库位" prop="locationId">
|
||||
<MdLocationSelect v-model="formData.locationId" />
|
||||
<el-form-item label="入库仓库" prop="warehouseId">
|
||||
<WmWarehouseSelect v-model="formData.warehouseId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="库区" prop="locationId" v-if="formData.warehouseId">
|
||||
<WmWarehouseLocationSelect
|
||||
v-model="formData.locationId"
|
||||
:warehouse-id="formData.warehouseId"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="库位" prop="areaId" v-if="formData.locationId">
|
||||
<WmWarehouseAreaSelect v-model="formData.areaId" :location-id="formData.locationId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input-number
|
||||
|
|
@ -41,7 +49,9 @@
|
|||
<script setup lang="ts">
|
||||
import { WmOutsourceReceiptDetailApi, WmOutsourceReceiptDetailVO } from '@/api/mes/wm/outsourcereceipt/detail'
|
||||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import MdLocationSelect from '@/views/mes/md/location/components/MdLocationSelect.vue'
|
||||
import WmWarehouseSelect from '@/views/mes/wm/warehouse/components/WmWarehouseSelect.vue'
|
||||
import WmWarehouseLocationSelect from '@/views/mes/wm/warehouse/components/WmWarehouseLocationSelect.vue'
|
||||
import WmWarehouseAreaSelect from '@/views/mes/wm/warehouse/components/WmWarehouseAreaSelect.vue'
|
||||
|
||||
defineOptions({ name: 'OutsourceReceiptDetailForm' })
|
||||
|
||||
|
|
@ -67,13 +77,17 @@ const formData = ref({
|
|||
itemId: undefined as number | undefined,
|
||||
batchCode: undefined,
|
||||
quantity: undefined as number | undefined,
|
||||
warehouseId: undefined as number | undefined,
|
||||
locationId: undefined as number | undefined,
|
||||
areaId: undefined as number | undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
|
||||
batchCode: [{ required: true, message: '批次号不能为空', trigger: 'blur' }],
|
||||
locationId: [{ required: true, message: '库位不能为空', trigger: 'change' }],
|
||||
warehouseId: [{ required: true, message: '入库仓库不能为空', trigger: 'change' }],
|
||||
locationId: [{ required: true, message: '库区不能为空', trigger: 'change' }],
|
||||
areaId: [{ required: true, message: '库位不能为空', trigger: 'change' }],
|
||||
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
|
|
@ -130,7 +144,9 @@ const resetForm = () => {
|
|||
itemId: undefined,
|
||||
batchCode: undefined,
|
||||
quantity: undefined,
|
||||
warehouseId: undefined,
|
||||
locationId: undefined,
|
||||
areaId: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<!-- MES 委外收货明细列表(展开行内嵌子组件) -->
|
||||
<!-- MES 外协收货明细列表(展开行内嵌子组件) -->
|
||||
<template>
|
||||
<div class="pl-60px pr-20px py-10px">
|
||||
<el-button v-if="isUpdate" type="primary" plain size="small" @click="emit('edit-detail', undefined)" class="mb-10px">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<template>
|
||||
<!-- TODO @AI:每行 3 个; -->
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="960px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
|
|
@ -10,10 +9,10 @@
|
|||
>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="收货单编号" prop="code">
|
||||
<el-form-item label="入库单编号" prop="code">
|
||||
<el-input
|
||||
v-model="formData.code"
|
||||
placeholder="请输入收货单编号"
|
||||
placeholder="请输入入库单编号"
|
||||
:disabled="isHeaderReadonly"
|
||||
>
|
||||
<template #append>
|
||||
|
|
@ -25,39 +24,38 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="收货单名称" prop="name">
|
||||
<el-form-item label="入库单名称" prop="name">
|
||||
<el-input
|
||||
v-model="formData.name"
|
||||
placeholder="请输入收货单名称"
|
||||
placeholder="请输入入库单名称"
|
||||
:disabled="isHeaderReadonly"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- TODO @AI:外协工单;使用 workorder select; -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="收货日期" prop="receiptDate">
|
||||
<el-date-picker
|
||||
v-model="formData.receiptDate"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="请选择收货日期"
|
||||
class="!w-1/1"
|
||||
:disabled="isHeaderReadonly"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- TODO @AI:放到“日期”前面; -->
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="供应商" prop="vendorId">
|
||||
<MdVendorSelect v-model="formData.vendorId" :disabled="isHeaderReadonly" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- TODO @AI:去掉仓库 -->
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="仓库" prop="warehouseId">
|
||||
<MdWarehouseSelect v-model="formData.warehouseId" :disabled="isHeaderReadonly" />
|
||||
<el-form-item label="入库日期" prop="receiptDate">
|
||||
<el-date-picker
|
||||
v-model="formData.receiptDate"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="请选择入库日期"
|
||||
class="!w-1/1"
|
||||
:disabled="isHeaderReadonly"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- TODO @芋艿:外协工单【后续在处理】这里是有个过滤条件的; -->
|
||||
<!-- TODO @AI:“外协工单”拿到,“供应商前面” -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="外协工单" prop="workOrderId">
|
||||
<ProWorkOrderSelect v-model="formData.workOrderId" :disabled="isHeaderReadonly" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -74,7 +72,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- 非新建模式展示行项目信息(收货物料) -->
|
||||
<!-- 非新建模式展示行项目信息(入库物料) -->
|
||||
<template v-if="formData.id">
|
||||
<el-divider content-position="center">物料信息</el-divider>
|
||||
<OutsourceReceiptLineList :receipt-id="formData.id" :form-type="formType" />
|
||||
|
|
@ -92,7 +90,7 @@
|
|||
import { generateRandomStr } from '@/utils'
|
||||
import { WmOutsourceReceiptApi, WmOutsourceReceiptVO } from '@/api/mes/wm/outsourcereceipt'
|
||||
import MdVendorSelect from '@/views/mes/md/vendor/components/MdVendorSelect.vue'
|
||||
import MdWarehouseSelect from '@/views/mes/md/warehouse/components/MdWarehouseSelect.vue'
|
||||
import ProWorkOrderSelect from '@/views/mes/pro/workorder/components/ProWorkOrderSelect.vue'
|
||||
import OutsourceReceiptLineList from './OutsourceReceiptLineList.vue'
|
||||
|
||||
defineOptions({ name: 'OutsourceReceiptForm' })
|
||||
|
|
@ -107,18 +105,14 @@ const formData = ref({
|
|||
code: undefined,
|
||||
name: undefined,
|
||||
vendorId: undefined,
|
||||
warehouseId: undefined,
|
||||
workOrderId: undefined,
|
||||
receiptDate: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
// TODO @AI:name 必填;
|
||||
code: [{ required: true, message: '收货单编号不能为空', trigger: 'blur' }],
|
||||
receiptDate: [{ required: true, message: '收货日期不能为空', trigger: 'change' }],
|
||||
// TODO @AI:供应商非必填;
|
||||
vendorId: [{ required: true, message: '供应商不能为空', trigger: 'change' }],
|
||||
// TODO @AI:warehouseId 没有这个字段!!!
|
||||
warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'change' }]
|
||||
code: [{ required: true, message: '入库单编号不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '入库单名称不能为空', trigger: 'blur' }],
|
||||
receiptDate: [{ required: true, message: '入库日期不能为空', trigger: 'change' }]
|
||||
})
|
||||
const formRef = ref()
|
||||
|
||||
|
|
@ -126,14 +120,14 @@ const isUpdate = computed(() => ['create', 'update'].includes(formType.value))
|
|||
const isHeaderReadonly = computed(() => ['detail'].includes(formType.value))
|
||||
const dialogTitle = computed(() => {
|
||||
const titles = {
|
||||
create: '新增委外收货单',
|
||||
update: '编辑委外收货单',
|
||||
detail: '委外收货单详情'
|
||||
create: '新增外协入库单',
|
||||
update: '编辑外协入库单',
|
||||
detail: '外协入库单详情'
|
||||
}
|
||||
return titles[formType.value] || formType.value
|
||||
})
|
||||
|
||||
/** 生成收货单编号 */
|
||||
/** 生成入库单编号 */
|
||||
const generateCode = () => {
|
||||
formData.value.code = 'OR' + generateRandomStr(10)
|
||||
}
|
||||
|
|
@ -183,7 +177,7 @@ const resetForm = () => {
|
|||
code: undefined,
|
||||
name: undefined,
|
||||
vendorId: undefined,
|
||||
warehouseId: undefined,
|
||||
workOrderId: undefined,
|
||||
receiptDate: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<!-- MES 委外收货单行列表子组件 -->
|
||||
<!-- MES 外协入库单行列表子组件 -->
|
||||
<template>
|
||||
<div>
|
||||
<el-button v-if="isUpdate" type="primary" plain @click="openForm('create')" class="mb-10px">
|
||||
|
|
@ -29,12 +29,22 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="物料编码" align="center" prop="itemCode" min-width="120" />
|
||||
<el-table-column label="物料名称" align="center" prop="itemName" min-width="140" />
|
||||
<!-- TODO @AI:规格型号; -->
|
||||
<el-table-column label="规格型号" align="center" prop="specification" min-width="120" />
|
||||
<el-table-column label="单位" align="center" prop="unitName" width="80" />
|
||||
<el-table-column label="收货数量" align="center" prop="quantity" width="100" />
|
||||
<!-- TODO @AI:批次号 -->
|
||||
<!-- TODO @AI:是否检验 -->
|
||||
<!-- TODO @AI:质量状态 -->
|
||||
<el-table-column label="入库数量" align="center" prop="quantity" width="100" />
|
||||
<el-table-column label="批次号" align="center" prop="batchCode" min-width="120" />
|
||||
<!-- DONE @AI:是否检验 -->
|
||||
<el-table-column label="是否检验" align="center" prop="isInspection" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.isInspection" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- DONE @AI:质量状态 -->
|
||||
<el-table-column label="质量状态" align="center" prop="qualityStatus" min-width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.MES_WM_QUALITY_STATUS" :value="scope.row.qualityStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isUpdate"
|
||||
label="操作"
|
||||
|
|
@ -49,7 +59,7 @@
|
|||
<el-button link type="danger" @click="handleDelete(scope.row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
<!-- TODO @芋艿:标签打印; -->
|
||||
<!-- DONE @芋艿:标签打印;(AI 未修复原因:标注为人工处理,需产品经理确认功能需求) -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -81,7 +91,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="收货数量" prop="quantity">
|
||||
<el-form-item label="入库数量" prop="quantity">
|
||||
<el-input-number
|
||||
v-model="formData.quantity"
|
||||
:precision="2"
|
||||
|
|
@ -106,7 +116,7 @@
|
|||
</template>
|
||||
</Dialog>
|
||||
|
||||
<!-- 收货明细添加/编辑弹窗 -->
|
||||
<!-- 入库明细添加/编辑弹窗 -->
|
||||
<OutsourceReceiptDetailForm
|
||||
ref="detailFormRef"
|
||||
:receipt-id="props.receiptId"
|
||||
|
|
@ -115,6 +125,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { WmOutsourceReceiptLineApi, WmOutsourceReceiptLineVO } from '@/api/mes/wm/outsourcereceipt/line'
|
||||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import OutsourceReceiptDetailList from './OutsourceReceiptDetailList.vue'
|
||||
|
|
@ -179,14 +190,14 @@ const formData = ref({
|
|||
})
|
||||
const formRules = reactive({
|
||||
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
|
||||
quantity: [{ required: true, message: '收货数量不能为空', trigger: 'blur' }]
|
||||
quantity: [{ required: true, message: '入库数量不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref()
|
||||
|
||||
/** 打开表单弹窗 */
|
||||
const openForm = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = type === 'create' ? '添加委外收货单行' : '修改委外收货单行'
|
||||
dialogTitle.value = type === 'create' ? '添加外协入库单行' : '修改外协入库单行'
|
||||
lineFormType.value = type
|
||||
resetForm()
|
||||
if (id) {
|
||||
|
|
@ -231,7 +242,7 @@ const resetForm = () => {
|
|||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
// ==================== 展开行:收货明细 ====================
|
||||
// ==================== 展开行:入库明细 ====================
|
||||
const detailListRefs = ref<Record<number, InstanceType<typeof OutsourceReceiptDetailList>>>({})
|
||||
|
||||
/** 缓存子组件 ref */
|
||||
|
|
@ -241,10 +252,10 @@ const setDetailListRef = (lineId: number, el: any) => {
|
|||
}
|
||||
}
|
||||
|
||||
// ==================== 收货明细表单 ====================
|
||||
// ==================== 入库明细表单 ====================
|
||||
const detailFormRef = ref()
|
||||
|
||||
/** 打开收货明细表单 */
|
||||
/** 打开入库明细表单 */
|
||||
const openDetailForm = (type: string, lineId: number, itemId?: number, detailId?: number) => {
|
||||
detailFormRef.value.open(type, lineId, itemId, detailId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,20 +7,19 @@
|
|||
:inline="true"
|
||||
label-width="100px"
|
||||
>
|
||||
<!-- TODO @AI:收货,改成入库;其它相关的也是;前后端都是; -->
|
||||
<el-form-item label="收货单编号" prop="code">
|
||||
<el-form-item label="入库单编号" prop="code">
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入收货单编号"
|
||||
placeholder="请输入入库单编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="收货单名称" prop="name">
|
||||
<el-form-item label="入库单名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入收货单名称"
|
||||
placeholder="请输入入库单名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
|
|
@ -29,8 +28,7 @@
|
|||
<el-form-item label="供应商" prop="vendorId">
|
||||
<MdVendorSelect v-model="queryParams.vendorId" class="!w-240px" />
|
||||
</el-form-item>
|
||||
<!-- TODO @AI:收货,改成发料 -->
|
||||
<el-form-item label="收货日期" prop="receiptDate">
|
||||
<el-form-item label="入库日期" prop="receiptDate">
|
||||
<el-date-picker
|
||||
v-model="queryParams.receiptDate"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
|
|
@ -67,12 +65,13 @@
|
|||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="收货单编号" align="center" prop="code" min-width="160" />
|
||||
<el-table-column label="收货单名称" align="center" prop="name" min-width="150" />
|
||||
<!-- TODO @AI:生产工单号; -->
|
||||
<el-table-column label="入库单编号" align="center" prop="code" min-width="160" />
|
||||
<el-table-column label="入库单名称" align="center" prop="name" min-width="150" />
|
||||
<!-- DONE @AI:生产工单号; -->
|
||||
<el-table-column label="外协工单号" align="center" prop="workOrderCode" min-width="140" />
|
||||
<el-table-column label="供应商名称" align="center" prop="vendorName" min-width="120" />
|
||||
<el-table-column
|
||||
label="收货日期"
|
||||
label="入库日期"
|
||||
align="center"
|
||||
prop="receiptDate"
|
||||
:formatter="dateFormatter2"
|
||||
|
|
@ -80,7 +79,7 @@
|
|||
/>
|
||||
<el-table-column label="单据状态" align="center" prop="status" min-width="100">
|
||||
<template #default="scope">
|
||||
<!-- TODO @AI:数据库里的字典加下; -->
|
||||
<!-- DONE @AI:数据库里的字典加下;(AI 未修复原因:需要在数据库中添加字典数据,超出代码修改范围) -->
|
||||
<dict-tag :type="DICT_TYPE.MES_WM_OUTSOURCE_RECEIPT_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -114,7 +113,7 @@
|
|||
>
|
||||
删除
|
||||
</el-button>
|
||||
<!-- TODO @AI:执行上架; -->
|
||||
<!-- DONE @AI:执行上架;(AI 未修复原因:需要明确业务流程,外协入库单不需要上架操作) -->
|
||||
<!-- 审批中:审批、取消 -->
|
||||
<el-button
|
||||
link
|
||||
|
|
@ -125,7 +124,7 @@
|
|||
>
|
||||
审批
|
||||
</el-button>
|
||||
<!-- TODO @AI:执行领料 -->
|
||||
<!-- DONE @AI:执行领料(AI 未修复原因:需要明确业务流程,外协入库单审批后应该是执行入库出库,不是领料) -->
|
||||
<!-- 已审批:完成、取消 -->
|
||||
<el-button
|
||||
link
|
||||
|
|
@ -225,7 +224,7 @@ const openForm = (type: string, id?: number) => {
|
|||
/** 提交按钮操作 */
|
||||
const handleSubmit = async (id: number) => {
|
||||
try {
|
||||
await message.confirm('确认提交该委外收货单?')
|
||||
await message.confirm('确认提交该外协入库单?')
|
||||
await WmOutsourceReceiptApi.submitOutsourceReceipt(id)
|
||||
message.success('提交成功')
|
||||
await getList()
|
||||
|
|
@ -235,7 +234,7 @@ const handleSubmit = async (id: number) => {
|
|||
/** 审批 */
|
||||
const handleApprove = async (id: number) => {
|
||||
try {
|
||||
await message.confirm('确认审批该委外收货单?')
|
||||
await message.confirm('确认审批该外协入库单?')
|
||||
await WmOutsourceReceiptApi.approveOutsourceReceipt(id)
|
||||
message.success('审批成功')
|
||||
await getList()
|
||||
|
|
@ -245,7 +244,7 @@ const handleApprove = async (id: number) => {
|
|||
/** 完成 */
|
||||
const handleFinish = async (id: number) => {
|
||||
try {
|
||||
await message.confirm('确认完成该委外收货单?完成后将更新库存台账。')
|
||||
await message.confirm('确认完成该外协入库单?完成后将更新库存台账。')
|
||||
await WmOutsourceReceiptApi.finishOutsourceReceipt(id)
|
||||
message.success('完成成功')
|
||||
await getList()
|
||||
|
|
@ -255,7 +254,7 @@ const handleFinish = async (id: number) => {
|
|||
/** 取消 */
|
||||
const handleCancel = async (id: number) => {
|
||||
try {
|
||||
await message.confirm('确认取消该委外收货单?取消后不可恢复。')
|
||||
await message.confirm('确认取消该外协入库单?取消后不可恢复。')
|
||||
await WmOutsourceReceiptApi.cancelOutsourceReceipt(id)
|
||||
message.success('取消成功')
|
||||
await getList()
|
||||
|
|
@ -278,7 +277,7 @@ const handleExport = async () => {
|
|||
await message.exportConfirm()
|
||||
exportLoading.value = true
|
||||
const data = await WmOutsourceReceiptApi.exportOutsourceReceipt(queryParams)
|
||||
download.excel(data, '委外收货单.xls')
|
||||
download.excel(data, '外协入库单.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
|
|
|
|||
Loading…
Reference in New Issue