fix:去掉200次计数,改为永久复用+绑定失败时重建

This commit is contained in:
ShenQiLun 2026-06-26 11:24:47 +08:00
parent b595f2e8b6
commit b9f3b1983c

View File

@ -2508,7 +2508,7 @@ export default {
}, },
// syncBook // syncBook
// 使 200 //
async callWaveApi(warehouseData, productId) { async callWaveApi(warehouseData, productId) {
var timestamp = String(Math.floor(Date.now() / 1000)) var timestamp = String(Math.floor(Date.now() / 1000))
var price = this.currentTab === 'isbn' var price = this.currentTab === 'isbn'
@ -2527,23 +2527,21 @@ export default {
return return
} }
var WAVE_MAX_USE = 200
var waveNo = uni.getStorageSync('reuseWaveNo') || '' var waveNo = uni.getStorageSync('reuseWaveNo') || ''
var waveCount = parseInt(uni.getStorageSync('reuseWaveCount') || '0')
// + //
if (waveNo && waveCount < WAVE_MAX_USE) { if (waveNo) {
console.log('【波次】复用 wave_no=' + waveNo + ' 已用=' + (waveCount + 1) + '/' + WAVE_MAX_USE) console.log('【波次】尝试复用 wave_no=' + waveNo)
var bindResult = await this.callBindWaveApi(timestamp, waveNo) var bindResult = await this.callBindWaveApi(timestamp, waveNo)
if (bindResult) { if (bindResult) {
await this.callReceiveSubmitApi(timestamp, bindResult, productId, stock, warehouseData) await this.callReceiveSubmitApi(timestamp, bindResult, productId, stock, warehouseData)
uni.setStorageSync('reuseWaveCount', waveCount + 1) return
} }
return console.log('【波次】复用失败,创建新波次')
} }
// //
console.log('【波次】创建新波次(当前已用=' + waveCount + '/' + WAVE_MAX_USE + '') console.log('【波次】创建新波次')
// //
const params = { const params = {
@ -2595,9 +2593,8 @@ export default {
var releaseWaveNo = await this.callWaveReleaseApi(timestamp, waveId, orderId, carInfo, productId, stock, price) var releaseWaveNo = await this.callWaveReleaseApi(timestamp, waveId, orderId, carInfo, productId, stock, price)
// 2. 使 release wave_no // 2. 使 release wave_no
if (releaseWaveNo) { if (releaseWaveNo) {
// wave_no // wave_no
uni.setStorageSync('reuseWaveNo', releaseWaveNo) uni.setStorageSync('reuseWaveNo', releaseWaveNo)
uni.setStorageSync('reuseWaveCount', 1)
var bindResult = await this.callBindWaveApi(timestamp, releaseWaveNo) var bindResult = await this.callBindWaveApi(timestamp, releaseWaveNo)
// 3. 使 bind-wave // 3. 使 bind-wave
if (bindResult) { if (bindResult) {