feat(mes): 添加到货通知单的到货日期和状态枚举

新增到货日期字段到 MES 到货通知单请求 VO,并在查询中支持根据到货日期范围筛选。同时,添加到货通知单状态的枚举定义,提升系统的可维护性和可读性。
pull/871/MERGE
YunaiV 2026-02-22 18:00:24 +08:00
parent 39187b441e
commit 5aea9a0428
5 changed files with 169 additions and 34 deletions

View File

@ -292,4 +292,5 @@ export enum DICT_TYPE {
MES_PRO_ANDON_STATUS = 'mes_pro_andon_status', // MES 安灯处置状态
MES_PRO_ANDON_LEVEL = 'mes_pro_andon_level', // MES 安灯级别
MES_RQC_TYPE = 'mes_rqc_type', // MES 退货检验类型
MES_WM_ARRIVAL_NOTICE_STATUS = 'mes_wm_arrival_notice_status', // MES 到货通知单状态
}

View File

@ -199,6 +199,22 @@ export const MesProFeedbackTypeEnum = {
UNIFIED: 2 // 统一报工
}
/** MES 到货通知单状态枚举 */
export const MesWmArrivalNoticeStatusEnum = {
PREPARE: 0, // 草稿
SUBMITTED: 1, // 已提交
APPROVED: 2, // 已审批
FINISHED: 3 // 已完成
}
/** MES 采购入库单状态枚举 */
export const MesWmItemReceiptStatusEnum = {
PREPARE: 0, // 草稿
SUBMITTED: 1, // 已提交
APPROVED: 2, // 已审批
FINISHED: 3 // 已完成
}
/** 获取物料/产品标识的标签 */
export const getItemOrProductLabel = (value: string): string => {
for (const item of Object.values(MesItemOrProductEnum)) {

View File

@ -1,5 +1,5 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="860px">
<Dialog :title="dialogTitle" v-model="dialogVisible" width="960px">
<el-form
ref="formRef"
:model="formData"
@ -9,9 +9,14 @@
>
<el-row>
<el-col :span="8">
<!-- TODO @AI生成功能参考别的模块 -->
<el-form-item label="通知单编号" prop="code">
<el-input v-model="formData.code" placeholder="请输入通知单编号" />
<el-input v-model="formData.code" placeholder="请输入通知单编号">
<template #append>
<el-button @click="generateCode" :disabled="formType === 'update'">
生成
</el-button>
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
@ -75,7 +80,11 @@
</el-col>
</el-row>
</el-form>
<!-- TODO @AI这里缺少了物料信息 -->
<!-- 编辑时展示物料信息 -->
<template v-if="formData.id">
<el-divider content-position="center">物料信息</el-divider>
<ArrivalNoticeLineList :notice-id="formData.id" />
</template>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
@ -84,19 +93,21 @@
</template>
<script setup lang="ts">
import { generateRandomStr } from '@/utils'
import { WmArrivalNoticeApi, WmArrivalNoticeVO } from '@/api/mes/wm/arrivalnotice'
import { MdVendorApi } from '@/api/mes/md/vendor'
import ArrivalNoticeLineList from './ArrivalNoticeLineList.vue'
defineOptions({ name: 'ArrivalNoticeForm' })
const { t } = useI18n()
const message = useMessage()
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false)
const dialogTitle = ref('')
const formLoading = ref(false)
const formType = ref('')
const vendorList = ref<any[]>([])
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) //
const formType = ref('') // create - update -
const vendorList = ref<any[]>([]) //
const formData = ref({
id: undefined,
code: undefined,
@ -113,7 +124,12 @@ const formRules = reactive({
vendorId: [{ required: true, message: '请选择供应商', trigger: 'change' }],
arrivalDate: [{ required: true, message: '请选择到货日期', trigger: 'change' }]
})
const formRef = ref()
const formRef = ref() // Ref
/** 生成通知单编号 */
const generateCode = () => {
formData.value.code = 'AN' + generateRandomStr(10)
}
/** 打开弹窗 */
const open = async (type: string, id?: number) => {

View File

@ -0,0 +1,96 @@
<!-- MES 到货通知单行列表子组件 -->
<template>
<div>
<el-button 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>
<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="arrivalQuantity" width="100" />
<el-table-column label="是否检验" align="center" prop="iqcCheckFlag" width="90">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.iqcCheckFlag" />
</template>
</el-table-column>
<el-table-column label="合格数量" align="center" prop="qualifiedQuantity" width="100" />
<!-- TODO @芋艿不要删除后续需要怎么弄 -->
<el-table-column label="检验单号" align="center" prop="iqcCode" min-width="140" />
<el-table-column label="备注" align="center" prop="remark" min-width="120" />
<el-table-column label="操作" align="center" width="120">
<template #default="scope">
<el-button link type="primary" @click="openForm('update', scope.row.id)">编辑</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>
<ArrivalNoticeLineForm ref="formRef" @success="getList" :noticeId="noticeId" />
</template>
<script setup lang="ts">
import { DICT_TYPE } from '@/utils/dict'
import { WmArrivalNoticeLineApi, WmArrivalNoticeLineVO } from '@/api/mes/wm/arrivalnotice/line'
import ArrivalNoticeLineForm from './line/ArrivalNoticeLineForm.vue'
defineOptions({ name: 'ArrivalNoticeLineList' })
const props = defineProps<{
noticeId: number
}>()
const { t } = useI18n() //
const message = useMessage() //
const loading = ref(false) //
const list = ref<WmArrivalNoticeLineVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
noticeId: undefined as number | undefined
})
/** 查询行列表 */
const getList = async () => {
loading.value = true
try {
queryParams.noticeId = props.noticeId
const data = await WmArrivalNoticeLineApi.getArrivalNoticeLinePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 新增/修改 */
const formRef = ref() //
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除 */
const handleDelete = async (id: number) => {
try {
await message.delConfirm()
await WmArrivalNoticeLineApi.deleteArrivalNoticeLine(id)
message.success(t('common.delSuccess'))
await getList()
} catch {}
}
/** 初始化 */
onMounted(async () => {
await getList()
})
</script>

View File

@ -49,7 +49,17 @@
/>
</el-select>
</el-form-item>
<!-- TODO @AI到货时间 -->
<el-form-item label="到货日期" prop="arrivalDate">
<el-date-picker
v-model="queryParams.arrivalDate"
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"
@ -57,7 +67,6 @@
clearable
class="!w-240px"
>
<!-- TODO @AIMES_WM_ARRIVAL_NOTICE_STATUS 枚举下 -->
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.MES_WM_ARRIVAL_NOTICE_STATUS)"
:key="dict.value"
@ -121,7 +130,6 @@
<dict-tag :type="DICT_TYPE.MES_WM_ARRIVAL_NOTICE_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<!-- TODO @AI到货时间看看怎么没了 -->
<el-table-column
label="创建时间"
align="center"
@ -129,16 +137,14 @@
:formatter="dateFormatter"
width="180px"
/>
<!-- TODO @AI:fixed -->
<el-table-column label="操作" align="center" width="220">
<!-- TODO @AI需要在 mes constants -->
<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-arrival-notice:update']"
v-if="scope.row.status === 0"
v-if="scope.row.status === MesWmArrivalNoticeStatusEnum.PREPARE"
>
编辑
</el-button>
@ -147,7 +153,7 @@
type="warning"
@click="handleSubmit(scope.row.id)"
v-hasPermi="['mes:wm-arrival-notice:update']"
v-if="scope.row.status === 0"
v-if="scope.row.status === MesWmArrivalNoticeStatusEnum.PREPARE"
>
提交
</el-button>
@ -156,7 +162,7 @@
type="success"
@click="handleApprove(scope.row.id)"
v-hasPermi="['mes:wm-arrival-notice:update']"
v-if="scope.row.status === 1"
v-if="scope.row.status === MesWmArrivalNoticeStatusEnum.SUBMITTED"
>
审批
</el-button>
@ -165,7 +171,7 @@
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['mes:wm-arrival-notice:delete']"
v-if="scope.row.status === 0"
v-if="scope.row.status === MesWmArrivalNoticeStatusEnum.PREPARE"
>
删除
</el-button>
@ -190,20 +196,19 @@ import download from '@/utils/download'
import { WmArrivalNoticeApi, WmArrivalNoticeVO } from '@/api/mes/wm/arrivalnotice'
import { MdVendorApi } from '@/api/mes/md/vendor'
import ArrivalNoticeForm from './ArrivalNoticeForm.vue'
// TODO @AI/Users/yunai/Java/yudao-all-in-one/yudao-ui-admin-vue3/src/views/system/user/index.vue
import { MesWmArrivalNoticeStatusEnum } from '@/views/mes/utils/constants'
defineOptions({ name: 'MesWmArrivalNotice' })
const message = useMessage()
const { t } = useI18n()
const router = useRouter()
const message = useMessage() //
const { t } = useI18n() //
const router = useRouter() //
const loading = ref(true)
const list = ref<WmArrivalNoticeVO[]>([])
const total = ref(0)
const exportLoading = ref(false)
const vendorList = ref<any[]>([])
const loading = ref(true) //
const list = ref<WmArrivalNoticeVO[]>([]) //
const total = ref(0) //
const exportLoading = ref(false) //
const vendorList = ref<any[]>([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
@ -211,9 +216,10 @@ const queryParams = reactive({
name: undefined,
purchaseOrderCode: undefined,
vendorId: undefined,
arrivalDate: undefined,
status: undefined
})
const queryFormRef = ref()
const queryFormRef = ref() //
/** 查询列表 */
const getList = async () => {
@ -240,7 +246,7 @@ const resetQuery = () => {
}
/** 新增/修改 */
const formRef = ref()
const formRef = ref() //
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}