| | |
| | | return; |
| | | } |
| | | |
| | | // 解析扫码数据 |
| | | // 解析扫码数据,现在二维码只包含id |
| | | const scanData = JSON.parse(code.code); |
| | | const outPutId = scanData.id; |
| | | |
| | | // 判断层级是否匹配 |
| | | if (scanData.layer && scanData.layer !== currentLayer.twistedLayer) { |
| | | if (!outPutId) { |
| | | toast.error("二维码格式错误,缺少id信息"); |
| | | return; |
| | | } |
| | | |
| | | // 调用接口获取拉丝详细信息 |
| | | const { data: tagData } = await TwistApi.getTagByIdLs({ |
| | | outPutId: outPutId, |
| | | }); |
| | | |
| | | // 判断层级是否匹配(如果接口返回的数据中有layer字段) |
| | | if (tagData.layer && tagData.layer !== currentLayer.twistedLayer) { |
| | | toast.error( |
| | | `领用层级不对,当前层是:${currentLayer.twistedLayer},领用单丝层是:${scanData.layer}` |
| | | `领用层级不对,当前层是:${currentLayer.twistedLayer},领用单丝层是:${tagData.layer}` |
| | | ); |
| | | // return; |
| | | } |
| | | |
| | | // 调用单丝领用扫码接口 |
| | | const { data } = await TwistApi.getScarn({ |
| | | outPutId: scanData.id, |
| | | outPutId: outPutId, |
| | | twistId: currentLayer.twistId, |
| | | }); |
| | | |