diff --git a/src/components/Common/CommonInstructSet.js b/src/components/Common/CommonInstructSet.js index 2430182..a6c9d53 100644 --- a/src/components/Common/CommonInstructSet.js +++ b/src/components/Common/CommonInstructSet.js @@ -336,7 +336,7 @@ const instructSetInit = async props => { props.callback && props.callback(); }); }); - + console.log('02', '执行指令集inscallback'); props.inscallback && props.inscallback({ ...props, ...addStateNew }); }; diff --git a/src/mes/common/commonOperationBarComponent/index.js b/src/mes/common/commonOperationBarComponent/index.js index 0cb4258..0af9e1b 100644 --- a/src/mes/common/commonOperationBarComponent/index.js +++ b/src/mes/common/commonOperationBarComponent/index.js @@ -1329,7 +1329,7 @@ const CommonOperationBarComponent = basProps => { const scanEventTime = useRef(-1); const userInfo = commonUtils.getAppData("userinfo") // 执行扫码枪指令 - const handleScanCodeInstructs = (value, bCostom) => { + const handleScanCodeInstructs = async (value, bCostom) => { scanEventTime.current = -1; // this.handleBtnClick() props.onProcedureCall({ @@ -1580,7 +1580,7 @@ const BarcodeComponent = props => { const scanEventTime = useRef(-1); // 执行扫码枪指令 - const handleScanCodeInstructs = (value, bCostom) => { + const handleScanCodeInstructs = async (value, bCostom) => { scanEventTime.current = -1; // 获取当前工单信息数据 @@ -1600,6 +1600,15 @@ const BarcodeComponent = props => { item => item.sName === "sSearchProductName" ); + // 用于等待指令集执行完毕(02 inscallback 执行完) + // 添加超时机制,防止指令集异常时 inscallback 未导致 Promise 永久阻塞 + let resolveInscallback; + const inscallbackPromise = new Promise(resolve => { + resolveInscallback = resolve; + // 20秒超时,确保即使 inscallback 未调用也能继续执行 + setTimeout(() => resolve(), 20000); + }); + try { props.onExecInstructSet({ btnConfig, @@ -1618,8 +1627,12 @@ const BarcodeComponent = props => { refreshMachineDataFlag: new Date().getTime(), productionTableList: [sName] }, () => { - // props.onRefresh && props.onRefresh(); + // 02 执行完毕,通知等待的 Promise + resolveInscallback && resolveInscallback(); }); + } else { + // 没有 searchProductConfig 时直接通知 + resolveInscallback && resolveInscallback(); } } // inscallback: nextProps => { @@ -1653,8 +1666,15 @@ const BarcodeComponent = props => { // } // } }); + + // 等待 02 (inscallback) 执行完毕 + await inscallbackPromise; + console.log('03-inscallbackPromise'); + + } catch (error) { + console.error('执行指令集失败:', error); } finally { - console.log('finily-上料执行界面刷新:'); + console.log('04 - finily-上料执行界面刷新:'); props.onRefresh && props.onRefresh(); } }; diff --git a/src/utils/config.js b/src/utils/config.js index d0dfeb8..1d1065c 100644 --- a/src/utils/config.js +++ b/src/utils/config.js @@ -5,8 +5,8 @@ export const webSite = { // ipAddress: '//t0.xlyprint.com:8000/xlyEntry/', /* 服务器地址 */ // faceAddress: isDev ? '//192.168.11.22:8080/xlyFace' : '//' + location.host + '/xlyFace', fileAddress: isDev ? '//km5cjx.gnway.cc:43920/xlyReport/' : '//' + location.host + '/xlyReport/', // 接口地址 - faceAddress: isDev ? '//km5cjx.gnway.cc:43920/xlyFace' : '//' + location.host + '/xlyFace', - ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:43920/xlyEntry/' : '//' + location.host + '/xlyEntry/', + faceAddress: isDev ? '//km5cjx.gnway.cc:47400/xlyFace' : '//' + location.host + '/xlyFace', + ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:47400/xlyEntry/' : '//' + location.host + '/xlyEntry/', interfaceAddress: isDev ? '//km5cjx.gnway.cc:43920/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址 // ipAddress: isDev ? '//ebc.jinjia.com:8091/xlyEntry/' : '//' + location.host + '/xlyEntry/', // interfaceAddress: isDev ? '//ebc.jinjia.com:8091/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址