diff --git a/app/service/gzt.js b/app/service/gzt.js index 5aaad43..f60c14c 100644 --- a/app/service/gzt.js +++ b/app/service/gzt.js @@ -193,21 +193,22 @@ class Gzt extends Service { } } else { ctx.logger.info(`[scan] 非包材,查询订单 | barcode=${barcode} | WAREHOUSEID=${gzt.WAREHOUSEID}`); - // 尝试本地订单 → 外部WMS → 无记录 - let order = await this.getOrderInfo(barcode.replace(/-1-1-/g, ''), gzt.WAREHOUSEID); + // 优先查询外部WMS → 兜底老系统方法 → 无记录 + let order = null; let isWmsOrder = false; - if (!order) { - ctx.logger.info(`[scan] 本地订单未找到,查询外部WMS | barcode=${barcode}`); - const wmsResult = await this.ctx.service.newWms.queryOrder(barcode, gzt.WAREHOUSEID); - if (wmsResult && wmsResult.success) { - ctx.logger.info(`[scan] 外部WMS订单命中 | barcode=${barcode}`); - order = wmsResult.data; - isWmsOrder = true; - } else { - ctx.logger.info(`[scan] 外部WMS也未找到 | barcode=${barcode}`); - } + const wmsResult = await this.ctx.service.newWms.queryOrder(barcode, gzt.WAREHOUSEID); + if (wmsResult && wmsResult.success) { + ctx.logger.info(`[scan] 外部WMS订单命中 | barcode=${barcode}`); + order = wmsResult.data; + isWmsOrder = true; } else { - ctx.logger.info(`[scan] 本地订单命中 | barcode=${barcode} | PLSENDFLAG=${order.PLSENDFLAG}`); + ctx.logger.info(`[scan] 外部WMS未命中,查询老系统 | barcode=${barcode}`); + order = await this.getOrderInfo(barcode.replace(/-1-1-/g, ''), gzt.WAREHOUSEID); + if (order) { + ctx.logger.info(`[scan] 老系统订单命中 | barcode=${barcode} | PLSENDFLAG=${order.PLSENDFLAG}`); + } else { + ctx.logger.info(`[scan] 老系统也未找到 | barcode=${barcode}`); + } } if (order) {