From ec0d91353b767f089fa72f3cd1eb62568852710b Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 22 八月 2024 10:39:30 +0800 Subject: [PATCH] 工单管理增加取消下发功能 --- src/views/tigerprojects/mes/eng/route/index.vue | 92 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 82 insertions(+), 10 deletions(-) diff --git a/src/views/tigerprojects/mes/eng/route/index.vue b/src/views/tigerprojects/mes/eng/route/index.vue index f9221a4..36db057 100644 --- a/src/views/tigerprojects/mes/eng/route/index.vue +++ b/src/views/tigerprojects/mes/eng/route/index.vue @@ -47,7 +47,12 @@ <script lang="ts" setup> import { FlowChart } from '/@/components/FlowChart'; import { PageWrapper } from '/@/components/Page'; - import { SaveRouteData, getRouteData } from '/@/api/tigerapi/mes/router'; + import { + SaveRouteData, + SaveWoRouteData, + getRouteData, + getWoRouteData, + } from '/@/api/tigerapi/mes/router'; import { useModal } from '/@/components/Modal'; import RouteModal from './RouteModal.vue'; import { onMounted, ref, unref, Ref, provide, reactive, nextTick, watch } from 'vue'; @@ -94,6 +99,7 @@ currentAct: {} as MES_ROUTE_NODE_ACT, routeData: {} as RouteData, activeKey: 1, + isWorkOrder: false, }); const currRoute = ref({} as MES_ROUTE); const routeData = ref({ @@ -104,20 +110,27 @@ provide<Ref<MES_ROUTE>>('mesRoute', currRoute); const selectnode = ref({} as node); const currRotId = ref(route.params?.id); + const prodCode = ref(''); + const custCode = ref(''); const colSlots = ref<any>([]); const crudColSlots = ref<any>([]); const entityName = ref<any>('MES_POSITION'); const props = defineProps({ rotId: { type: String, default: '' }, + rotType: { type: String, default: 'Route' }, + prodCode: { type: String, default: '' }, + custCode: { type: String, default: '' }, }); const IsOperation = ref(false); const title = ref(''); const posttitle = ref(''); + let _num = 1; + let _numEdge = 1; watch( - () => props.rotId, + [() => props.rotId,()=> props.prodCode, () => props.custCode], (v) => { - if (v !== currRotId.value) { - currRotId.value = v; + if (!isNullOrEmpty(v[0]) && v[0] !== currRotId.value) { + currRotId.value = v[0]; if (!isNullOrUnDef(unref(currlf))) { unref(currlf).render({}); routeData.value = { @@ -126,6 +139,12 @@ }; init(currlf); } + } + if (!isNullOrEmpty(v[1]) && v[1] !== prodCode.value) { + prodCode.value = v[1]; + } + if (!isNullOrEmpty(v[2]) && v[2] !== custCode.value) { + custCode.value = v[2]; } }, { deep: true }, @@ -143,7 +162,11 @@ async function init(lf) { currlf.value = unref(lf); //閫氳繃宸ヨ壓璺嚎ID鑾峰彇鍥惧舰鏁版嵁锛屽苟娓叉煋 - var _data = await getRouteData(currRotId.value); + routeConfig.isWorkOrder = props.rotType == 'Wo'; + var _data = + props.rotType == 'Route' + ? await getRouteData(currRotId.value) + : await getWoRouteData(currRotId.value); console.log('缁勪欢宸叉寕杞�', _data); //宸ヨ壓璺嚎鍏ㄤ俊鎭紝鍖呮嫭Node銆丒dge鍜孉ct routeConfig.routeData = _data.Data; @@ -152,6 +175,12 @@ currRoute.value = _data.Data.route; if (!isNullOrEmpty(currRotId.value) && isNullOrEmpty(props.rotId)) { setTitle('璁捐锛氬伐鑹鸿矾绾�-' + currRoute.value.ROT_CODE); + } + if(!isNullOrEmpty(prodCode.value)){ + currRoute.value.PROD_CODE = !isNullOrEmpty(currRoute.value.PROD_CODE)?currRoute.value.PROD_CODE: prodCode.value; + } + if(!isNullOrEmpty(custCode.value)){ + currRoute.value.CUST_CODE = !isNullOrEmpty(currRoute.value.CUST_CODE)?currRoute.value.CUST_CODE: custCode.value; } _data.Data.nodes.forEach((n) => { n.node.properties = JSON.parse(n.node.properties); @@ -172,6 +201,11 @@ } } + /** + * @description: 鑾峰彇宸ヨ壓璺嚎鍥炬暟鎹� + * @param {*} lf + * @return {*} + */ const GetRotData = (lf) => { var currRotData: RouteData = { route: { @@ -190,6 +224,9 @@ AUTH_ORG: useUserStore().getUserInfo.orgCode, AUTH_PROD: '', AUTH_WH: '', + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: currRoute.value.CUST_CODE, }, nodes: [], edges: [], @@ -197,7 +234,6 @@ }; var _nodes = unref(lf).getGraphData().nodes as node[]; var _edges = unref(lf).getGraphData().edges as edge[]; - var _num = 1; const diffnodes = routeConfig.routeData.nodes.filter((itemA) => _nodes.some((itemB) => itemB.id === itemA.ID), ); @@ -243,6 +279,9 @@ // DO_IF_FAIL: a.DO_IF_FAIL, node: {} as node, IS_ACTIVE: a.IS_ACTIVE, + WORK_ORDER: a.WORK_ORDER, + PROD_CODE: a.PROD_CODE, + CUST_CODE: a.CUST_CODE, }; var pnode = [n]; while (pnode[0].properties.operType == 'Action') { @@ -278,6 +317,7 @@ GPH_TEXT: n.text.value, IS_ACTIVE: nd.IS_ACTIVE, IS_CALC_FPY: nd.IS_CALC_FPY, + ALLOW_DFT_IN: nd.ALLOW_DFT_IN, CAN_SKIP: nd.CAN_SKIP, REMARK: nd.REMARK, AUTH_ORG: useUserStore().getUserInfo.orgCode, @@ -292,6 +332,9 @@ OPTION_4: '', OPTION_5: '', node: {} as node, + WORK_ORDER: nd.WORK_ORDER, + PROD_CODE: nd.PROD_CODE, + CUST_CODE: nd.CUST_CODE, }; nd.GPH_TYPE = n.type; nd.GPH_PROP = JSON.stringify(n.properties); @@ -340,9 +383,13 @@ OPTION_4: '', OPTION_5: '', edge: {} as edge, + WORK_ORDER: routeConfig.routeData.route.WORK_ORDER, + PROD_CODE: routeConfig.routeData.route.PROD_CODE, + CUST_CODE: routeConfig.routeData.route.CUST_CODE, }; routeConfig.routeData.edges.push(edge); currRotData.edges.push(edge); + _numEdge++; }); return currRotData; }; @@ -352,7 +399,10 @@ */ async function handleSave(lf) { console.log('handleSave', unref(lf).getGraphData().nodes[0]); - if (isNullOrEmpty(currRoute.value.ROT_CODE)) { + if ( + isNullOrEmpty(currRoute.value.ROT_CODE) || + (props.rotType == 'Wo' && isNullOrEmpty(currRoute.value.WORK_ORDER)) + ) { createErrorModal({ title: t('鏈�夋嫨'), content: t('鏈�夋嫨宸ヨ壓璺嚎鎴栬�呮柊澧炲伐鑹鸿矾绾�'), @@ -377,7 +427,10 @@ getContainer: () => document.body, }); } else { - var action = await SaveRouteData(GetRotData(lf)); + var action = + props.rotType == 'Wo' + ? await SaveWoRouteData(GetRotData(lf)) + : await SaveRouteData(GetRotData(lf)); if (action.IsSuccessed) { await refreshPage(); } @@ -426,7 +479,7 @@ UPDATE_TIME: currRoute.value.UPDATE_TIME, UPDATE_USER: useUserStore().getUserInfo.userId as string, GHOST_ROW: false, - NODE_NAME: `${selectnode.value.text.value}_0`, + NODE_NAME: `${selectnode.value.text.value}_${_num}`, ROT_ID: currRoute.value.ID, SEGMENT: '', OPER_CODE: selectnode.value.type, @@ -443,6 +496,7 @@ AUTH_PROD: '', AUTH_WH: '', IS_FIRST_NODE: '', + ALLOW_DFT_IN: '', IS_INPUT: '', IS_OUTPUT: '', OPTION_1: '', @@ -451,8 +505,12 @@ OPTION_4: '', OPTION_5: '', node: {} as node, + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: currRoute.value.CUST_CODE, }; routeConfig.routeData.nodes.push(_node); + _num++; } //鏄涓� if ( @@ -475,7 +533,7 @@ AUTH_ORG: useUserStore().getUserInfo.orgCode, AUTH_PROD: '', AUTH_WH: '', - ACT_NAME: `${selectnode.value.text.value}_0`, + ACT_NAME: `${selectnode.value.text.value}_${_numEdge}`, ACT_CODE: '', ROT_ID: currRoute.value.ID, NODE_ID: '', @@ -499,8 +557,12 @@ OPTION_5: '', REMARK: '', node: {} as node, + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: currRoute.value.CUST_CODE, }; routeConfig.routeData.acts.push(_act); + _numEdge++; } routeConfig.currentAct = { ID: selectnode.value.id, @@ -536,6 +598,9 @@ OPTION_5: '', REMARK: '', node: {} as node, + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: currRoute.value.CUST_CODE, }; const actModel = lf.getNodeModelById(selectnode.value.id); actModel.updateText(routeConfig.currentAct?.ACT_NAME); @@ -565,13 +630,20 @@ IS_CALC_FPY: _node.IS_CALC_FPY, CAN_SKIP: _node.CAN_SKIP, IS_INPUT: _node.IS_INPUT, + ALLOW_DFT_IN: _node.ALLOW_DFT_IN, IS_OUTPUT: _node.IS_OUTPUT, REMARK: _node.REMARK, + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: currRoute.value.CUST_CODE, + node: {} as node, }; const nodeModel = lf.getNodeModelById(selectnode.value.id); nodeModel.updateText(_node.NODE_NAME); routeConfig.isCalcFpy = _node.IS_CALC_FPY == 'Y'; routeConfig.canSkip = _node.CAN_SKIP == 'Y'; + routeConfig.isActive = _node.IS_ACTIVE == 'Y'; + routeConfig.allowDftIn = _node.ALLOW_DFT_IN == 'Y'; routeConfig.isInput = _node.IS_INPUT == 'Y'; routeConfig.isOutput = _node.IS_OUTPUT == 'Y'; setTimeout(() => { -- Gitblit v1.9.3