快乐的昕的电脑
2 天以前 e1e6a650f5ece9af7ff0810161edb38d31d540a6
H5/Js/Cpbdsj.js
@@ -48,6 +48,10 @@
    methods: {
        handleAgvPositions(positionStr) {
            if (!positionStr) return [];
            // 检查是否存在逗号,如果不存在则返回空数组
            if (!positionStr.includes(',')) return [];
            // 将字符串按逗号分割并转换为选项数组
            return positionStr.split(',').map(pos => ({
                name: pos.trim() // 去除可能的空格
@@ -71,9 +75,22 @@
                        that.$refs.XBar.focus();
                        that.XbarInfo = [];
                        that.XBar = "";
                        that.AgvDw = json.data.tbBillList.kbBarInfo[0].agvPostion.split(',')[0];
                        that.actionsAgvDw = that.handleAgvPositions(json.data.tbBillList.kbBarInfo[0].agvPostion);
                        // 检查是否存在逗号
                        //const agvPosition = json.data.tbBillList.kbBarInfo[0].agvPostion;
                        //that.AgvDw = agvPosition.includes(',') ? agvPosition.split(',')[0] : '';
                        const agvPostion = json.data && json.data.tbBillList && json.data.tbBillList.kbBarInfo &&
                            json.data.tbBillList.kbBarInfo[0] && json.data.tbBillList.kbBarInfo[0].agvPostion;
                        if (agvPostion != null) {
                            const agvPostionStr = String(agvPostion);
                            that.AgvDw = agvPostionStr.split(',')[0];
                            that.actionsAgvDw = that.handleAgvPositions(agvPostionStr);
                        } else {
                            that.AgvDw = null;
                            that.actionsAgvDw = null;
                        }
                    }
                    else {
                        that.$playSound('error');
@@ -460,6 +477,12 @@
                that.$toast.fail("请先扫描卡板条码");
                return;
            }
            if (!that.AgvDw) {
                that.$playSound('error');
                that.$toast.fail("请先选择AGV点位");
                return;
            }
    
            // 计算可装数和已装数
            const oldqty = +(that.KbBarInfo.quantity || 0);