diff --git a/src/api/mes/reworkBatch/index.ts b/src/api/mes/reworkBatch/index.ts new file mode 100644 index 000000000..0ab7e798c --- /dev/null +++ b/src/api/mes/reworkBatch/index.ts @@ -0,0 +1,76 @@ +import request from '@/config/axios' + +export interface ReworkBatchVO { + deleteTime: Date + id: number + status: string + concurrencyStamp: number + remark: string + deleter: string + siteId: number + reworkType: string + productionCode: string + productionCount: string + reworkAction: string + replaceFlag: string + reworkPersoncode: string + reworkTime: Date + reworkResult: string + reworkbillNo: string +} + +// 查询返工登记批量列表 +export const getReworkBatchPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/mes/rework-batch/senior', data }) + } else { + return await request.get({ url: `/mes/rework-batch/page`, params }) + } +} + +// 查询返工登记批量详情 +export const getReworkBatch = async (id: number) => { + return await request.get({ url: `/mes/rework-batch/get?id=` + id }) +} + +// 新增返工登记批量 +export const createReworkBatch = async (data: ReworkBatchVO) => { + return await request.post({ url: `/mes/rework-batch/create`, data }) +} + +// 修改返工登记批量 +export const updateReworkBatch = async (data: ReworkBatchVO) => { + return await request.put({ url: `/mes/rework-batch/update`, data }) +} + +// 删除返工登记批量 +export const deleteReworkBatch = async (id: number) => { + return await request.delete({ url: `/mes/rework-batch/delete?id=` + id }) +} + +// 中止返工登记单件 +export const suspendReworkSingle = async (id: number) => { + return await request.delete({ url: `/mes/rework-batch/suspend?id=` + id }) +} + +// 领取返工登记单件 +export const receiveReworkSingle = async (id: number) => { + return await request.put({ url: `/mes/rework-batch/receive?id=` + id }) +} + +// 完成返工登记单件 +export const finishReworkSingle = async (id: number) => { + return await request.put({ url: `/mes/rework-batch/finish?id=` + id }) +} + +// 导出返工登记批量 Excel +export const exportReworkBatch = async (params) => { + return await request.download({ url: `/mes/rework-batch/export-excel`, params }) +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/mes/rework-batch/get-import-template' }) +} \ No newline at end of file diff --git a/src/api/mes/reworkSingle/index.ts b/src/api/mes/reworkSingle/index.ts index 596a908cc..d84be3231 100644 --- a/src/api/mes/reworkSingle/index.ts +++ b/src/api/mes/reworkSingle/index.ts @@ -49,6 +49,22 @@ export const deleteReworkSingle = async (id: number) => { return await request.delete({ url: `/mes/rework-single/delete?id=` + id }) } +// 中止返工登记单件 +export const suspendReworkSingle = async (id: number) => { + return await request.delete({ url: `/mes/rework-single/suspend?id=` + id }) +} + +// 领取返工登记单件 +export const receiveReworkSingle = async (id: number) => { + return await request.put({ url: `/mes/rework-single/receive?id=` + id }) +} + +// 完成返工登记单件 +export const finishReworkSingle = async (id: number) => { + return await request.put({ url: `/mes/rework-single/finish?id=` + id }) +} + + // 导出返工登记单件 Excel export const exportReworkSingle = async (params) => { return await request.download({ url: `/mes/rework-single/export-excel`, params }) diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index 0b59fdb7b..9095ca7e5 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -250,6 +250,59 @@ export function mainListDeleteBtn(option:any) { hasPermi: '' }) } + +// 主列表-中止按钮1 +export function mainListSuspend1Btn(option:any) { + return __defaultBtnOption(option,{ + label: '中止', + name: 'suspend', + hide: false, + type: 'danger', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + +// 主列表-中止按钮2 +export function mainListSuspend2Btn(option:any) { + return __defaultBtnOption(option,{ + label: '中止', + name: 'suspend', + hide: false, + type: 'danger', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + +// 主列表-领取按钮 +export function mainListReceiveBtn(option:any) { + return __defaultBtnOption(option,{ + label: '领取', + name: 'receive', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + +// 主列表-完成按钮 +export function mainListFinishBtn(option:any) { + return __defaultBtnOption(option,{ + label: '完成', + name: 'finish', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + // 主列表-绑定 export function mainListBindBtn(option:any) { return __defaultBtnOption(option,{ diff --git a/src/views/mes/reworkBatch/index.vue b/src/views/mes/reworkBatch/index.vue new file mode 100644 index 000000000..f2b515fd3 --- /dev/null +++ b/src/views/mes/reworkBatch/index.vue @@ -0,0 +1,318 @@ + + + diff --git a/src/views/mes/reworkBatch/reworkBatch.data.ts b/src/views/mes/reworkBatch/reworkBatch.data.ts new file mode 100644 index 000000000..cb89615e5 --- /dev/null +++ b/src/views/mes/reworkBatch/reworkBatch.data.ts @@ -0,0 +1,229 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' +import * as ItembasicApi from '@/api/wms/itembasic' +import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' + +// 表单校验 +export const ReworkBatchRules = reactive({ + reworkType: [required], + productionCode:[required], + replaceFlag:[required], + status:[required], +}) + +export const ReworkBatch = useCrudSchemas(reactive([ + { + label: '删除时间', + field: 'deleteTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + isTable: false, + isForm:false, + isDetail:false, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '主键', + field: 'id', + sort: 'custom', + isSearch: false, + isTable: false, + isForm:false, + isDetail:false, + }, + { + label: '并发乐观锁', + field: 'concurrencyStamp', + sort: 'custom', + isSearch: false, + isTable: false, + isForm:false, + isDetail:false, + form: { + component: 'InputNumber', + value: 0 + }, + }, + + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + isTable: false, + isForm:false, + isDetail:false, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + }, + { + label: '删除用户名', + field: 'deleter', + sort: 'custom', + isSearch: false, + isTable: false, + isForm:false, + isDetail:false, + }, + { + label: '位置ID', + field: 'siteId', + sort: 'custom', + isSearch: false, + isTable: false, + isForm:false, + isDetail:false, + form: { + component: 'InputNumber', + value: 0 + }, + }, + { + label: '单据号', + field: 'reworkbillNo', + sort: 'custom', + isSearch: true, + isForm: false, + isDetail: true + }, + { + label: '工作类型', + field: 'reworkType', + sort: 'custom', + isSearch: true, + dictType: DICT_TYPE.REWORK_TYPE, + dictClass: 'string', + }, + { + label: '产品编码', + field: 'productionCode', + sort: 'custom', + isSearch: true, + form: { + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchTitle: '产品编码', // 查询弹窗标题 + searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 + searchField: 'code', // 查询弹窗赋值字段 + searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + isMainValue: false + }, + { + key: 'type', + action: 'in', // 查询拼接条件 + isSearch: true, // 使用自定义拼接条件 + value: 'BCP,CCP',//,SEMI] + isMainValue: false + }] + } + } + }, + { + label: '数量', + field: 'productionCount', + sort: 'custom', + isSearch: true, + form: { + component: 'InputNumber', + value: 0 + }, + }, + { + label: '返修动作', + field: 'reworkAction', + sort: 'custom', + isSearch: true, + }, + { + label: '是否有替换件', + field: 'replaceFlag', + sort: 'custom', + isSearch: true, + dictType: DICT_TYPE.REWORK_REPLACE_FLAG, + dictClass: 'string', + }, + { + label: '返修人员', + field: 'reworkPersoncode', + sort: 'custom', + isSearch: true, + }, + { + label: '返修时间', + field: 'reworkTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '返修结果', + field: 'reworkResult', + sort: 'custom', + isSearch: true, + }, + + { + label: '状态', + field: 'status', + sort: 'custom', + isSearch: true, + dictType: DICT_TYPE.REWORK_STATUS, + dictClass: 'string', + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + isSearch: false, + isTable: false, + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) diff --git a/src/views/mes/reworkSingle/index.vue b/src/views/mes/reworkSingle/index.vue index 2265bb135..3fe6a7eb8 100644 --- a/src/views/mes/reworkSingle/index.vue +++ b/src/views/mes/reworkSingle/index.vue @@ -33,7 +33,7 @@ @@ -131,18 +131,38 @@ const buttonBaseClick = (val, item) => { } } +// 根据状态返回该按钮是否显示 +const isShowMainButton = (row,val) => { + if (val.indexOf(row.status) > -1) { + return false + } else { + return true + } +} + // 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'mes:reworkSingle:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'mes:reworkSingle:delete'}), // 删除 -] +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hide: isShowMainButton(row,['1']),hasPermi:'mes:reworkSingle:update'}), // 编辑 + defaultButtons.mainListSuspend1Btn({hide: isShowMainButton(row,['1']),hasPermi:'mes:reworkSingle:delete'}), // 中止1 + defaultButtons.mainListReceiveBtn({hide: isShowMainButton(row,['1']),hasPermi:'mes:reworkSingle:update'}), // 领取 + defaultButtons.mainListSuspend2Btn({hide: isShowMainButton(row,['2']),hasPermi:'mes:reworkSingle:delete'}), // 中止2 + defaultButtons.mainListFinishBtn({hide: isShowMainButton(row,['2']),hasPermi:'mes:reworkSingle:update'}), // 完成 + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { if (val == 'edit') { // 编辑 openForm('update', row) - } else if (val == 'delete') { // 删除 - handleDelete(row.id) + } else if (val == 'suspend') { // 中止1 + handleSuspend(row.id) + } else if (val == 'receive') { // 领取 + handleReceive(row.id) + } else if (val == 'suspend') { // 中止2 + handleSuspend(row.id) + } else if (val == 'finish') { // 完成 + handleFinish(row.id) } } @@ -209,6 +229,46 @@ const handleDelete = async (id: number) => { } catch {} } +/** 中止按钮操作 */ +const handleSuspend = async (id: number) => { + try { + // 中止的二次确认 + await message.delConfirm('是否中止所选中任务?'); + // 发起删除 + await ReworkSingleApi.suspendReworkSingle(id) + message.success(t('中止成功')) + // 刷新列表 + await getList() + } catch {} +} + + +/** 领取按钮操作 */ +const handleReceive = async (id: number) => { + try { + // 中止的二次确认 + await message.delConfirm('是否领取所选中任务?'); + // 发起删除 + await ReworkSingleApi.receiveReworkSingle(id) + message.success(t('领取成功')) + // 刷新列表 + await getList() + } catch {} +} + +/** 完成按钮操作 */ +const handleFinish = async (id: number) => { + try { + // 中止的二次确认 + await message.delConfirm('是否完成所选中任务?'); + // 发起删除 + await ReworkSingleApi.finishReworkSingle(id) + message.success(t('任务已完成')) + // 刷新列表 + await getList() + } catch {} +} + /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 const handleExport = async () => {