Commit 108f5d5dfb340961da1b4cac33cbcebaf07f38de
1 parent
ba5298e4
更新以下内容: 处理扫码上料后界面没刷新出来,必须要再刷新依次
Showing
3 changed files
with
27 additions
and
7 deletions
src/components/Common/CommonInstructSet.js
src/mes/common/commonOperationBarComponent/index.js
| ... | ... | @@ -1329,7 +1329,7 @@ const CommonOperationBarComponent = basProps => { |
| 1329 | 1329 | const scanEventTime = useRef(-1); |
| 1330 | 1330 | const userInfo = commonUtils.getAppData("userinfo") |
| 1331 | 1331 | // 执行扫码枪指令 |
| 1332 | - const handleScanCodeInstructs = (value, bCostom) => { | |
| 1332 | + const handleScanCodeInstructs = async (value, bCostom) => { | |
| 1333 | 1333 | scanEventTime.current = -1; |
| 1334 | 1334 | // this.handleBtnClick() |
| 1335 | 1335 | props.onProcedureCall({ |
| ... | ... | @@ -1580,7 +1580,7 @@ const BarcodeComponent = props => { |
| 1580 | 1580 | const scanEventTime = useRef(-1); |
| 1581 | 1581 | |
| 1582 | 1582 | // 执行扫码枪指令 |
| 1583 | - const handleScanCodeInstructs = (value, bCostom) => { | |
| 1583 | + const handleScanCodeInstructs = async (value, bCostom) => { | |
| 1584 | 1584 | scanEventTime.current = -1; |
| 1585 | 1585 | |
| 1586 | 1586 | // 获取当前工单信息数据 |
| ... | ... | @@ -1600,6 +1600,15 @@ const BarcodeComponent = props => { |
| 1600 | 1600 | item => item.sName === "sSearchProductName" |
| 1601 | 1601 | ); |
| 1602 | 1602 | |
| 1603 | + // 用于等待指令集执行完毕(02 inscallback 执行完) | |
| 1604 | + // 添加超时机制,防止指令集异常时 inscallback 未导致 Promise 永久阻塞 | |
| 1605 | + let resolveInscallback; | |
| 1606 | + const inscallbackPromise = new Promise(resolve => { | |
| 1607 | + resolveInscallback = resolve; | |
| 1608 | + // 20秒超时,确保即使 inscallback 未调用也能继续执行 | |
| 1609 | + setTimeout(() => resolve(), 20000); | |
| 1610 | + }); | |
| 1611 | + | |
| 1603 | 1612 | try { |
| 1604 | 1613 | props.onExecInstructSet({ |
| 1605 | 1614 | btnConfig, |
| ... | ... | @@ -1618,8 +1627,12 @@ const BarcodeComponent = props => { |
| 1618 | 1627 | refreshMachineDataFlag: new Date().getTime(), |
| 1619 | 1628 | productionTableList: [sName] |
| 1620 | 1629 | }, () => { |
| 1621 | - // props.onRefresh && props.onRefresh(); | |
| 1630 | + // 02 执行完毕,通知等待的 Promise | |
| 1631 | + resolveInscallback && resolveInscallback(); | |
| 1622 | 1632 | }); |
| 1633 | + } else { | |
| 1634 | + // 没有 searchProductConfig 时直接通知 | |
| 1635 | + resolveInscallback && resolveInscallback(); | |
| 1623 | 1636 | } |
| 1624 | 1637 | } |
| 1625 | 1638 | // inscallback: nextProps => { |
| ... | ... | @@ -1653,8 +1666,15 @@ const BarcodeComponent = props => { |
| 1653 | 1666 | // } |
| 1654 | 1667 | // } |
| 1655 | 1668 | }); |
| 1669 | + | |
| 1670 | + // 等待 02 (inscallback) 执行完毕 | |
| 1671 | + await inscallbackPromise; | |
| 1672 | + console.log('03-inscallbackPromise'); | |
| 1673 | + | |
| 1674 | + } catch (error) { | |
| 1675 | + console.error('执行指令集失败:', error); | |
| 1656 | 1676 | } finally { |
| 1657 | - console.log('finily-上料执行界面刷新:'); | |
| 1677 | + console.log('04 - finily-上料执行界面刷新:'); | |
| 1658 | 1678 | props.onRefresh && props.onRefresh(); |
| 1659 | 1679 | } |
| 1660 | 1680 | }; | ... | ... |
src/utils/config.js
| ... | ... | @@ -5,8 +5,8 @@ export const webSite = { |
| 5 | 5 | // ipAddress: '//t0.xlyprint.com:8000/xlyEntry/', /* 服务器地址 */ |
| 6 | 6 | // faceAddress: isDev ? '//192.168.11.22:8080/xlyFace' : '//' + location.host + '/xlyFace', |
| 7 | 7 | fileAddress: isDev ? '//km5cjx.gnway.cc:43920/xlyReport/' : '//' + location.host + '/xlyReport/', // 接口地址 |
| 8 | - faceAddress: isDev ? '//km5cjx.gnway.cc:43920/xlyFace' : '//' + location.host + '/xlyFace', | |
| 9 | - ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:43920/xlyEntry/' : '//' + location.host + '/xlyEntry/', | |
| 8 | + faceAddress: isDev ? '//km5cjx.gnway.cc:47400/xlyFace' : '//' + location.host + '/xlyFace', | |
| 9 | + ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:47400/xlyEntry/' : '//' + location.host + '/xlyEntry/', | |
| 10 | 10 | interfaceAddress: isDev ? '//km5cjx.gnway.cc:43920/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址 |
| 11 | 11 | // ipAddress: isDev ? '//ebc.jinjia.com:8091/xlyEntry/' : '//' + location.host + '/xlyEntry/', |
| 12 | 12 | // interfaceAddress: isDev ? '//ebc.jinjia.com:8091/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址 | ... | ... |