| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-25 21:44:58 |
| | | * @LastEditTime: 2024-09-29 21:28:37 |
| | | */ |
| | | |
| | | import { Tag, Tooltip } from 'ant-design-vue'; |
| | | import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { h, unref } from 'vue'; |
| | | import { getEntity, GetEnum, SaveEntity } from '/@/api/tigerapi/system'; |
| | | import { h } from 'vue'; |
| | | import { getEntity, SaveEntity } from '/@/api/tigerapi/system'; |
| | | import { useLocale } from '/@/locales/useLocale'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { CustModalParams, FunctionType } from '/@/api/tigerapi/model/systemModel'; |
| | | import { useForm } from '/@/components/Form'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { UpdateWoBatchStatus } from '/@/api/tigerapi/mes/wo'; |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | import { formatToDateTime } from '/@/utils/dateUtil'; |
| | | |
| | | const { getLocale } = useLocale(); |
| | | const { createMessage, createErrorModal } = useMessage(); |
| | |
| | | |
| | | function _default() { |
| | | const ActionColumn: BasicColumn = { |
| | | width: 80, |
| | | width: 180, |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | slots: { customRender: 'action' }, |
| | | fixed: undefined, |
| | | fixed: 'right', |
| | | }; |
| | | |
| | | /** |
| | |
| | | * @description: 获取新增按钮的行为,必需要有的方法 |
| | | * @return {*} |
| | | */ |
| | | CreateAction: (fnName: string) => { |
| | | CreateAction: (type: string) => { |
| | | return { |
| | | action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面) |
| | | }; |
| | |
| | | data.map((x) => { |
| | | if (x.name == 'handlePause') { |
| | | x.onClick = handlePause.bind(null, args, params); |
| | | x.color = 'error'; |
| | | x.tooltip = '暂停'; |
| | | } |
| | | if (x.name == 'handleStart') { |
| | | x.onClick = handleStart.bind(null, args, params); |
| | | x.tooltip = '取消暂停'; |
| | | } |
| | | if (x.name == 'handleRelease') { |
| | | x.onClick = handleRelease.bind(null, args, params); |
| | | x.tooltip = '下发'; |
| | | } |
| | | if (x.name == 'handleUnRelease') { |
| | | x.onClick = handleUnRelease.bind(null, args, params); |
| | | x.tooltip = '取消下发'; |
| | | } |
| | | }); |
| | | return data; |
| | |
| | | * @return {*} |
| | | */ |
| | | GetHomeUrl: (params: {}) => { |
| | | return `/BIZ_MES_WO/LC/${encodeURI(JSON.stringify({ ID: 'BIZ_MES_WO', colSlots: params['colSlots'], crudColSlots: [] }))}`; |
| | | return `/BIZ_MES_WO/LC/${encodeURI(JSON.stringify({ ID: 'BIZ_MES_WO',"EntityName":"BIZ_MES_WO", colSlots: params['colSlots'], crudColSlots: [] }))}`; |
| | | }, |
| | | GetBaseColumns: () => { |
| | | return [ |
| | |
| | | { |
| | | dataIndex: 'ACT_LINE', |
| | | title: '实际线体', |
| | | ifShow: true, |
| | | sorter: true, |
| | | resizable: true, |
| | | }, |
| | | { |
| | | dataIndex: 'PLAN_DATE', |
| | | title: '计划日期', |
| | | ifShow: true, |
| | | sorter: true, |
| | | resizable: true, |
| | |
| | | return new Promise((resolve, reject) => { |
| | | try { |
| | | const wo = param.values['mValues']; |
| | | wo.STATUS = 2; |
| | | wo.ACT_LINE = param.values['forminfo'].ACT_LINE; |
| | | SaveEntity(wo, true, 'BIZ_MES_WO_BATCH').then((action) => { |
| | | if (action.IsSuccessed) { |
| | | resolve(action); |
| | | } else { |
| | | reject(action); |
| | | } |
| | | /* 更新工单批次状态 */ |
| | | return UpdateWoBatchStatus({ |
| | | UserId: useUserStore().getUserInfo.userId as string, |
| | | WorkOrder: wo.ORDER_NO, |
| | | WoBatch: wo.BATCH_NO, |
| | | ActLine: param.values['forminfo'].ACT_LINE, |
| | | Status: 2, |
| | | RouteStatus: 0, |
| | | }).then((action) => { |
| | | resolve(action); |
| | | }); |
| | | } catch { |
| | | reject(false); |
| | |
| | | */ |
| | | function handlePause(args, params: Recordable) { |
| | | const reload = args[1]; |
| | | if (params['record'].STATUS == 0) { |
| | | if (params['record'].STATUS != 3) { |
| | | createErrorModal({ |
| | | title: t('警告'), |
| | | content: t('工单是初始化状态,不能暂停!'), |
| | | content: t('工单不是生产中状态,不能暂停!'), |
| | | getContainer: () => document.body, |
| | | }); |
| | | return; |
| | | } |
| | | if (params['record'].STATUS == 5) { |
| | | createErrorModal({ |
| | | title: t('警告'), |
| | | content: t('工单是完成状态,不能暂停!'), |
| | | getContainer: () => document.body, |
| | | }); |
| | | return; |
| | | } |
| | | params['record'].STATUS = 4; |
| | | SaveEntity(params['record'], true, 'BIZ_MES_WO_BATCH').then((action) => { |
| | | /* 更新工单批次状态 */ |
| | | UpdateWoBatchStatus({ |
| | | UserId: useUserStore().getUserInfo.userId as string, |
| | | WorkOrder: params['record'].ORDER_NO, |
| | | WoBatch: params['record'].BATCH_NO, |
| | | Status: 4, |
| | | RouteStatus: 0, |
| | | ActLine: '' |
| | | }).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | createMessage.success(t('已暂停')); |
| | | reload(); |
| | | } else { |
| | | createMessage.success(t('暂停操作失败')); |
| | | createMessage.success(t(action.Message)); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * @description: 工单取消暂停方法 |
| | | * @param {*} args |
| | | * @param {Recordable} params |
| | | * @return {*} |
| | | */ |
| | | function handleStart(args, params: Recordable) { |
| | | const reload = args[1]; |
| | | if (params['record'].STATUS != 4) { |
| | | createErrorModal({ |
| | | title: t('警告'), |
| | | content: t('工单不是暂停状态,不能取消暂停!'), |
| | | getContainer: () => document.body, |
| | | }); |
| | | return; |
| | | } |
| | | /* 更新工单批次状态 */ |
| | | UpdateWoBatchStatus({ |
| | | UserId: useUserStore().getUserInfo.userId as string, |
| | | WorkOrder: params['record'].ORDER_NO, |
| | | WoBatch: params['record'].BATCH_NO, |
| | | Status: 3, |
| | | RouteStatus: 0, |
| | | ActLine: '' |
| | | }).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | createMessage.success(t('暂停已取消')); |
| | | reload(); |
| | | } else { |
| | | createMessage.success(t('取消暂停操作失败')); |
| | | } |
| | | }); |
| | | } |
| | |
| | | */ |
| | | function handleRelease(args, params: Recordable) { |
| | | const openCustModal = args[7]; |
| | | if (params['record'].STATUS != 0) { |
| | | createErrorModal({ |
| | | title: t('警告'), |
| | | content: t('工单不是初始状态,不能下发!'), |
| | | getContainer: () => document.body, |
| | | }); |
| | | return; |
| | | } |
| | | openCustModal(true, { |
| | | isUpdate: true, //是否更新操作 |
| | | ctype: 'BIZ_MES_WO_BATCH', //是哪个页面 |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * @description: 工单取消下发方法 |
| | | * @param {*} args |
| | | * @param {Recordable} params |
| | | * @return {*} |
| | | */ |
| | | function handleUnRelease(args, params: Recordable) { |
| | | const reload = args[1]; |
| | | if (params['record'].STATUS != 2) { |
| | | createErrorModal({ |
| | | title: t('警告'), |
| | | content: t('工单不是下发状态,不能取消下发!'), |
| | | getContainer: () => document.body, |
| | | }); |
| | | return; |
| | | } |
| | | /* 更新工单批次状态 */ |
| | | UpdateWoBatchStatus({ |
| | | UserId: useUserStore().getUserInfo.userId as string, |
| | | WorkOrder: params['record'].ORDER_NO, |
| | | WoBatch: params['record'].BATCH_NO, |
| | | Status: 0, //取消下发状态 |
| | | RouteStatus: 0, |
| | | ActLine: '' |
| | | }).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | createMessage.success(t('下发已取消')); |
| | | reload(); |
| | | } else { |
| | | createErrorModal({ |
| | | title: t('警告'), |
| | | content: t(action.Message), |
| | | getContainer: () => document.body, |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | const woformSchema: FormSchema[] = [ |
| | | { |
| | | field: 'PLAN_QTY', |