luxiaotao1123
2024-04-07 3b383c80c90a7d0cdc980ce6fe9889bfa20fecb9
zy-asrs-flow/src/pages/map/utils.js
@@ -113,6 +113,17 @@
    };
}
export const querySprite = (type, no) => {
    if (!mapContainer) {
        return;
    }
    for (const sprite of mapContainer.children) {
        if (sprite.data?.type === type && sprite.data?.no === no) {
            return sprite;
        }
    }
}
// show sprite feature from sprite click event
export const viewFeature = (sprite, setCurSPrite) => {
    sprite.off('pointerup');
@@ -582,4 +593,19 @@
export const generateLocNo = (row, bay, lev) => {
    return row + '-' + bay + '-' + lev;
}
export const updateMapStatusInRealTime = (data) => {
    const mapVo = JSON.parse(data);
    // shuttle
    for (const shuttleVo of mapVo.shuttleVos) {
        const shuttle = querySprite(SENSOR_TYPE.SHUTTLE, shuttleVo.shuttleNo);
        if (!shuttle && !shuttleVo.curLocNo) { continue; }
        const { row, bay, lev } = parseLocNo(shuttleVo.curLocNo);
        const shelf = querySprite(SENSOR_TYPE.SHELF, row + '-' + bay);
        new TWEEDLE.Tween(shuttle.position).easing(TWEEDLE.Easing.Linear.None).to({
            x: shelf.position.x,
            y: shelf.position.y
        }, 1000).start();
    }
}