var vm = new Vue({ el: '#app', data: function () { return { isLoading: false, userInfo: { "loginGuid": '', "loginAccount": '', }, KbBar: "",//卡板条码 LsBar: "",//后盖流水条码 XBar: "",//箱条码 UserName: Cookies.get('loginName'),//用户名称 KbBarInfo: [], KbBarMxInfo: [], show: false,//列表展示 actions: [{ name: "一楼", Postition: 1 // 新增 }, { name: "四楼", Postition: 4 // 新增 }],//列表的值 show2: false,//列表展示 actions2: [{ name: "合格" },{ name: "不合格" }],//列表的值 lcName: "",//楼层名称 lcNum: "",//楼层编号 jyz: "",//检验值 } }, mounted() { var that = this; this.userInfo = { loginGuid: this.GetLoginInfor().loginGuid, loginAccount: this.GetLoginInfor().loginAccount, }; }, methods: { getKbBarInfo() { var that = this; that.isLoading = true; that.AxiosHttp("post", 'Womdaa/getKbBarInfo', { Xt: that.GX, Kbbarcode: that.KbBar }, false) .then(function (res) { var json = res; if (json.status == 0) { } else { that.$playSound('error'); that.$toast.fail(json.message); that.$refs.KbBar.focus(); that.KbBar = ""; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$playSound('error'); that.$toast.fail("网络错误,请重试!"); that.$refs.KbBar.focus(); that.KbBar = ""; }); }, handleClear() { this.KbBar = ""; this.XBar = ""; this.LsBar = ""; this.DAA001 = []; this.XbarInfo = []; }, handleSubmit() { if (this.isLoading) { return; } var that = this; if (!that.KbBar) { that.$playSound('error'); that.$toast.fail("请先扫描卡板条码"); return; } // 计算可装数和已装数 const oldqty = +(that.KbBarInfo.quantity || 0); const ySum = +(that.KbBarInfo.ySum || 0); if (oldqty !== ySum) { that.$playSound('error'); that.$toast.fail(`装板未完成,待装数:${oldqty - ySum}`); return; } that.isLoading = true; that.AxiosHttp("post", 'Womdaa/submitInspection', { KbBar: that.KbBar, userAccount: that.userInfo.loginAccount }, false) .then(function (res) { var json = res; if (json.status == 0) { that.$playSound('success'); that.$notify({ type: 'success', message: json.message }); // 清空数据 //that.KbBar = ""; //that.XbarInfo = []; //that.KbBarInfo = []; //that.$refs.KbBar.focus(); } else { that.$playSound('error'); that.$toast.fail(json.message); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$playSound('error'); that.$toast.fail("提交失败,请重试!"); that.$refs.KbBar.focus(); }); }, onSelect(action) { this.lcNum = action.Postition; // 绑定line_no到xtNum字段 //console.log("选择的线体编号:", this.xtNum); this.lcName = action.name; // 绑定name到xtName字段 this.show = false; }, onSelect2(action) { this.jyz = action.name; // 绑定name到xtName字段 this.show2 = false; }, //获取可呼叫AGV的线体 selectLc() { this.show = true; //var that = this; //that.actions = []; //that.isLoading = true; //that.AxiosHttp("post", 'Womdaa/GetAgvXt', { // selectKey: that.selectKey, //}, false) // .then(function (res) { // var json = res; // if (json.status == 0) { // if (json.data.tbBillList.length <= 0) { // that.$toast.fail("没有可用的数据"); // that.$playSound('error'); // } else { // that.itemInfo = json.data.tbBillList; // that.actions = json.data.tbBillList.map(item => { // return { // name: item.name, // lineNo: item.line_no // 新增 // }; // }); // } // } // else { // that.$toast.fail(json.message); // that.$playSound('error'); // } // that.isLoading = false; // }) // .catch(function (error) { // that.isLoading = false; // that.$toast.fail("网络错误,请重试!"); // that.$playSound('error'); // console.log(error); // }); }, selectJyz() { this.show2 = true; }, //AGV送检 handleAgvSj() { //this.$toast.fail("功能开发测试中!"); //return; if (this.isLoading) { return; } var that = this; if (!that.KbBar) { that.$playSound('error'); that.$toast.fail("请先扫描卡板条码"); return; } that.isLoading = true; that.AxiosHttp("post", 'Womdaa/handleAGVInspection', { KbBar: that.KbBar, userAccount: that.userInfo.loginAccount }, false) .then(function (res) { var json = res; if (json.status == 0) { that.$playSound('success'); that.$notify({ type: 'success', message: json.message }); } else { that.$playSound('error'); that.$toast.fail(json.message); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$playSound('error'); that.$toast.fail("AGV送检失败,请重试!"); that.$refs.KbBar.focus(); }); }, //AGV检验 handleAgvJy() { //this.$toast.fail("功能开发测试中!"); //return; if (this.isLoading) { return; } var that = this; if (!that.jyz) { that.$playSound('error'); that.$toast.fail("请先选择检验值"); return; } that.isLoading = true; that.AxiosHttp("post", 'Womdaa/handleAgvJy', { jyz: that.jyz, KbBar: that.KbBar, userAccount: that.userInfo.loginAccount }, false) .then(function (res) { var json = res; if (json.status == 0) { that.$playSound('success'); that.$notify({ type: 'success', message: json.message }); } else { that.$playSound('error'); that.$toast.fail(json.message); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$playSound('error'); that.$toast.fail("AGV检验失败,请重试!"); that.$refs.KbBar.focus(); }); }, handleAgvRk() { //this.$toast.fail("功能开发测试中!"); //return; if (this.isLoading) { return; } var that = this; if (!that.KbBar) { that.$playSound('error'); that.$toast.fail("请先扫描卡板条码"); return; } that.isLoading = true; that.AxiosHttp("post", 'Womdaa/handleAgvRk', { KbBar: that.KbBar, userAccount: that.userInfo.loginAccount, Postition: that.lcNum }, false) .then(function (res) { var json = res; if (json.status == 0) { that.$playSound('success'); that.$notify({ type: 'success', message: json.message }); } else { that.$playSound('error'); that.$toast.fail(json.message); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$playSound('error'); that.$toast.fail("AGV入立库失败,请重试!"); that.$refs.KbBar.focus(); }); }, } })