From 6cc2d85787171281c269f4a6c3290b4a0762bcb6 Mon Sep 17 00:00:00 2001 From: YangYuGang <1378265336@qq.com> Date: 星期三, 05 三月 2025 16:21:43 +0800 Subject: [PATCH] 生产工具 --- src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts | 156 ++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 128 insertions(+), 28 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts index 504bccf..1bac099 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts @@ -4,19 +4,22 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-22 02:29:18 + * @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(); @@ -24,11 +27,11 @@ function _default() { const ActionColumn: BasicColumn = { - width: 80, + width: 180, title: '鎿嶄綔', dataIndex: 'action', slots: { customRender: 'action' }, - fixed: undefined, + fixed: 'right', }; /** @@ -40,7 +43,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓猴紝蹇呴渶瑕佹湁鐨勬柟娉� * @return {*} */ - CreateAction: (fnName: string) => { + CreateAction: (type: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; @@ -53,11 +56,20 @@ 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; @@ -150,6 +162,13 @@ { dataIndex: 'ACT_LINE', title: '瀹為檯绾夸綋', + ifShow: true, + sorter: true, + resizable: true, + }, + { + dataIndex: 'PLAN_DATE', + title: '璁″垝鏃ユ湡', ifShow: true, sorter: true, resizable: true, @@ -335,14 +354,16 @@ 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); @@ -359,29 +380,62 @@ */ 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('鍙栨秷鏆傚仠鎿嶄綔澶辫触')); } }); } @@ -394,6 +448,14 @@ */ 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', //鏄摢涓〉闈� @@ -405,6 +467,44 @@ fnName: 'SaveWoBatch', //淇濆瓨鏂规硶鍚� initFnName: {}, //鍒濆鍖栨柟娉曞悕锛屾病鏈夊氨鐣欑┖{} values: params['record'], //琛ㄥ崟璁板綍 + }); + } + + /** + * @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, + }); + } }); } @@ -431,7 +531,7 @@ // }, // }, { - label: '璁″垝浜х嚎', + label: '瀹為檯浜х嚎', field: 'ACT_LINE', component: 'ApiSelect', required: true, -- Gitblit v1.9.3