From 21a4e09672b1177d40c2bb5b937a8780c5eaa7fb Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期六, 08 三月 2025 15:03:34 +0800 Subject: [PATCH] 一些更新 --- src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts | 334 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 246 insertions(+), 88 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts index 4917931..c121589 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts @@ -4,16 +4,13 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-20 22:18:28 + * @LastEditTime: 2024-10-23 20:48:14 */ import { Ref, h, ref, render, unref } from 'vue'; -import { GetRoutePTree, RouteToCust, RouteToProd } from '/@/api/tigerapi/mes/router'; import { GetEnum, SaveEntity, convertToTree, getEntity } from '/@/api/tigerapi/system'; import { useLocale } from '/@/locales/useLocale'; -import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; import { useI18n } from '/@/hooks/web/useI18n'; -import { NavItem } from '/@/api/tigerapi/model/basModel'; import { useMessage } from '/@/hooks/web/useMessage'; import { useModal } from '/@/components/Modal'; import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table'; @@ -23,23 +20,16 @@ import { CustModalParams, FunctionType } from '/@/api/tigerapi/model/systemModel'; import { SaveMesBatchWo } from '/@/api/tigerapi/mes/wo'; import { useForm } from '/@/components/Form/index'; -import { uploadApi } from '/@/api/sys/upload'; -import { initRoute } from '../data'; +import { cloneDeep } from 'lodash-es'; +import { useProdRouteStore } from '/@/store/modules/prodRoute'; +import { Tag, Tooltip } from 'ant-design-vue'; const { t } = useI18n(); const { createErrorModal } = useMessage(); const { getLocale } = useLocale(); function _default() { - /* 瀹氫箟鍙橀噺 */ - const isNormal = (type: number) => type === 0; - const isScan = (type: number) => type === 1; - const isAssy = (type: number) => type === 2; - const isTest = (type: number) => type === 3; - const isAudit = (type: number) => type === 4; - const isPrint = (type: number) => type === 5; - const isPackage = (type: number) => type === 6; const ActionColumn: BasicColumn = { - width: 220, + width: 180, title: '鎿嶄綔', dataIndex: 'action', slots: { customRender: 'action' }, @@ -54,10 +44,104 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: (fnName: string) => { - return { - action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) - }; + CreateAction: (type: string, fnName: string) => { + let action = {} as any; + switch (fnName) { + case 'ImportExcel': + action = { + action: 'importModal', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) | ToPrint(鎵撳嵃鍔熻兘) + params: { + tmpHeader: ['宸ュ崟鍙�', '璁″垝鏃ユ湡', '璁″垝鏁伴噺'] /* 涓嬭浇妯℃澘鐨勬爣棰樺瓧娈� */, + filename: '宸ュ崟璁″垝妯℃澘.xlsx' /* 涓嬭浇妯℃澘鐨勬枃浠跺悕 */, + entityName: 'BIZ_MES_WO_BATCH' /* 瀵煎叆琛ㄧ殑琛ㄥ悕 */, + checkJson: ['ORDER_NO', 'PLAN_DATE', 'PLAN_QTY'] /* 瀵煎叆琛ㄩ渶瑕佹鏌ョ殑瀛楁鍒楄〃 */, + where: ['ORDER_NO'] /* 瀵煎叆琛ㄩ渶瑕佹煡璇㈢殑瀛楁鍒楄〃 */, + typeFullName: + 'Tiger.IBusiness.MES.IImportWoPlan,Tiger.IBusiness.MES' /* 瀵煎叆鐨勬柟娉曞叏鍚嶏紝閫氱敤瀵煎叆鐢ㄨ繖涓細Tiger.IBusiness.ICommonImportExcel,Tiger.IBusiness */, + baseColumns: [ + /* 瀵煎叆鏃剁晫闈㈡樉绀烘暟鎹殑瀛楁 */ + { + title: '宸ュ崟鍙�', + dataIndex: 'ORDER_NO', + ifShow: true, + width: 180, + }, + // { + // title: '宸ュ崟鎵规鍙�', + // dataIndex: 'BATCH_NO', + // ifShow: true, + // width: 180, + // // customRender: ({ record }) => { + // // record.BATCH_NO = record.ORDER_NO+'-01' + // // return record.BATCH_NO + // // }, + // }, + { + title: '璁″垝鏃ユ湡', + dataIndex: 'PLAN_DATE', + ifShow: true, + width: 180, + }, + { + title: '璁″垝鏁伴噺', + dataIndex: 'PLAN_QTY', + ifShow: true, + width: 100, + }, + { + title: '澶勭悊鏂瑰紡', + dataIndex: 'VALIDATION_TYPE', + ifShow: true, + width: 100, + customRender: ({ record }) => { + const status = record.VALIDATION_TYPE; + var text = ''; + var color = 'green'; + if (status == '寮傚父') { + color = 'red'; + text = status; + } else if (status == '鏇存柊') { + color = 'orange'; + text = status; + } else { + text = status; + } + return h(Tooltip, { title: text }, () => h(Tag, { color: color }, () => text)); + }, + }, + { + title: '澶勭悊鎻愮ず', + dataIndex: 'VALIDATION_RESULT', + ifShow: true, + width: 280, + customRender: ({ record }) => { + const status = record.VALIDATION_TYPE; + var text = record.VALIDATION_RESULT; + var color = 'green'; + if (status == '寮傚父') { + color = 'red'; + } else if (status == '鏇存柊') { + color = 'orange'; + } + return h(Tooltip, { title: text }, () => h(Tag, { color: color }, () => text)); + }, + }, + ], + }, + }; + break; + case 'ToPrint': + action = { + action: 'ToPrint', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) | ToPrint(鎵撳嵃鍔熻兘) + }; + break; + default: + action = { + action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) | ToPrint(鎵撳嵃鍔熻兘) + }; + break; + } + return action; }, /** * @description: 鎿嶄綔瀛楁鑷畾涔夋寜閽� @@ -76,6 +160,9 @@ if (x.name == 'handleRelease') { x.onClick = handleRelease.bind(null, args, params); x.tooltip = '涓嬪彂'; + } + if (x.name == 'ToPrint') { + x.tooltip = '鎵撳嵃娴佺▼鍗�'; } }); return data; @@ -99,6 +186,14 @@ showActionButtonGroup: false, }), prodinfo: useForm({ + labelWidth: 120, + schemas: prodCfgformSchema, + actionColOptions: { + span: 24, + }, + showActionButtonGroup: false, + }), + tmpinfo: useForm({ labelWidth: 120, schemas: prodCfgformSchema, actionColOptions: { @@ -203,7 +298,8 @@ GetSelectSuccess: (d, u) => { return { ROUTE_CODE: d.values['val'], - ID: d.values['id'], + // ID: d.values['id'], + ROT_ID: d.values['id'], }; }, /** @@ -249,15 +345,26 @@ ], tableName: 'MES_ROUTE', rowKey: 'ROT_CODE', - returnFieldName: 'ROUTE_CODE', //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О + returnFieldName: ['ROUTE_CODE', 'ROT_ID'], //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О searchInfo: { TABLE_NAME: 'MES_ROUTE' }, }); break; case 'set': - case 'setRot': openRvModal(true, { rotId: selectVals.value['ROUTE_CODE'], slotName: slotName }); break; + case 'setRot': + break; } + }, + /** + * @description: 鑾峰彇鏍囬淇℃伅 + * @param {string} type + * @return {*} + */ + GetTitle: () => { + return { + importTitle: '宸ュ崟璁″垝瀵煎叆' /* 鎵撳紑妯℃�佺獥鍙f樉绀虹殑鏍囬 */, + }; }, }; @@ -279,10 +386,17 @@ try { const form = param.values['prodinfo']; const wo = param.values['mValues']; - wo.ROUTE_STATUS = 1; - SaveEntity(wo, true, 'BIZ_MES_WO').then((action) => { + const _wo = cloneDeep(wo); + _wo.ROUTE_STATUS = 1; + _wo.ROUTE_CODE = form.ROUTE_CODE; + SaveEntity(_wo, true, 'BIZ_MES_WO').then((action) => { if (action.IsSuccessed) { - resolve(action); + SP_MES_PROD2WO({ rotId: form.ROT_ID, wo: wo.ORDER_NO }).then((res) => { + if (!res.IsSuccessed) { + SaveEntity(wo, true, 'BIZ_MES_WO'); + } + resolve(res); + }); } else { reject(action); } @@ -302,8 +416,7 @@ try { const form = param.values['forminfo']; const wo = param.values['mValues']; - wo.ROUTE_CODE = form.ROUTE_CODE; - wo.STATUS = 2; + wo.STATUS = wo.STATUS == 3 ? wo.STATUS : 2; let input: SaveWoBatchInput = { Wo: wo, WoBatch: { @@ -313,7 +426,7 @@ UPDATE_TIME: new Date(), UPDATE_USER: useUserStore().getUserInfo.userId as string, GHOST_ROW: false, - AUTH_ORG: '', + AUTH_ORG: useUserStore().getUserInfo.orgCode, AUTH_PROD: useUserStore().getUserInfo.prodCode as string, AUTH_WH: '', ORDER_NO: wo.ORDER_NO, @@ -322,7 +435,7 @@ CUST_CODE: wo.CUST_CODE, FACTORY: wo.FACTORY, WS_CODE: wo.WS_CODE, - ACT_LINE: form.PLAN_LINE, + ACT_LINE: form.ACT_LINE, STD_WORKER_QTY: wo.STD_WORKER_QTY, ACT_WORKER_QTY: wo.ACT_WORKER_QTY, RELEASE_TIME: new Date(), @@ -339,6 +452,7 @@ ACT_END_TIME: wo.ACT_END_TIME, BATCH_NO: '', }, + IfToCust: form.IfToCust, }; SaveMesBatchWo(input).then((action) => { resolve(action); @@ -361,16 +475,27 @@ ID: params['record'].ID, CODE: params['record']['ORDER_NO'], Name: 'BIZ_MES_WO_BATCH', - firstTabName: '宸ュ崟鎵规', - secondTabName: '', //'鏍囩杩囩▼鍙橀噺', - firstTitle: '鎵规', - secondTitle: '', //'杩囩▼鍙橀噺', + Tabs: [ + { + name: '宸ュ崟鎵规', + tableTitle: '鎵规', + entityName: 'BIZ_MES_WO_BATCH', + key: 'batch' + }, + // { + // name: '宸ュ崟鎵规2', + // tableTitle: '鎵规2', + // entityName: 'BIZ_U9_ASN_DTL', + // key: 'batch2' + // } + ], pageTitle: '宸ュ崟璇︽儏', //璇︽儏椤甸潰鏍囬 contentStr: '杩欓噷鏄伐鍗曟壒娆$鐞嗛〉闈紝鍙互鏄剧ず宸ュ崟涓嬪彂鐨勬墍鏈夋壒娆¤鎯�', detailName: `宸ュ崟[${params['record'].ORDER_NO}]鎵规璇︽儏`, keyFieldValues: { ORDER_NO: params['record']['ORDER_NO'] }, colSlots: params['colSlots'].value, SessionName: 'BIZ_MES_WO_BATCH_update', + ifSave: false, }; // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage sessionStorage.removeItem(`${id.SessionName}_params`); @@ -385,26 +510,37 @@ * @return {*} */ function handleConfig(args, params: Recordable) { - const openCustModal = args[7]; - // rotSchema.value = getFormSchema('rotinfo'); - params['routeData'].value = { - nodes: [], - edges: [], + const go = args[5]; + const id = { + ID: params['record'].ID, + Name: 'WoRouteBinding', + CODE: params['record'].ORDER_NO, + Title: `宸ュ崟[${params['record'].ORDER_NO}]宸ヨ壓缁戝畾`, + colSlots: + params['colSlots'].value /* 琛ㄦ牸鍐呯殑鏌ヨ琛ㄥ崟瀛楁鐨勬彃妲藉垪琛紝涓�鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */, + crudColSlots: { + BAS_PKG_DTL: ['BAS_LABEL_TEMP1add'], + ItemCode: ['BAS_CODE_RULE1add'], + } /* 澧炲垹鏀硅〃鍗曞瓧娈电殑鎻掓Ы鍒楄〃锛屼竴鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */, + OtherTableName: [ + 'BAS_PKG_DTL', + 'ItemCode', + ] /* 鑷畾涔夋樉绀哄垪琛ㄧ殑琛ㄥ悕锛岃窡涓婇潰澧炲垹鏀圭殑琛ㄥ悕涓�鑷达紝鏈夊涓氨鏀惧垪琛ㄤ腑 */, + record: params['record'], + dense: true, + pageTitle: `宸ュ崟宸ヨ壓缁戝畾`, + pageContent: `杩欓噷鏄鐞嗗伐鍗曠殑宸ヨ壓缁戝畾锛屼竴涓伐鍗曞彲浠ョ粦瀹氫竴涓伐鑹鸿矾绾匡紝骞跺彲浠ヤ繚瀛樹负瀹㈡埛涓撶敤鐨勫伐鑹鸿矾绾縛, + SessionName: 'WoRouteBinding_update', + ifSave: false, + rotType: 'Wo', }; - initRoute(params['currlf'], params['record'].ROUTE_CODE, params['routeData'], params['currlf']); - params['selectVals'].value['ROUTE_CODE'] = params['record'].ROUTE_CODE; - openCustModal(true, { - isUpdate: true, - ctype: 'BIZ_MES_WO_Config', - title: '宸ヨ壓閰嶇疆', - width: '1200px', - formEl: params['useFormData'].value, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы - formElName: ['woinfo', 'prodinfo', 'rotinfo'], //琛ㄥ崟鎻掓Ы鍚嶇О锛屾敮鎸佸涓〃鍗� - RowKey: '', - fnName: 'SaveCofig', //淇濆瓨鏂规硶鍚� - others: params['routeData'].value, - values: params['record'], //琛ㄥ崟璁板綍 - }); + // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage + sessionStorage.removeItem(`${id.SessionName}_params`); + sessionStorage.setItem(`${id.SessionName}_params`, encodeURI(JSON.stringify(id))); + /* 璁剧疆鏍囧織锛屼互鏍规嵁缂撳瓨鏁版嵁鍙栨暟鎹� */ + const useProdRoute = useProdRouteStore(); + useProdRoute.setChangeToCPPage(true); + go(`/WoRouteBinding/CP/${encodeURI(JSON.stringify({ sName: id.SessionName, Name: id.Name }))}`); } /** @@ -437,6 +573,9 @@ colProps: { span: 24, }, + dynamicDisabled: ({ values }) => { + return true; + }, }, { field: 'RELEASE_QTY', @@ -448,8 +587,8 @@ }, }, { - label: '璁″垝浜х嚎', - field: 'PLAN_LINE', + label: '瀹為檯浜х嚎', + field: 'ACT_LINE', component: 'ApiSelect', required: true, colProps: { @@ -464,34 +603,44 @@ }, }, { - label: '宸ヨ壓璺嚎', - field: 'ROUTE_CODE', - component: 'Input', - required: true, + field: 'IfToCust', + component: 'Switch', + label: '鏄惁淇濆瓨宸ヨ壓璺嚎鍒板鎴�', + defaultValue: true, colProps: { - span: 22, + span: 8, }, + labelWidth: 200, }, - { - field: 'add', - component: 'Input', - label: '1', - colSlot: 'add', - defaultValue: 'MES_ROUTE', - colProps: { - span: 1, - }, - }, - { - field: 'set', - component: 'Input', - label: '1', - colSlot: 'set', - defaultValue: 'MES_ROUTE', - colProps: { - span: 1, - }, - }, + // { + // label: '宸ヨ壓璺嚎', + // field: 'ROUTE_CODE', + // component: 'Input', + // required: true, + // colProps: { + // span: 22, + // }, + // }, + // { + // field: 'add', + // component: 'Input', + // label: '1', + // colSlot: 'add', + // defaultValue: 'MES_ROUTE', + // colProps: { + // span: 1, + // }, + // }, + // { + // field: 'set', + // component: 'Input', + // label: '1', + // colSlot: 'set', + // defaultValue: 'MES_ROUTE', + // colProps: { + // span: 1, + // }, + // }, ]; const woCfgformSchema: FormSchema[] = [ @@ -594,18 +743,27 @@ }, }, { - field: 'fieldsc', - component: 'Upload', - label: '鎵撳嵃妯℃澘', + label: '宸ヨ壓璺嚎', + field: 'ROT_ID', + component: 'Input', + show: false, colProps: { - span: 10, - }, - rules: [{ required: true, message: '璇烽�夋嫨涓婁紶鏂囦欢' }], - componentProps: { - api: uploadApi, - multiple: false, + span: 12, }, }, + // { + // field: 'fieldsc', + // component: 'Upload', + // label: '鎵撳嵃妯℃澘', + // colProps: { + // span: 10, + // }, + // rules: [{ required: true, message: '璇烽�夋嫨涓婁紶鏂囦欢' }], + // componentProps: { + // api: uploadApi, + // multiple: false, + // }, + // }, ]; return [methods, ActionColumn]; -- Gitblit v1.9.3