| | |
| | | console.log("code:===========", JSON.parse(code.code)); |
| | | console.log("id:=============", JSON.parse(code.code).id); |
| | | try { |
| | | const { data } = await TwistApi.getScarn({ |
| | | outPutId: JSON.parse(code.code).id, |
| | | }); |
| | | |
| | | // 检查是否已选择标签 |
| | | if (!tab.value) { |
| | | toast.error("请先选择一个层"); |
| | |
| | | toast.error("未找到当前选中的层"); |
| | | return; |
| | | } |
| | | console.log("tab.value:===========3", currentLayer); |
| | | // 在发起请求前,先校验该单丝是否已在当前或其他层级被领用 |
| | | const scannedOutputId = JSON.parse(code.code).id; |
| | | const alreadyUsed = nodeList.value.some((node) => |
| | | (node.strandedWireDish || []).some((item: any) => item.outputId === scannedOutputId) |
| | | ); |
| | | if (alreadyUsed) { |
| | | toast.error("该单丝已领用,请勿重复扫码"); |
| | | return; |
| | | } |
| | | const { data } = await TwistApi.getScarn({ |
| | | outPutId: scannedOutputId, |
| | | twistId: currentLayer.twistId, |
| | | }); |
| | | |
| | | // 检查当前层是否已存在该单丝 |
| | | const exists = currentLayer.strandedWireDish?.some( |