diff --git a/src/views/quality/component/shipmentCode.vue b/src/views/quality/component/shipmentCode.vue index 8462c64..3a2f704 100644 --- a/src/views/quality/component/shipmentCode.vue +++ b/src/views/quality/component/shipmentCode.vue @@ -24,6 +24,9 @@ export default { props: { shipOrderId: { default: '', + }, + tableData: { + default: [] } }, data() { @@ -31,31 +34,77 @@ export default { pickCode: '', statusInfo: '', isSuccess: false, + currentShipOrder: '', + newEmitObj: {}, } }, methods: { + // 扫码之后的处理 enterPress() { - if (!this.shipOrderId) { - this.msgInfo('请先选择发运单!') - return - } - let params = { - shipOrderId: this.shipOrderId, - packOrderId: this.pickCode - } - checkScancarpack(params).then(res => { - if (res.code === 200) { - this.isSuccess = true - this.$emit('handleSuccessCode', this.shipOrderId) + this.statusInfo = '' + // this.checkCode() + if (this.pickCode.indexOf('PACK-') != -1) { // 拣料项 + if (!this.shipOrderId) { + this.msgInfo('请先扫描发运单!') + return } else { - this.isSuccess = false + let params = { + shipOrderId: this.shipOrderId, + packOrderId: this.pickCode + } + checkScancarpack(params).then(res => { + if (res.code === 200) { + this.isSuccess = true + this.newEmitObj = { + shipOrderId: this.shipOrderId, + } + this.$emit('handleSuccessCode', this.newEmitObj) + } else { + this.isSuccess = false + } + this.statusInfo = res.msg + }).catch(res => { + this.statusInfo = res.msg + this.isSuccess = false + }) } - this.statusInfo = res.msg - }).catch(res => { - this.statusInfo = res.msg - this.isSuccess = false - }) + } else { // 发运单 + this.tableData.forEach(el => { + if (el['JIT_ShipOrder-ShipOrderId'] === this.pickCode) { + this.currentShipOrder = el + this.newEmitObj = { + currentShipOrder: el, + } + this.$emit('handleSuccessCode', this.newEmitObj) + } else { + this.statusInfo = '发运单信息不存在!' + return + } + }) + } + }, + // 校验扫码是发运单还是拣料项 + checkCode() { + if (this.pickCode.indexOf('PACK-') != -1) { // 拣料项 + if (!this.shipOrderId) { + this.msgInfo('请先选择发运单!') + return + } + } else { // 发运单 + this.tableData.forEach(el => { + if (el['JIT_ShipOrder-ShipOrderId'] === this.pickCode) { + this.currentShipOrder = el['JIT_ShipOrder-ShipOrderId'] + this.newEmitObj = { + currentShipOrder: this.currentShipOrder, + } + this.$emit('handleSuccessCode', this.newEmitObj) + } else { + + } + }) + } }, + // 重置扫描条码 resetCode() { this.pickCode = '' } diff --git a/src/views/quality/component/shipmentSearch.vue b/src/views/quality/component/shipmentSearch.vue index 81db2b0..6e491d1 100644 --- a/src/views/quality/component/shipmentSearch.vue +++ b/src/views/quality/component/shipmentSearch.vue @@ -14,6 +14,7 @@ 后一天
- +
- +
@@ -30,14 +30,23 @@ export default { data() { return { shipOrderId: '', + tableData: [], } }, methods: { handleCurrentChange(data) { - this.shipOrderId = data['JIT_ShipOrder-ShipOrderId'] + if (data.currentData) { + this.shipOrderId = data['currentData']['JIT_ShipOrder-ShipOrderId'] + } + this.tableData = data.tableData }, handleSuccessCode(data) { - this.$refs.shipmentSearch.getInfo(data) + console.log(data) + if (data.shipOrderId) { + this.$refs.shipmentList.getInfo(data) + } else { + this.$refs.shipmentSearch.handleCurrentChange(data.currentShipOrder) + } } }, }