| | |
| | | scanTimer: null, |
| | | manualInputTimer: null, |
| | | scanTarget: 'tray', // å½åæ«ç ç®æ : tray æ material |
| | | isSubmitting: false, // æ°å¢ï¼æäº¤éå®ï¼é²æ¢éå¤è¯·æ± |
| | | groupedBarcodes: [], |
| | | |
| | | // åºåç»è®¡ç¸å
³åé |
| | | totalStockSum: 0, |
| | |
| | | }, |
| | | // éç½®æææ°æ® |
| | | resetData() { |
| | | this.groupedBarcodes = []; // æ¸
空已ç»çæ¡ç |
| | | this.isSubmitting = false; // éç½®æäº¤é |
| | | this.trayBarcode = ''; |
| | | this.barcode = ''; |
| | | this.materials = []; |
| | |
| | | |
| | | // å¤çç©ææ¡ç æäº¤ |
| | | async handleBarcodeSubmit() { |
| | | if (this.isSubmitting) { |
| | | this.$message.warning('æ£å¨å¤çä¸ï¼è¯·ç¨å'); |
| | | return; |
| | | } |
| | | if (!await this.validateForm()) return; |
| | | const currentBarcode = this.barcode.trim(); |
| | | |
| | |
| | | this.focusBarcodeInput(); |
| | | this.error = ''; |
| | | this.loading = true; |
| | | this.isSubmitting = true; // å¼å¯æäº¤é |
| | | |
| | | try { |
| | | // è°ç¨APIæ¥è¯¢ç©æä¿¡æ¯ |
| | |
| | | } |
| | | |
| | | this.materials = []; |
| | | const newBarcodes = []; // 临æ¶å卿¬æ¬¡æ°å¢çæ¡ç |
| | | materialData.forEach(item => { |
| | | this.materials.push({ |
| | | ...item, |
| | |
| | | locationDesc: this.currentLocationDesc, |
| | | scanTime: this.formatTime(new Date()) |
| | | }); |
| | | newBarcodes.push(item.barcode); // æ¶éæ¬æ¬¡ç»ççæ¡ç |
| | | }); |
| | | // å°æ¬æ¬¡ç»ççæ¡ç å å
¥å·²ç»çå表 |
| | | this.groupedBarcodes = [...new Set([...this.groupedBarcodes, ...newBarcodes])]; |
| | | |
| | | this.orderNo = materialData[0].orderNo; |
| | | await this.fetchStockStatistics(materialData[0].orderNo); |
| | | await this.fetchUnpalletMaterialDetails(); |
| | |
| | | }, 100); |
| | | } finally { |
| | | this.loading = false; |
| | | this.isSubmitting = false; // å
³éæäº¤é |
| | | } |
| | | }, |
| | | |
| | |
| | | // å¤çæ«ç æªè¾å
¥ |
| | | handleKeyPress(event) { |
| | | // å¦ææ¯æå¨è¾å
¥æ¨¡å¼ï¼ä¸å¤çæ«ç æªé»è¾ |
| | | if (this.isManualInput) { |
| | | if (this.isManualInput || this.isSubmitting) { |
| | | return; |
| | | } |
| | | |
| | |
| | | |
| | | // 忽ç¥ç´æ¥æä¸çå车é®ï¼ç±handleBarcodeSubmitå¤çï¼ |
| | | if (key === 'Enter') { |
| | | event.preventDefault(); // 强å¶é»æ¢é»è®¤è¡ä¸ºï¼é¿å
éå¤è§¦å |
| | | if (this.scanCode.length > 0) { |
| | | // 黿¢é»è®¤å车è¡ä¸ºï¼é¿å
表åæäº¤ |
| | | event.preventDefault(); |