✨ feat(wm): 删除多余的 productproduct 界面
parent
d6fc4ad3ef
commit
6a7fd807b8
|
|
@ -1,47 +0,0 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// MES 生产入库明细 VO
|
||||
export interface WmProductProduceDetailVO {
|
||||
id?: number
|
||||
produceId: number
|
||||
lineId: number
|
||||
itemId: number
|
||||
quantity: number
|
||||
batchId?: number
|
||||
batchCode?: string
|
||||
warehouseId: number
|
||||
warehouseName?: string
|
||||
locationId?: number
|
||||
locationName?: string
|
||||
areaId?: number
|
||||
areaName?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// MES 生产入库明细 API
|
||||
export const WmProductProduceDetailApi = {
|
||||
// 查询生产入库明细列表(按行编号)
|
||||
getProductProduceDetailListByLineId: async (lineId: number) => {
|
||||
return await request.get({ url: '/mes/wm/product-produce-detail/list-by-line', params: { lineId } })
|
||||
},
|
||||
|
||||
// 查询生产入库明细详情
|
||||
getProductProduceDetail: async (id: number) => {
|
||||
return await request.get({ url: '/mes/wm/product-produce-detail/get?id=' + id })
|
||||
},
|
||||
|
||||
// 新增生产入库明细
|
||||
createProductProduceDetail: async (data: WmProductProduceDetailVO) => {
|
||||
return await request.post({ url: '/mes/wm/product-produce-detail/create', data })
|
||||
},
|
||||
|
||||
// 修改生产入库明细
|
||||
updateProductProduceDetail: async (data: WmProductProduceDetailVO) => {
|
||||
return await request.put({ url: '/mes/wm/product-produce-detail/update', data })
|
||||
},
|
||||
|
||||
// 删除生产入库明细
|
||||
deleteProductProduceDetail: async (id: number) => {
|
||||
return await request.delete({ url: '/mes/wm/product-produce-detail/delete?id=' + id })
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// MES 生产入库单 VO
|
||||
export interface WmProductProduceVO {
|
||||
id?: number
|
||||
workOrderId?: number
|
||||
workOrderCode?: string
|
||||
feedbackId?: number
|
||||
taskId?: number
|
||||
workstationId?: number
|
||||
workstationCode?: string
|
||||
workstationName?: string
|
||||
processId?: number
|
||||
processCode?: string
|
||||
processName?: string
|
||||
produceDate?: string
|
||||
status?: number
|
||||
remark?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
// MES 生产入库单 API
|
||||
export const WmProductProduceApi = {
|
||||
// 查询生产入库单分页
|
||||
getProductProducePage: async (params: any) => {
|
||||
return await request.get({ url: '/mes/wm/product-produce/page', params })
|
||||
},
|
||||
|
||||
// 查询生产入库单详情
|
||||
getProductProduce: async (id: number) => {
|
||||
return await request.get({ url: '/mes/wm/product-produce/get?id=' + id })
|
||||
},
|
||||
|
||||
// 新增生产入库单
|
||||
createProductProduce: async (data: WmProductProduceVO) => {
|
||||
return await request.post({ url: '/mes/wm/product-produce/create', data })
|
||||
},
|
||||
|
||||
// 修改生产入库单
|
||||
updateProductProduce: async (data: WmProductProduceVO) => {
|
||||
return await request.put({ url: '/mes/wm/product-produce/update', data })
|
||||
},
|
||||
|
||||
// 删除生产入库单
|
||||
deleteProductProduce: async (id: number) => {
|
||||
return await request.delete({ url: '/mes/wm/product-produce/delete?id=' + id })
|
||||
},
|
||||
|
||||
// 完成生产入库单(执行入库)
|
||||
finishProductProduce: async (id: number) => {
|
||||
return await request.put({ url: '/mes/wm/product-produce/finish?id=' + id })
|
||||
},
|
||||
|
||||
// 取消生产入库单
|
||||
cancelProductProduce: async (id: number) => {
|
||||
return await request.put({ url: '/mes/wm/product-produce/cancel?id=' + id })
|
||||
},
|
||||
|
||||
// 校验生产入库单数量(每行明细数量之和是否等于行入库数量)
|
||||
checkProductProduceQuantity: async (id: number) => {
|
||||
return await request.get({ url: '/mes/wm/product-produce/check-quantity?id=' + id })
|
||||
},
|
||||
|
||||
// 导出生产入库单 Excel
|
||||
exportProductProduceExcel: async (params: any) => {
|
||||
return await request.download({ url: '/mes/wm/product-produce/export-excel', params })
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// MES 生产入库单行 VO
|
||||
export interface WmProductProduceLineVO {
|
||||
id?: number
|
||||
produceId: number
|
||||
itemId: number
|
||||
itemCode?: string
|
||||
itemName?: string
|
||||
specification?: string
|
||||
unitMeasureName?: string
|
||||
quantity: number
|
||||
batchCode?: string
|
||||
lotNumber?: string
|
||||
expireDate?: string
|
||||
qualityStatus?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// MES 生产入库单行 API
|
||||
export const WmProductProduceLineApi = {
|
||||
// 查询生产入库单行分页
|
||||
getProductProduceLinePage: async (params: any) => {
|
||||
return await request.get({ url: '/mes/wm/product-produce-line/page', params })
|
||||
},
|
||||
|
||||
// 查询生产入库单行详情
|
||||
getProductProduceLine: async (id: number) => {
|
||||
return await request.get({ url: '/mes/wm/product-produce-line/get?id=' + id })
|
||||
},
|
||||
|
||||
// 新增生产入库单行
|
||||
createProductProduceLine: async (data: WmProductProduceLineVO) => {
|
||||
return await request.post({ url: '/mes/wm/product-produce-line/create', data })
|
||||
},
|
||||
|
||||
// 修改生产入库单行
|
||||
updateProductProduceLine: async (data: WmProductProduceLineVO) => {
|
||||
return await request.put({ url: '/mes/wm/product-produce-line/update', data })
|
||||
},
|
||||
|
||||
// 删除生产入库单行
|
||||
deleteProductProduceLine: async (id: number) => {
|
||||
return await request.delete({ url: '/mes/wm/product-produce-line/delete?id=' + id })
|
||||
},
|
||||
|
||||
// 查询生产入库单行列表(按入库单编号)
|
||||
getProductProduceLineListByProduceId: async (produceId: number) => {
|
||||
return await request.get({ url: '/mes/wm/product-produce-line/list-by-produce', params: { produceId } })
|
||||
}
|
||||
}
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
<!-- MES 生产入库明细表单弹窗 -->
|
||||
<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">
|
||||
<MdItemSelect v-model="formData.itemId" disabled />
|
||||
</el-form-item>
|
||||
<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="batchCode">
|
||||
<el-input v-model="formData.batchCode" placeholder="请输入批次号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<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 {
|
||||
WmProductProduceDetailApi,
|
||||
WmProductProduceDetailVO
|
||||
} from '@/api/mes/wm/productproduce/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: 'ProductProduceDetailForm' })
|
||||
|
||||
const props = defineProps<{
|
||||
produceId: 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,
|
||||
produceId: undefined as number | undefined,
|
||||
itemId: undefined as number | undefined,
|
||||
quantity: undefined as number | undefined,
|
||||
batchCode: undefined as string | 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' }],
|
||||
locationId: [{ required: true, message: '库区不能为空', trigger: 'change' }],
|
||||
areaId: [{ 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 WmProductProduceDetailApi.getProductProduceDetail(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,
|
||||
produceId: props.produceId,
|
||||
lineId: currentLineId.value
|
||||
} as unknown as WmProductProduceDetailVO
|
||||
if (formType.value === 'create') {
|
||||
await WmProductProduceDetailApi.createProductProduceDetail(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await WmProductProduceDetailApi.updateProductProduceDetail(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,
|
||||
produceId: undefined,
|
||||
itemId: undefined,
|
||||
quantity: undefined,
|
||||
batchCode: undefined,
|
||||
warehouseId: undefined,
|
||||
locationId: undefined,
|
||||
areaId: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
<!-- MES 生产入库明细列表(展开行内嵌子组件) -->
|
||||
<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="batchCode" min-width="120" />
|
||||
<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 {
|
||||
WmProductProduceDetailApi,
|
||||
WmProductProduceDetailVO
|
||||
} from '@/api/mes/wm/productproduce/detail'
|
||||
|
||||
defineOptions({ name: 'ProductProduceDetailList' })
|
||||
|
||||
const props = defineProps<{
|
||||
produceId: 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<WmProductProduceDetailVO[]>([]) // 明细列表
|
||||
|
||||
/** 查询明细列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
list.value = await WmProductProduceDetailApi.getProductProduceDetailListByLineId(props.lineId)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
defineExpose({ getList })
|
||||
|
||||
/** 删除入库明细 */
|
||||
const handleDelete = async (detailId: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await WmProductProduceDetailApi.deleteProductProduceDetail(detailId)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 初始化:延迟加载,展开时才触发 */
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
<template>
|
||||
<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="workOrderId">
|
||||
<ProWorkOrderSelect v-model="formData.workOrderId" :disabled="isHeaderReadonly" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="报工单号" prop="feedbackId">
|
||||
<el-input-number
|
||||
v-model="formData.feedbackId"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
placeholder="请输入报工单号"
|
||||
:disabled="isHeaderReadonly"
|
||||
class="!w-full"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="生产任务" prop="taskId">
|
||||
<el-input-number
|
||||
v-model="formData.taskId"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
placeholder="请输入生产任务"
|
||||
:disabled="isHeaderReadonly"
|
||||
class="!w-full"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工作站" prop="workstationId">
|
||||
<MdWorkstationSelect v-model="formData.workstationId" :disabled="isHeaderReadonly" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工序" prop="processId">
|
||||
<ProProcessSelect v-model="formData.processId" :disabled="isHeaderReadonly" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="入库日期" prop="produceDate">
|
||||
<el-date-picker
|
||||
v-model="formData.produceDate"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="选择入库日期"
|
||||
:disabled="isHeaderReadonly"
|
||||
class="!w-full"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
:disabled="isHeaderReadonly"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- 非新建模式展示行项目信息(入库物料) -->
|
||||
<template v-if="formData.id">
|
||||
<el-divider content-position="center">物料信息</el-divider>
|
||||
<ProductProduceLineList :produce-id="formData.id" :form-type="formType" />
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button v-if="isUpdate" @click="submitForm" type="primary" :disabled="formLoading">
|
||||
确 定
|
||||
</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { WmProductProduceApi, WmProductProduceVO } from '@/api/mes/wm/productproduce'
|
||||
import ProWorkOrderSelect from '@/views/mes/pro/workorder/components/ProWorkOrderSelect.vue'
|
||||
import MdWorkstationSelect from '@/views/mes/md/workstation/components/MdWorkstationSelect.vue'
|
||||
import ProProcessSelect from '@/views/mes/pro/process/components/ProProcessSelect.vue'
|
||||
import ProductProduceLineList from './ProductProduceLineList.vue'
|
||||
|
||||
defineOptions({ name: 'ProductProduceForm' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formType = ref<string>('create') // 表单的类型:create / update / detail
|
||||
const formData = ref({
|
||||
id: undefined as number | undefined,
|
||||
workOrderId: undefined,
|
||||
feedbackId: undefined,
|
||||
taskId: undefined,
|
||||
workstationId: undefined,
|
||||
processId: undefined,
|
||||
produceDate: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
workOrderId: [{ required: true, message: '生产工单不能为空', trigger: 'change' }],
|
||||
produceDate: [{ required: true, message: '入库日期不能为空', trigger: 'change' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
const isUpdate = computed(() => ['create', 'update'].includes(formType.value)) // 是否为编辑模式
|
||||
const isHeaderReadonly = computed(() => formType.value === 'detail') // 是否只读
|
||||
const dialogTitle = computed(() => {
|
||||
const titles = {
|
||||
create: '新增生产入库单',
|
||||
update: '编辑生产入库单',
|
||||
detail: '生产入库单详情'
|
||||
}
|
||||
return titles[formType.value] || formType.value
|
||||
})
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改/详情时,加载数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await WmProductProduceApi.getProductProduce(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
/** 提交表单(create/update 模式) */
|
||||
const emit = defineEmits(['success'])
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as WmProductProduceVO
|
||||
if (formType.value === 'create') {
|
||||
const res = await WmProductProduceApi.createProductProduce(data)
|
||||
message.success('新增成功')
|
||||
formData.value.id = res
|
||||
formType.value = 'update'
|
||||
} else {
|
||||
await WmProductProduceApi.updateProductProduce(data)
|
||||
message.success('修改成功')
|
||||
}
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
workOrderId: undefined,
|
||||
feedbackId: undefined,
|
||||
taskId: undefined,
|
||||
workstationId: undefined,
|
||||
processId: undefined,
|
||||
produceDate: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1,330 +0,0 @@
|
|||
<!-- MES 生产入库单行列表子组件 -->
|
||||
<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">
|
||||
<ProductProduceDetailList
|
||||
:ref="(el: any) => setDetailListRef(scope.row.id, el)"
|
||||
:produce-id="props.produceId"
|
||||
: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 label="批号" align="center" prop="lotNumber" min-width="120" />
|
||||
<el-table-column
|
||||
label="有效期"
|
||||
align="center"
|
||||
prop="expireDate"
|
||||
min-width="120"
|
||||
/>
|
||||
<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="操作"
|
||||
align="center"
|
||||
width="220"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="openForm('update', scope.row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="success"
|
||||
@click="openDetailForm('create', scope.row.id, scope.row.itemId)"
|
||||
>
|
||||
添加明细
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="handleDelete(scope.row.id)">
|
||||
删除
|
||||
</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">
|
||||
<MdItemSelect
|
||||
v-model="formData.itemId"
|
||||
placeholder="请选择产品物料"
|
||||
class="!w-1/1"
|
||||
@change="handleItemChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="入库数量" prop="quantity">
|
||||
<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-col :span="8">
|
||||
<el-form-item label="批号" prop="lotNumber">
|
||||
<el-input v-model="formData.lotNumber" placeholder="请输入批号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="有效期" prop="expireDate">
|
||||
<el-date-picker
|
||||
v-model="formData.expireDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择有效期"
|
||||
class="!w-full"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="质量状态" prop="qualityStatus">
|
||||
<el-select v-model="formData.qualityStatus" placeholder="请选择质量状态" class="!w-full">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.MES_WM_QUALITY_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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>
|
||||
|
||||
<!-- 入库明细添加/编辑弹窗 -->
|
||||
<ProductProduceDetailForm
|
||||
ref="detailFormRef"
|
||||
:produce-id="props.produceId"
|
||||
@success="onDetailFormSuccess"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import {
|
||||
WmProductProduceLineApi,
|
||||
WmProductProduceLineVO
|
||||
} from '@/api/mes/wm/productproduce/line'
|
||||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
import ProductProduceDetailList from './ProductProduceDetailList.vue'
|
||||
import ProductProduceDetailForm from './ProductProduceDetailForm.vue'
|
||||
|
||||
defineOptions({ name: 'ProductProduceLineList' })
|
||||
|
||||
const props = defineProps<{
|
||||
produceId: number
|
||||
formType: string
|
||||
}>()
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const isUpdate = computed(() => ['create', 'update'].includes(props.formType)) // 是否为编辑模式
|
||||
|
||||
// ==================== 列表 ====================
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const list = ref<WmProductProduceLineVO[]>([]) // 行列表
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
produceId: undefined as number | undefined
|
||||
})
|
||||
|
||||
/** 查询行列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
queryParams.produceId = props.produceId
|
||||
const data = await WmProductProduceLineApi.getProductProduceLinePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await WmProductProduceLineApi.deleteProductProduceLine(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,
|
||||
produceId: undefined as number | undefined,
|
||||
itemId: undefined,
|
||||
quantity: undefined,
|
||||
batchCode: undefined,
|
||||
lotNumber: undefined,
|
||||
expireDate: undefined,
|
||||
qualityStatus: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
|
||||
quantity: [{ required: true, message: '入库数量不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 物料变化时,自动填充信息 */
|
||||
const handleItemChange = (item: any) => {
|
||||
if (item) {
|
||||
formData.value.itemId = item.id
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开表单弹窗 */
|
||||
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 WmProductProduceLineApi.getProductProduceLine(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = async () => {
|
||||
await formRef.value.validate()
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = { ...formData.value, produceId: props.produceId } as unknown as WmProductProduceLineVO
|
||||
if (lineFormType.value === 'create') {
|
||||
await WmProductProduceLineApi.createProductProduceLine(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await WmProductProduceLineApi.updateProductProduceLine(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
await getList()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
produceId: undefined,
|
||||
itemId: undefined,
|
||||
quantity: undefined,
|
||||
batchCode: undefined,
|
||||
lotNumber: undefined,
|
||||
expireDate: undefined,
|
||||
qualityStatus: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
// ==================== 展开行:入库明细 ====================
|
||||
const detailListRefs = ref<Record<number, InstanceType<typeof ProductProduceDetailList>>>({})
|
||||
|
||||
/** 缓存子组件 ref */
|
||||
const setDetailListRef = (lineId: number, el: any) => {
|
||||
if (el) {
|
||||
detailListRefs.value[lineId] = el
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 入库明细表单(LineList 层级持有) ====================
|
||||
const detailFormRef = ref()
|
||||
|
||||
/** 打开入库明细表单 */
|
||||
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>
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="入库日期" prop="produceDate">
|
||||
<el-date-picker
|
||||
v-model="queryParams.produceDate"
|
||||
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"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.MES_PRODUCT_PRODUCE_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-product-produce:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['mes:wm-product-produce: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="id" min-width="80">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="openForm('detail', scope.row.id)">
|
||||
{{ scope.row.id }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="生产工单" align="center" prop="workOrderCode" min-width="140" />
|
||||
<el-table-column label="工作站" align="center" prop="workstationName" min-width="120" />
|
||||
<el-table-column label="工序" align="center" prop="processName" min-width="120" />
|
||||
<el-table-column
|
||||
label="入库日期"
|
||||
align="center"
|
||||
prop="produceDate"
|
||||
:formatter="dateFormatter2"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="单据状态" align="center" prop="status" min-width="110">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.MES_PRODUCT_PRODUCE_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="240" fixed="right">
|
||||
<template #default="scope">
|
||||
<!-- 草稿:编辑、完成入库、删除、取消 -->
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['mes:wm-product-produce:update']"
|
||||
v-if="scope.row.status === MesWmProductProduceStatusEnum.PREPARE"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="success"
|
||||
@click="handleFinish(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-product-produce:update-status']"
|
||||
v-if="scope.row.status === MesWmProductProduceStatusEnum.PREPARE"
|
||||
>
|
||||
完成入库
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-product-produce:delete']"
|
||||
v-if="scope.row.status === MesWmProductProduceStatusEnum.PREPARE"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleCancel(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-product-produce:update-status']"
|
||||
v-if="scope.row.status === MesWmProductProduceStatusEnum.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>
|
||||
|
||||
<ProductProduceForm 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 { WmProductProduceApi, WmProductProduceVO } from '@/api/mes/wm/productproduce'
|
||||
import ProductProduceForm from './ProductProduceForm.vue'
|
||||
import { MesWmProductProduceStatusEnum } from '@/views/mes/utils/constants'
|
||||
|
||||
defineOptions({ name: 'MesWmProductProduce' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<WmProductProduceVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
status: undefined,
|
||||
produceDate: undefined
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const formRef = ref() // 表单弹窗
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await WmProductProduceApi.getProductProducePage(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 openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await WmProductProduceApi.deleteProductProduce(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 取消按钮操作 */
|
||||
const handleCancel = async (id: number) => {
|
||||
try {
|
||||
await message.confirm('确认取消该生产入库单?取消后不可恢复。')
|
||||
await WmProductProduceApi.cancelProductProduce(id)
|
||||
message.success('取消成功')
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 完成入库按钮操作 */
|
||||
const handleFinish = async (id: number) => {
|
||||
try {
|
||||
await message.confirm('确认完成该入库单并执行入库吗?')
|
||||
await WmProductProduceApi.finishProductProduce(id)
|
||||
message.success('完成成功')
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportLoading.value = true
|
||||
const data = await WmProductProduceApi.exportProductProduceExcel(queryParams)
|
||||
download.excel(data, '生产入库单.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
Loading…
Reference in New Issue