| | |
| | | // { printerId: 'Printer2', ipAddress: '192.168.1.2' }, |
| | | // { printerId: 'Printer3', ipAddress: '192.168.1.3' } |
| | | //], // 打印机列表 |
| | | // 当前选中行的索引 |
| | | currentIndex: -1, |
| | | // 存储选中行数据对象 |
| | | selItem: {} , |
| | | ItemBarKw: [],//当天行相关条码库位信息 |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | |
| | | |
| | | /** |
| | | * 处理行点击事件(单选逻辑) |
| | | * @param {Object} item 当前行数据 |
| | | * @param {Number} index 当前行索引 |
| | | */ |
| | | handleRowClick(item, index) { |
| | | if (this.isLoading) { |
| | | return; |
| | | } |
| | | |
| | | // 重置所有行的选中状态 |
| | | this.currentIndex = -1; |
| | | |
| | | // 设置当前选中行 |
| | | this.currentIndex = index; |
| | | this.selItem = { |
| | | itemid: item.fMaterialId, |
| | | index: index |
| | | }; |
| | | |
| | | console.log('当前选中项:', this.selItem); // 调试用 |
| | | |
| | | this.GetBarKwByItem(); |
| | | }, |
| | | GetBarKwByItem() { |
| | | |
| | | var that = this; |
| | | that.isLoading = true; |
| | | that.AxiosHttp("post", 'Womdaa/GetBarKwByItem', { |
| | | itemId: that.selItem.itemid, |
| | | userName: that.userInfo.loginAccount |
| | | }, false) |
| | | .then(function (res) { |
| | | var json = res; |
| | | if (json.status == 0) { |
| | | that.ItemBarKw = json.data.tbBillList; |
| | | } |
| | | else { |
| | | that.$toast.fail(json.message); |
| | | that.$playSound('error'); |
| | | that.ItemBarKw = []; |
| | | } |
| | | that.isLoading = false; |
| | | }) |
| | | .catch(function (error) { |
| | | that.isLoading = false; |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | that.$playSound('error'); |
| | | console.log(error); |
| | | that.ItemBarKw = []; |
| | | }); |
| | | }, |
| | | |
| | | |
| | | getModel() { |
| | | var that = this; |
| | | that.isLoading = true; |
| | |
| | | that.ItemDetail = json.data.tbBillList; |
| | | that.modeInfo.planNo = json.data.tbBillList.planNo; |
| | | that.$refs.barcode.focus(); |
| | | // 重置所有行的选中状态 |
| | | that.currentIndex = -1; |
| | | that.ItemBarKw = []; |
| | | } |
| | | else { |
| | | that.$toast.fail(json.message); |
| | | that.$playSound('error'); |
| | | that.$refs.daa001.focus(); |
| | | that.modeInfo.daa001 = ""; |
| | | that.modeInfo.planNo = ""; |
| | |
| | | .catch(function (error) { |
| | | that.isLoading = false; |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | that.$playSound('error'); |
| | | console.log(error); |
| | | that.$refs.daa001.focus(); |
| | | that.modeInfo.daa001 = ""; |
| | |
| | | that.$notify({ type: 'success', message: json.message }); |
| | | that.$playSound('success'); |
| | | |
| | | that.sendMessage(json.data.tbBillList); |
| | | that.sendPrintMessage(json.data.tbBillList); |
| | | |
| | | that.$refs.barcode.focus(); |
| | | that.getModel(); |
| | |
| | | }, |
| | | |
| | | |
| | | sendMessage(tbBillList) { |
| | | const cfDetails = tbBillList.cfBarInfo.map(item => { |
| | | return "! 0 200 200 210 1\r\n" + |
| | | "PAGE - WIDTH 700 \r\n" + |
| | | "BOX 0 0 700 180 0 \r\n" + |
| | | `T 16 0 10 10 物料编码:\r\n` + |
| | | `T 55 3 120 10 ${item.iteM_NO}\r\n` + |
| | | `T 16 0 310 10 ${item.item_name}\r\n` + |
| | | "T 55 2 10 42 物料规格:\r\n" + |
| | | `T 55 2 110 42 ${item.item_model}\r\n` + |
| | | "T 16 0 10 78 数量:\r\n" + |
| | | `T 0 5 90 78 ${item.quantity}\r\n` + |
| | | `T 16 5 180 78 ${item.barType}\r\n` + |
| | | `BARCODE 128 1 25 35 350 130 ${item.iteM_BARCODE}\r\n` + |
| | | `T 0 1 350 130 ${item.iteM_BARCODE}\r\n` + |
| | | "T 55 0 10 125 创建时间:\r\n" + |
| | | `T 55 0 120 125 ${item.creatE_DATE}\r\n` + |
| | | "T 55 0 10 150 打印时间:\r\n" + |
| | | `T 55 0 120 150 ${item.print_date}\r\n` + |
| | | "B QR 580 12 M 2 U 4\r\n" + |
| | | `MA,${item.iteM_BARCODE}\r\n` + |
| | | "ENDQR\r\nFORM\r\nPRINT\r\n"; |
| | | }); |
| | | //alert(cfDetails); |
| | | let sendData = { |
| | | Type: 'Bar', |
| | | Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE, |
| | | Detail: cfDetails, |
| | | Ip: tbBillList.printInfo[0].ip, |
| | | Port: tbBillList.printInfo[0].port, |
| | | } |
| | | console.log('sendMessage 开始1:') |
| | | console.log('sendMessage 开始2:' + JSON.stringify(sendData)) |
| | | uni.webView.postMessage({ |
| | | data: JSON.stringify(sendData) |
| | | }) |
| | | }, |
| | | //sendMessage(tbBillList) { |
| | | // const cfDetails = tbBillList.cfBarInfo.map(item => { |
| | | // return "! 0 200 200 210 1\r\n" + |
| | | // "PAGE - WIDTH 700 \r\n" + |
| | | // "BOX 0 0 700 180 0 \r\n" + |
| | | // `T 16 0 10 10 物料编码:\r\n` + |
| | | // `T 55 3 120 10 ${item.iteM_NO}\r\n` + |
| | | // `T 16 0 310 10 ${item.item_name}\r\n` + |
| | | // "T 55 2 10 42 物料规格:\r\n" + |
| | | // `T 55 2 110 42 ${item.item_model}\r\n` + |
| | | // "T 16 0 10 78 数量:\r\n" + |
| | | // `T 0 5 90 78 ${item.quantity}\r\n` + |
| | | // `T 16 5 180 78 ${item.barType}\r\n` + |
| | | // `BARCODE 128 1 25 35 350 130 ${item.iteM_BARCODE}\r\n` + |
| | | // `T 0 1 350 130 ${item.iteM_BARCODE}\r\n` + |
| | | // "T 55 0 10 125 创建时间:\r\n" + |
| | | // `T 55 0 120 125 ${item.creatE_DATE}\r\n` + |
| | | // "T 55 0 10 150 打印时间:\r\n" + |
| | | // `T 55 0 120 150 ${item.print_date}\r\n` + |
| | | // "B QR 580 12 M 2 U 4\r\n" + |
| | | // `MA,${item.iteM_BARCODE}\r\n` + |
| | | // "ENDQR\r\nFORM\r\nPRINT\r\n"; |
| | | // }); |
| | | // //alert(cfDetails); |
| | | // let sendData = { |
| | | // Type: 'Bar', |
| | | // Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE, |
| | | // Detail: cfDetails, |
| | | // Ip: tbBillList.printInfo[0].ip, |
| | | // Port: tbBillList.printInfo[0].port, |
| | | // } |
| | | // console.log('sendMessage 开始1:') |
| | | // console.log('sendMessage 开始2:' + JSON.stringify(sendData)) |
| | | // uni.webView.postMessage({ |
| | | // data: JSON.stringify(sendData) |
| | | // }) |
| | | //}, |
| | | |
| | | //getPrintInfo() { |
| | | // var that = this; |