@pisell/pisellos 2.3.68 → 2.3.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +109 -65
  3. package/dist/modules/Quotation/index.d.ts +6 -0
  4. package/dist/modules/Quotation/index.js +75 -19
  5. package/dist/plugins/request.d.ts +1 -0
  6. package/dist/server/index.d.ts +8 -2
  7. package/dist/server/index.js +206 -140
  8. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  9. package/dist/server/modules/floor-plan/index.js +240 -98
  10. package/dist/server/modules/menu/index.js +48 -23
  11. package/dist/server/modules/order/index.d.ts +17 -7
  12. package/dist/server/modules/order/index.js +419 -207
  13. package/dist/server/modules/products/index.d.ts +8 -2
  14. package/dist/server/modules/products/index.js +167 -75
  15. package/dist/server/modules/resource/index.js +21 -13
  16. package/dist/solution/BaseSales/index.d.ts +10 -0
  17. package/dist/solution/BaseSales/index.js +861 -806
  18. package/dist/solution/BookingTicket/index.d.ts +3 -1
  19. package/dist/solution/BookingTicket/index.js +187 -149
  20. package/lib/core/index.d.ts +7 -0
  21. package/lib/core/index.js +20 -2
  22. package/lib/modules/Quotation/index.d.ts +6 -0
  23. package/lib/modules/Quotation/index.js +49 -5
  24. package/lib/plugins/request.d.ts +1 -0
  25. package/lib/server/index.d.ts +8 -2
  26. package/lib/server/index.js +52 -17
  27. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  28. package/lib/server/modules/floor-plan/index.js +54 -6
  29. package/lib/server/modules/menu/index.js +31 -5
  30. package/lib/server/modules/order/index.d.ts +17 -7
  31. package/lib/server/modules/order/index.js +197 -40
  32. package/lib/server/modules/products/index.d.ts +8 -2
  33. package/lib/server/modules/products/index.js +97 -24
  34. package/lib/server/modules/resource/index.js +7 -2
  35. package/lib/solution/BaseSales/index.d.ts +10 -0
  36. package/lib/solution/BaseSales/index.js +32 -2
  37. package/lib/solution/BookingTicket/index.d.ts +3 -1
  38. package/lib/solution/BookingTicket/index.js +12 -0
  39. package/package.json +1 -1
@@ -103,6 +103,8 @@ var Server = /*#__PURE__*/function () {
103
103
  _defineProperty(this, "productQueryScheduleTimers", new Map());
104
104
  /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
105
105
  _defineProperty(this, "menuScheduleRefreshInFlight", null);
106
+ /** 启动阶段模块预加载任务;预渲染商品查询复用该任务,避免缓存尚未 ready 时误触发远端自愈。 */
107
+ _defineProperty(this, "startupModulePreloadInFlight", null);
106
108
  _defineProperty(this, "lastMenuScheduleRefreshAt", 0);
107
109
  _defineProperty(this, "MENU_SCHEDULE_REFRESH_COOLDOWN_MS", 30 * 1000);
108
110
  // ---- 订单 / 预约列表查询订阅者 ----
@@ -2266,6 +2268,7 @@ var Server = /*#__PURE__*/function () {
2266
2268
  options,
2267
2269
  startTime,
2268
2270
  registeredModules,
2271
+ preloadTask,
2269
2272
  duration,
2270
2273
  _args29 = arguments;
2271
2274
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
@@ -2290,22 +2293,31 @@ var Server = /*#__PURE__*/function () {
2290
2293
  case 8:
2291
2294
  registeredModules = _context29.sent;
2292
2295
  if (!autoPreload) {
2293
- _context29.next = 14;
2296
+ _context29.next = 20;
2294
2297
  break;
2295
2298
  }
2296
- _context29.next = 12;
2297
- return this.preloadModulesData(registeredModules, options);
2298
- case 12:
2299
+ preloadTask = this.preloadModulesData(registeredModules, options);
2300
+ this.startupModulePreloadInFlight = preloadTask;
2301
+ _context29.prev = 12;
2299
2302
  _context29.next = 15;
2303
+ return preloadTask;
2304
+ case 15:
2305
+ _context29.prev = 15;
2306
+ if (this.startupModulePreloadInFlight === preloadTask) {
2307
+ this.startupModulePreloadInFlight = null;
2308
+ }
2309
+ return _context29.finish(15);
2310
+ case 18:
2311
+ _context29.next = 21;
2300
2312
  break;
2301
- case 14:
2313
+ case 20:
2302
2314
  this.logInfo('跳过自动预加载', {
2303
2315
  autoPreload: autoPreload
2304
2316
  });
2305
- case 15:
2306
- _context29.next = 17;
2317
+ case 21:
2318
+ _context29.next = 23;
2307
2319
  return this.setupProductsQuotationPriceBridge();
2308
- case 17:
2320
+ case 23:
2309
2321
  // 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
2310
2322
  this.core.effects.on(ProductsHooks.onProductsSyncCompleted, function (payload) {
2311
2323
  _this3.recomputeAndNotifyProductQuery({
@@ -2331,11 +2343,11 @@ var Server = /*#__PURE__*/function () {
2331
2343
  registeredModuleCount: registeredModules.length
2332
2344
  });
2333
2345
  return _context29.abrupt("return", registeredModules);
2334
- case 23:
2346
+ case 29:
2335
2347
  case "end":
2336
2348
  return _context29.stop();
2337
2349
  }
2338
- }, _callee29, this);
2350
+ }, _callee29, this, [[12,, 15, 18]]);
2339
2351
  }));
2340
2352
  function initialize(_x32) {
2341
2353
  return _initialize.apply(this, arguments);
@@ -2717,6 +2729,7 @@ var Server = /*#__PURE__*/function () {
2717
2729
  key: "setupProductsQuotationPriceBridge",
2718
2730
  value: (function () {
2719
2731
  var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2732
+ var _this5 = this;
2720
2733
  var _this$core$context, errorMessage;
2721
2734
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2722
2735
  while (1) switch (_context33.prev = _context33.next) {
@@ -2736,31 +2749,42 @@ var Server = /*#__PURE__*/function () {
2736
2749
  return _context33.abrupt("return");
2737
2750
  case 6:
2738
2751
  _context33.prev = 6;
2739
- _context33.next = 9;
2740
- return this.schedule.loadAllSchedule();
2741
- case 9:
2742
2752
  this.products.clearPriceCache();
2743
- _context33.next = 12;
2753
+ _context33.next = 10;
2744
2754
  return this.products.setupQuotationPriceBridge({
2745
2755
  scheduleModule: this.schedule,
2746
- channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
2756
+ channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel,
2757
+ onQuotationUpdated: function onQuotationUpdated() {
2758
+ void _this5.recomputeAndNotifyProductQuery();
2759
+ }
2760
+ });
2761
+ case 10:
2762
+ // Schedule 已在模块 preload 阶段加载完成。价格桥接先使用本地数据,
2763
+ // 远端刷新转为后台校准,避免二次启动重复阻塞请求。
2764
+ void this.schedule.loadAllSchedule().then(function () {
2765
+ var _this5$products;
2766
+ (_this5$products = _this5.products) === null || _this5$products === void 0 || _this5$products.clearPriceCache();
2767
+ void _this5.recomputeAndNotifyProductQuery();
2768
+ }).catch(function (error) {
2769
+ _this5.logWarning('Products 报价单价格桥接后台刷新 Schedule 失败,继续使用本地数据', {
2770
+ error: error instanceof Error ? error.message : String(error)
2771
+ });
2747
2772
  });
2748
- case 12:
2749
2773
  this.logInfo('Products 报价单价格桥接初始化完成');
2750
- _context33.next = 19;
2774
+ _context33.next = 18;
2751
2775
  break;
2752
- case 15:
2753
- _context33.prev = 15;
2776
+ case 14:
2777
+ _context33.prev = 14;
2754
2778
  _context33.t0 = _context33["catch"](6);
2755
2779
  errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
2756
2780
  this.logError('Products 报价单价格桥接初始化失败', {
2757
2781
  error: errorMessage
2758
2782
  });
2759
- case 19:
2783
+ case 18:
2760
2784
  case "end":
2761
2785
  return _context33.stop();
2762
2786
  }
2763
- }, _callee33, this, [[6, 15]]);
2787
+ }, _callee33, this, [[6, 14]]);
2764
2788
  }));
2765
2789
  function setupProductsQuotationPriceBridge() {
2766
2790
  return _setupProductsQuotationPriceBridge.apply(this, arguments);
@@ -2830,44 +2854,58 @@ var Server = /*#__PURE__*/function () {
2830
2854
  key: "refreshProductsInBackground",
2831
2855
  value: (function () {
2832
2856
  var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2833
- var startTime, duration, _duration2, errorMessage;
2857
+ var options,
2858
+ trigger,
2859
+ startTime,
2860
+ duration,
2861
+ _duration2,
2862
+ errorMessage,
2863
+ _args34 = arguments;
2834
2864
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2835
2865
  while (1) switch (_context34.prev = _context34.next) {
2836
2866
  case 0:
2867
+ options = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
2837
2868
  if (this.products) {
2838
- _context34.next = 3;
2869
+ _context34.next = 4;
2839
2870
  break;
2840
2871
  }
2841
2872
  this.logWarning('refreshProductsInBackground: Products 模块未注册');
2842
2873
  return _context34.abrupt("return");
2843
- case 3:
2844
- this.logInfo('refreshProductsInBackground 开始');
2874
+ case 4:
2875
+ trigger = options.trigger || 'background';
2876
+ this.logInfo('refreshProductsInBackground 开始', {
2877
+ trigger: trigger
2878
+ });
2845
2879
  startTime = Date.now();
2846
- _context34.prev = 5;
2847
- _context34.next = 8;
2848
- return this.products.silentRefresh();
2849
- case 8:
2880
+ _context34.prev = 7;
2881
+ _context34.next = 10;
2882
+ return this.products.silentRefresh({
2883
+ trigger: trigger
2884
+ });
2885
+ case 10:
2850
2886
  duration = Date.now() - startTime;
2851
2887
  this.logInfo('refreshProductsInBackground 完成', {
2888
+ trigger: trigger,
2852
2889
  duration: "".concat(duration, "ms")
2853
2890
  });
2854
- _context34.next = 18;
2891
+ _context34.next = 20;
2855
2892
  break;
2856
- case 12:
2857
- _context34.prev = 12;
2858
- _context34.t0 = _context34["catch"](5);
2893
+ case 14:
2894
+ _context34.prev = 14;
2895
+ _context34.t0 = _context34["catch"](7);
2859
2896
  _duration2 = Date.now() - startTime;
2860
2897
  errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
2861
2898
  console.error('[Server] refreshProductsInBackground 失败:', _context34.t0);
2862
2899
  this.logError('refreshProductsInBackground 失败', {
2900
+ trigger: trigger,
2863
2901
  duration: "".concat(_duration2, "ms"),
2864
2902
  error: errorMessage
2865
2903
  });
2866
- case 18:
2904
+ case 20:
2867
2905
  case "end":
2868
2906
  return _context34.stop();
2869
2907
  }
2870
- }, _callee34, this, [[5, 12]]);
2908
+ }, _callee34, this, [[7, 14]]);
2871
2909
  }));
2872
2910
  function refreshProductsInBackground() {
2873
2911
  return _refreshProductsInBackground.apply(this, arguments);
@@ -2884,44 +2922,58 @@ var Server = /*#__PURE__*/function () {
2884
2922
  key: "refreshOrdersInBackground",
2885
2923
  value: (function () {
2886
2924
  var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2887
- var startTime, duration, _duration3, errorMessage;
2925
+ var options,
2926
+ trigger,
2927
+ startTime,
2928
+ duration,
2929
+ _duration3,
2930
+ errorMessage,
2931
+ _args35 = arguments;
2888
2932
  return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2889
2933
  while (1) switch (_context35.prev = _context35.next) {
2890
2934
  case 0:
2935
+ options = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
2891
2936
  if (this.order) {
2892
- _context35.next = 3;
2937
+ _context35.next = 4;
2893
2938
  break;
2894
2939
  }
2895
2940
  this.logWarning('refreshOrdersInBackground: Order 模块未注册');
2896
2941
  return _context35.abrupt("return");
2897
- case 3:
2898
- this.logInfo('refreshOrdersInBackground 开始');
2942
+ case 4:
2943
+ trigger = options.trigger || 'background';
2944
+ this.logInfo('refreshOrdersInBackground 开始', {
2945
+ trigger: trigger
2946
+ });
2899
2947
  startTime = Date.now();
2900
- _context35.prev = 5;
2901
- _context35.next = 8;
2902
- return this.order.silentRefresh();
2903
- case 8:
2948
+ _context35.prev = 7;
2949
+ _context35.next = 10;
2950
+ return this.order.silentRefresh({
2951
+ trigger: trigger
2952
+ });
2953
+ case 10:
2904
2954
  duration = Date.now() - startTime;
2905
2955
  this.logInfo('refreshOrdersInBackground 完成', {
2956
+ trigger: trigger,
2906
2957
  duration: "".concat(duration, "ms")
2907
2958
  });
2908
- _context35.next = 18;
2959
+ _context35.next = 20;
2909
2960
  break;
2910
- case 12:
2911
- _context35.prev = 12;
2912
- _context35.t0 = _context35["catch"](5);
2961
+ case 14:
2962
+ _context35.prev = 14;
2963
+ _context35.t0 = _context35["catch"](7);
2913
2964
  _duration3 = Date.now() - startTime;
2914
2965
  errorMessage = _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0);
2915
2966
  console.error('[Server] refreshOrdersInBackground 失败:', _context35.t0);
2916
2967
  this.logError('refreshOrdersInBackground 失败', {
2968
+ trigger: trigger,
2917
2969
  duration: "".concat(_duration3, "ms"),
2918
2970
  error: errorMessage
2919
2971
  });
2920
- case 18:
2972
+ case 20:
2921
2973
  case "end":
2922
2974
  return _context35.stop();
2923
2975
  }
2924
- }, _callee35, this, [[5, 12]]);
2976
+ }, _callee35, this, [[7, 14]]);
2925
2977
  }));
2926
2978
  function refreshOrdersInBackground() {
2927
2979
  return _refreshOrdersInBackground.apply(this, arguments);
@@ -3235,10 +3287,10 @@ var Server = /*#__PURE__*/function () {
3235
3287
  }, {
3236
3288
  key: "getAllRoutes",
3237
3289
  value: function getAllRoutes() {
3238
- var _this5 = this;
3290
+ var _this6 = this;
3239
3291
  var routes = [];
3240
3292
  ['get', 'post', 'put', 'remove'].forEach(function (method) {
3241
- Object.keys(_this5.router[method]).forEach(function (path) {
3293
+ Object.keys(_this6.router[method]).forEach(function (path) {
3242
3294
  routes.push({
3243
3295
  method: method,
3244
3296
  path: path
@@ -3368,7 +3420,7 @@ var Server = /*#__PURE__*/function () {
3368
3420
  key: "getPaymentRouteModule",
3369
3421
  value: function () {
3370
3422
  var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3371
- var _this6 = this;
3423
+ var _this7 = this;
3372
3424
  return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3373
3425
  while (1) switch (_context40.prev = _context40.next) {
3374
3426
  case 0:
@@ -3397,13 +3449,13 @@ var Server = /*#__PURE__*/function () {
3397
3449
  case 0:
3398
3450
  module = new PaymentServerModule('server_payment_route', '1.0.0');
3399
3451
  _context39.next = 3;
3400
- return module.initialize(_this6.core, {
3452
+ return module.initialize(_this7.core, {
3401
3453
  store: {
3402
3454
  payMethods: []
3403
3455
  }
3404
3456
  });
3405
3457
  case 3:
3406
- _this6.paymentRouteModule = module;
3458
+ _this7.paymentRouteModule = module;
3407
3459
  return _context39.abrupt("return", module);
3408
3460
  case 5:
3409
3461
  case "end":
@@ -3411,7 +3463,7 @@ var Server = /*#__PURE__*/function () {
3411
3463
  }
3412
3464
  }, _callee39);
3413
3465
  }))().finally(function () {
3414
- _this6.paymentRouteModuleInFlight = undefined;
3466
+ _this7.paymentRouteModuleInFlight = undefined;
3415
3467
  });
3416
3468
  return _context40.abrupt("return", this.paymentRouteModuleInFlight);
3417
3469
  case 8:
@@ -3587,7 +3639,7 @@ var Server = /*#__PURE__*/function () {
3587
3639
  }, {
3588
3640
  key: "scheduleSubscriberTimePointReloads",
3589
3641
  value: function scheduleSubscriberTimePointReloads(subscriberId, timePoints) {
3590
- var _this7 = this;
3642
+ var _this8 = this;
3591
3643
  var subscriber = this.productQuerySubscribers.get(subscriberId);
3592
3644
  if (!subscriber || !timePoints.length) return;
3593
3645
  var scheduleDate = subscriber.context.schedule_date || dayjs().format('YYYY-MM-DD');
@@ -3608,7 +3660,7 @@ var Server = /*#__PURE__*/function () {
3608
3660
  setInterval(function () {
3609
3661
  var currentTime = dayjs().format('hh:mm');
3610
3662
  if (timePoints.includes(currentTime)) {
3611
- _this7.onScheduleTimePointTimerFire(subscriberId);
3663
+ _this8.onScheduleTimePointTimerFire(subscriberId);
3612
3664
  }
3613
3665
  }, 60000);
3614
3666
  if (timerIds.length > 0) {
@@ -3777,7 +3829,7 @@ var Server = /*#__PURE__*/function () {
3777
3829
  key: "refreshMenuScheduleCacheAfterEmptyResult",
3778
3830
  value: (function () {
3779
3831
  var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
3780
- var _this8 = this;
3832
+ var _this9 = this;
3781
3833
  var now;
3782
3834
  return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3783
3835
  while (1) switch (_context44.prev = _context44.next) {
@@ -3800,11 +3852,11 @@ var Server = /*#__PURE__*/function () {
3800
3852
  this.menuScheduleRefreshInFlight = Promise.all([this.menu.loadMenuList(), this.schedule.loadAllSchedule()]).then(function () {
3801
3853
  return undefined;
3802
3854
  }).catch(function (error) {
3803
- _this8.logWarning('刷新菜单/日程缓存失败,继续使用现有缓存', {
3855
+ _this9.logWarning('刷新菜单/日程缓存失败,继续使用现有缓存', {
3804
3856
  error: error instanceof Error ? error.message : String(error)
3805
3857
  });
3806
3858
  }).finally(function () {
3807
- _this8.menuScheduleRefreshInFlight = null;
3859
+ _this9.menuScheduleRefreshInFlight = null;
3808
3860
  });
3809
3861
  }
3810
3862
  _context44.next = 8;
@@ -3990,10 +4042,10 @@ var Server = /*#__PURE__*/function () {
3990
4042
  }, {
3991
4043
  key: "stripSalesSearchPageParams",
3992
4044
  value: function stripSalesSearchPageParams(value) {
3993
- var _this9 = this;
4045
+ var _this10 = this;
3994
4046
  if (Array.isArray(value)) {
3995
4047
  return value.map(function (item) {
3996
- return _this9.stripSalesSearchPageParams(item);
4048
+ return _this10.stripSalesSearchPageParams(item);
3997
4049
  });
3998
4050
  }
3999
4051
  if (!value || _typeof(value) !== 'object') return value;
@@ -4031,12 +4083,12 @@ var Server = /*#__PURE__*/function () {
4031
4083
  key: "extractSalesSearchOrderIds",
4032
4084
  value: function extractSalesSearchOrderIds(kind, result) {
4033
4085
  var _this$findSalesSearch,
4034
- _this10 = this;
4086
+ _this11 = this;
4035
4087
  var data = this.extractSalesSearchResponseData(result);
4036
4088
  var list = kind === 'aggregate' ? (_this$findSalesSearch = this.findSalesSearchAggregateGroup(data)) === null || _this$findSalesSearch === void 0 ? void 0 : _this$findSalesSearch.list : data === null || data === void 0 ? void 0 : data.list;
4037
4089
  if (!Array.isArray(list)) return [];
4038
4090
  return list.map(function (item) {
4039
- return _this10.getSalesSearchOrderId(item);
4091
+ return _this11.getSalesSearchOrderId(item);
4040
4092
  }).filter(function (id) {
4041
4093
  return !!id;
4042
4094
  });
@@ -4203,11 +4255,11 @@ var Server = /*#__PURE__*/function () {
4203
4255
  }, {
4204
4256
  key: "stableSerialize",
4205
4257
  value: function stableSerialize(value) {
4206
- var _this11 = this;
4258
+ var _this12 = this;
4207
4259
  if (value === null || value === undefined) return 'null';
4208
4260
  if (Array.isArray(value)) {
4209
4261
  return "[".concat(value.map(function (item) {
4210
- return _this11.stableSerialize(item);
4262
+ return _this12.stableSerialize(item);
4211
4263
  }).join(','), "]");
4212
4264
  }
4213
4265
  if (_typeof(value) === 'object') {
@@ -4216,7 +4268,7 @@ var Server = /*#__PURE__*/function () {
4216
4268
  return obj[k] !== undefined;
4217
4269
  }).sort();
4218
4270
  return "{".concat(keys.map(function (k) {
4219
- return "".concat(JSON.stringify(k), ":").concat(_this11.stableSerialize(obj[k]));
4271
+ return "".concat(JSON.stringify(k), ":").concat(_this12.stableSerialize(obj[k]));
4220
4272
  }).join(','), "}");
4221
4273
  }
4222
4274
  return JSON.stringify(value);
@@ -4756,7 +4808,7 @@ var Server = /*#__PURE__*/function () {
4756
4808
  key: "runLocalPaymentUpdateInQueue",
4757
4809
  value: function () {
4758
4810
  var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(key, task, context) {
4759
- var _this12 = this;
4811
+ var _this13 = this;
4760
4812
  var queuedAt, hasPreviousTask, previous, current, tail, _data, result, released;
4761
4813
  return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4762
4814
  while (1) switch (_context50.prev = _context50.next) {
@@ -4775,7 +4827,7 @@ var Server = /*#__PURE__*/function () {
4775
4827
  return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4776
4828
  while (1) switch (_context49.prev = _context49.next) {
4777
4829
  case 0:
4778
- _this12.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
4830
+ _this13.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
4779
4831
  queue_key: key,
4780
4832
  queue_wait_ms: Date.now() - queuedAt
4781
4833
  }));
@@ -6167,7 +6219,7 @@ var Server = /*#__PURE__*/function () {
6167
6219
  key: "handlePendingSyncCheckoutOrder",
6168
6220
  value: function () {
6169
6221
  var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6170
- var _this13 = this;
6222
+ var _this14 = this;
6171
6223
  var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
6172
6224
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6173
6225
  while (1) switch (_context63.prev = _context63.next) {
@@ -6220,7 +6272,7 @@ var Server = /*#__PURE__*/function () {
6220
6272
  });
6221
6273
  changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
6222
6274
  var _payment$metadata;
6223
- return sum + _this13.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
6275
+ return sum + _this14.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
6224
6276
  }, 0);
6225
6277
  return _context63.abrupt("return", {
6226
6278
  code: 200,
@@ -6360,13 +6412,13 @@ var Server = /*#__PURE__*/function () {
6360
6412
  }, {
6361
6413
  key: "sumPaidOrderPayments",
6362
6414
  value: function sumPaidOrderPayments(payments) {
6363
- var _this14 = this;
6415
+ var _this15 = this;
6364
6416
  if (!Array.isArray(payments)) return 0;
6365
6417
  return payments.reduce(function (sum, payment) {
6366
6418
  var _payment$amount;
6367
6419
  var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
6368
6420
  if (status !== 'paid') return sum;
6369
- return sum + _this14.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
6421
+ return sum + _this15.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
6370
6422
  }, 0);
6371
6423
  }
6372
6424
  }, {
@@ -6382,7 +6434,7 @@ var Server = /*#__PURE__*/function () {
6382
6434
  value: function () {
6383
6435
  var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
6384
6436
  var _this$products3,
6385
- _this15 = this;
6437
+ _this16 = this;
6386
6438
  var products, productIdSet, productIds, entries;
6387
6439
  return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6388
6440
  while (1) switch (_context66.prev = _context66.next) {
@@ -6415,20 +6467,20 @@ var Server = /*#__PURE__*/function () {
6415
6467
  _context66.next = 8;
6416
6468
  return Promise.all(productIds.map( /*#__PURE__*/function () {
6417
6469
  var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
6418
- var _this15$products, _this15$products$getP, product;
6470
+ var _this16$products, _this16$products$getP, product;
6419
6471
  return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6420
6472
  while (1) switch (_context65.prev = _context65.next) {
6421
6473
  case 0:
6422
6474
  _context65.prev = 0;
6423
6475
  _context65.next = 3;
6424
- return (_this15$products = _this15.products) === null || _this15$products === void 0 || (_this15$products$getP = _this15$products.getProductById) === null || _this15$products$getP === void 0 ? void 0 : _this15$products$getP.call(_this15$products, Number(id));
6476
+ return (_this16$products = _this16.products) === null || _this16$products === void 0 || (_this16$products$getP = _this16$products.getProductById) === null || _this16$products$getP === void 0 ? void 0 : _this16$products$getP.call(_this16$products, Number(id));
6425
6477
  case 3:
6426
6478
  product = _context65.sent;
6427
6479
  return _context65.abrupt("return", product ? [String(id), product] : null);
6428
6480
  case 7:
6429
6481
  _context65.prev = 7;
6430
6482
  _context65.t0 = _context65["catch"](0);
6431
- _this15.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
6483
+ _this16.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
6432
6484
  product_id: id,
6433
6485
  error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
6434
6486
  });
@@ -6579,7 +6631,7 @@ var Server = /*#__PURE__*/function () {
6579
6631
  key: "withSalesDetailProductSnapshots",
6580
6632
  value: function () {
6581
6633
  var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
6582
- var _this16 = this;
6634
+ var _this17 = this;
6583
6635
  var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
6584
6636
  return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6585
6637
  while (1) switch (_context68.prev = _context68.next) {
@@ -6603,8 +6655,8 @@ var Server = /*#__PURE__*/function () {
6603
6655
  case 8:
6604
6656
  hasChanged = false;
6605
6657
  enrichedProducts = products.map(function (product) {
6606
- var productWithBundleSnapshots = _this16.withBundleCatalogSnapshots(product, snapshotMap);
6607
- var nextProduct = _this16.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
6658
+ var productWithBundleSnapshots = _this17.withBundleCatalogSnapshots(product, snapshotMap);
6659
+ var nextProduct = _this17.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
6608
6660
  if (nextProduct !== product) hasChanged = true;
6609
6661
  return nextProduct;
6610
6662
  });
@@ -6632,13 +6684,13 @@ var Server = /*#__PURE__*/function () {
6632
6684
  }, {
6633
6685
  key: "withPendingSyncProductTitles",
6634
6686
  value: function withPendingSyncProductTitles(order, productMap) {
6635
- var _this17 = this;
6687
+ var _this18 = this;
6636
6688
  var products = Array.isArray(order.products) ? order.products : null;
6637
6689
  if (!(products !== null && products !== void 0 && products.length)) return order;
6638
6690
  return _objectSpread(_objectSpread({}, order), {}, {
6639
6691
  products: products.map(function (product) {
6640
6692
  return _objectSpread(_objectSpread({}, product), {}, {
6641
- product_title: _this17.buildProductTitleSnapshot(product, productMap)
6693
+ product_title: _this18.buildProductTitleSnapshot(product, productMap)
6642
6694
  });
6643
6695
  })
6644
6696
  });
@@ -6649,7 +6701,7 @@ var Server = /*#__PURE__*/function () {
6649
6701
  var _product$product_id4,
6650
6702
  _product$product,
6651
6703
  _fallbackProduct$prod,
6652
- _this18 = this;
6704
+ _this19 = this;
6653
6705
  var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
6654
6706
  var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
6655
6707
  var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
@@ -6657,7 +6709,7 @@ var Server = /*#__PURE__*/function () {
6657
6709
  var currentLocale = this.getProductTitleSnapshotCurrentLocale();
6658
6710
  var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
6659
6711
  return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
6660
- snapshot[key] = _this18.resolveProductTitleValue(ownTitle, key, currentLocale) || _this18.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
6712
+ snapshot[key] = _this19.resolveProductTitleValue(ownTitle, key, currentLocale) || _this19.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
6661
6713
  return snapshot;
6662
6714
  }, {});
6663
6715
  }
@@ -6756,14 +6808,14 @@ var Server = /*#__PURE__*/function () {
6756
6808
  key: "enrichPaymentNamesByCode",
6757
6809
  value: function () {
6758
6810
  var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
6759
- var _this19 = this;
6811
+ var _this20 = this;
6760
6812
  var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
6761
6813
  return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6762
6814
  while (1) switch (_context69.prev = _context69.next) {
6763
6815
  case 0:
6764
6816
  payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
6765
6817
  hasMissingName = payments.some(function (payment) {
6766
- return _this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
6818
+ return _this20.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this20.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
6767
6819
  });
6768
6820
  if (hasMissingName) {
6769
6821
  _context69.next = 4;
@@ -6796,9 +6848,9 @@ var Server = /*#__PURE__*/function () {
6796
6848
  }
6797
6849
  hasResolvedName = false;
6798
6850
  enrichedPayments = payments.map(function (payment) {
6799
- if (!_this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
6800
- if (!_this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
6801
- var name = nameByCode.get(_this19.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
6851
+ if (!_this20.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
6852
+ if (!_this20.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
6853
+ var name = nameByCode.get(_this20.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
6802
6854
  if (!name) return payment;
6803
6855
  hasResolvedName = true;
6804
6856
  return _objectSpread(_objectSpread({}, payment), {}, {
@@ -7380,10 +7432,10 @@ var Server = /*#__PURE__*/function () {
7380
7432
  value: function extractBackendErrorResponse(error) {
7381
7433
  var _error$response3,
7382
7434
  _error$response4,
7383
- _this20 = this;
7435
+ _this21 = this;
7384
7436
  var candidates = [error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.body, error === null || error === void 0 ? void 0 : error.body];
7385
7437
  return candidates.find(function (candidate) {
7386
- return _this20.isExplicitBackendErrorResponse(candidate);
7438
+ return _this21.isExplicitBackendErrorResponse(candidate);
7387
7439
  }) || null;
7388
7440
  }
7389
7441
  }, {
@@ -7744,8 +7796,8 @@ var Server = /*#__PURE__*/function () {
7744
7796
  value: (function () {
7745
7797
  var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
7746
7798
  var _menu_list_ids$length3,
7747
- _this21 = this;
7748
- var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
7799
+ _this22 = this;
7800
+ var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, startupPreloadTask, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
7749
7801
  return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7750
7802
  while (1) switch (_context75.prev = _context75.next) {
7751
7803
  case 0:
@@ -7756,12 +7808,6 @@ var Server = /*#__PURE__*/function () {
7756
7808
  }).filter(function (id) {
7757
7809
  return Number.isFinite(id);
7758
7810
  }) : [];
7759
- formatterContext = this.buildProductFormatterContext({
7760
- schedule_date: schedule_date,
7761
- schedule_datetime: schedule_datetime,
7762
- customer_id: customer_id,
7763
- strategy_context: strategy_context
7764
- });
7765
7811
  this.logInfo('computeProductQueryResult 开始', {
7766
7812
  menuListIdsCount: (_menu_list_ids$length3 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length3 !== void 0 ? _menu_list_ids$length3 : 0,
7767
7813
  ids: queryIds,
@@ -7773,28 +7819,48 @@ var Server = /*#__PURE__*/function () {
7773
7819
  strategyContextKeys: strategy_context ? Object.keys(strategy_context) : [],
7774
7820
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7775
7821
  });
7776
- if (this.products) {
7822
+
7823
+ // 预渲染可能在 PisellOS 顺序 preload 尚未完成时发起商品查询。此时 Menu/Schedule
7824
+ // 暂时为空不代表缓存失效;等待当前 preload 后再按原逻辑查询,避免并发远端刷新先 clear
7825
+ // SQLite/IndexDB,造成 preload 读到空数据并重复请求。正常运行期该字段为 null,不增加等待。
7826
+ startupPreloadTask = this.startupModulePreloadInFlight;
7827
+ if (!startupPreloadTask) {
7777
7828
  _context75.next = 8;
7778
7829
  break;
7779
7830
  }
7831
+ _context75.next = 8;
7832
+ return startupPreloadTask;
7833
+ case 8:
7834
+ // Menu/Schedule preload 会替换 store 中的数组;必须在等待完成后再读取,
7835
+ // 避免 formatterContext 持有预加载前的空数组快照。
7836
+ formatterContext = this.buildProductFormatterContext({
7837
+ schedule_date: schedule_date,
7838
+ schedule_datetime: schedule_datetime,
7839
+ customer_id: customer_id,
7840
+ strategy_context: strategy_context
7841
+ });
7842
+ if (this.products) {
7843
+ _context75.next = 12;
7844
+ break;
7845
+ }
7780
7846
  this.logError('computeProductQueryResult: Products 模块未注册');
7781
7847
  return _context75.abrupt("return", {
7782
7848
  message: 'Products 模块未注册',
7783
7849
  data: this.buildProductQueryResultPayload([], 0)
7784
7850
  });
7785
- case 8:
7851
+ case 12:
7786
7852
  if (!(queryIds.length > 0)) {
7787
- _context75.next = 20;
7853
+ _context75.next = 24;
7788
7854
  break;
7789
7855
  }
7790
7856
  uniqueIds = Array.from(new Set(queryIds));
7791
7857
  _tPrice = performance.now();
7792
- _context75.next = 13;
7858
+ _context75.next = 17;
7793
7859
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7794
7860
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
7795
7861
  productIds: uniqueIds
7796
7862
  });
7797
- case 13:
7863
+ case 17:
7798
7864
  productsWithPrice = _context75.sent;
7799
7865
  perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
7800
7866
  count: productsWithPrice.length,
@@ -7821,18 +7887,18 @@ var Server = /*#__PURE__*/function () {
7821
7887
  message: '',
7822
7888
  status: true
7823
7889
  });
7824
- case 20:
7890
+ case 24:
7825
7891
  if (!(product_id != null && Number.isFinite(Number(product_id)))) {
7826
- _context75.next = 32;
7892
+ _context75.next = 36;
7827
7893
  break;
7828
7894
  }
7829
7895
  pid = Number(product_id);
7830
7896
  _tPrice2 = performance.now();
7831
- _context75.next = 25;
7897
+ _context75.next = 29;
7832
7898
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7833
7899
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7834
7900
  });
7835
- case 25:
7901
+ case 29:
7836
7902
  allProductsWithPrice = _context75.sent;
7837
7903
  perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
7838
7904
  count: allProductsWithPrice.length,
@@ -7859,17 +7925,17 @@ var Server = /*#__PURE__*/function () {
7859
7925
  message: item ? '' : '商品不存在或未发布',
7860
7926
  status: true
7861
7927
  });
7862
- case 32:
7928
+ case 36:
7863
7929
  if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
7864
- _context75.next = 52;
7930
+ _context75.next = 56;
7865
7931
  break;
7866
7932
  }
7867
7933
  _tPrice3 = performance.now();
7868
- _context75.next = 36;
7934
+ _context75.next = 40;
7869
7935
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7870
7936
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7871
7937
  });
7872
- case 36:
7938
+ case 40:
7873
7939
  _filteredProducts2 = _context75.sent;
7874
7940
  perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
7875
7941
  count: _filteredProducts2.length,
@@ -7915,9 +7981,9 @@ var Server = /*#__PURE__*/function () {
7915
7981
  message: '',
7916
7982
  status: true
7917
7983
  });
7918
- case 52:
7984
+ case 56:
7919
7985
  if (this.menu) {
7920
- _context75.next = 55;
7986
+ _context75.next = 59;
7921
7987
  break;
7922
7988
  }
7923
7989
  this.logError('computeProductQueryResult: Menu 模块未注册');
@@ -7925,9 +7991,9 @@ var Server = /*#__PURE__*/function () {
7925
7991
  message: 'Menu 模块未注册',
7926
7992
  data: this.buildProductQueryResultPayload([], 0)
7927
7993
  });
7928
- case 55:
7994
+ case 59:
7929
7995
  if (this.schedule) {
7930
- _context75.next = 58;
7996
+ _context75.next = 62;
7931
7997
  break;
7932
7998
  }
7933
7999
  this.logError('computeProductQueryResult: Schedule 模块未注册');
@@ -7935,41 +8001,41 @@ var Server = /*#__PURE__*/function () {
7935
8001
  message: 'Schedule 模块未注册',
7936
8002
  data: this.buildProductQueryResultPayload([], 0)
7937
8003
  });
7938
- case 58:
8004
+ case 62:
7939
8005
  activeMenuList = [];
7940
8006
  if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
7941
- _context75.next = 71;
8007
+ _context75.next = 75;
7942
8008
  break;
7943
8009
  }
7944
8010
  tMenu = performance.now();
7945
8011
  getActiveMenus = function getActiveMenus() {
7946
- return _this21.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
7947
- var _this21$schedule;
7948
- return ((_this21$schedule = _this21.schedule) === null || _this21$schedule === void 0 ? void 0 : _this21$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
8012
+ return _this22.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
8013
+ var _this22$schedule;
8014
+ return ((_this22$schedule = _this22.schedule) === null || _this22$schedule === void 0 ? void 0 : _this22$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
7949
8015
  });
7950
8016
  };
7951
8017
  activeMenuList = getActiveMenus();
7952
8018
  _context75.t0 = !activeMenuList.length;
7953
8019
  if (!_context75.t0) {
7954
- _context75.next = 68;
8020
+ _context75.next = 72;
7955
8021
  break;
7956
8022
  }
7957
- _context75.next = 67;
8023
+ _context75.next = 71;
7958
8024
  return this.refreshMenuScheduleCacheAfterEmptyResult();
7959
- case 67:
8025
+ case 71:
7960
8026
  _context75.t0 = _context75.sent;
7961
- case 68:
8027
+ case 72:
7962
8028
  if (!_context75.t0) {
7963
- _context75.next = 70;
8029
+ _context75.next = 74;
7964
8030
  break;
7965
8031
  }
7966
8032
  activeMenuList = getActiveMenus();
7967
- case 70:
8033
+ case 74:
7968
8034
  perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
7969
8035
  totalMenu: menu_list_ids.length,
7970
8036
  activeMenu: activeMenuList.length
7971
8037
  });
7972
- case 71:
8038
+ case 75:
7973
8039
  tFilter = performance.now();
7974
8040
  productScope = this.getProductScopeByMenuConfig(activeMenuList);
7975
8041
  scopedProductIds = this.products.getProductIdsByScope(productScope);
@@ -7980,21 +8046,21 @@ var Server = /*#__PURE__*/function () {
7980
8046
  });
7981
8047
  tPrice = performance.now();
7982
8048
  if (!(scopedProductIds.length > 0)) {
7983
- _context75.next = 82;
8049
+ _context75.next = 86;
7984
8050
  break;
7985
8051
  }
7986
- _context75.next = 79;
8052
+ _context75.next = 83;
7987
8053
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7988
8054
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
7989
8055
  productIds: productScope.isAllProducts ? undefined : scopedProductIds
7990
8056
  });
7991
- case 79:
8057
+ case 83:
7992
8058
  _context75.t1 = _context75.sent;
7993
- _context75.next = 83;
8059
+ _context75.next = 87;
7994
8060
  break;
7995
- case 82:
8061
+ case 86:
7996
8062
  _context75.t1 = [];
7997
- case 83:
8063
+ case 87:
7998
8064
  filteredProducts = _context75.t1;
7999
8065
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
8000
8066
  count: filteredProducts.length,
@@ -8042,7 +8108,7 @@ var Server = /*#__PURE__*/function () {
8042
8108
  message: '',
8043
8109
  status: true
8044
8110
  });
8045
- case 99:
8111
+ case 103:
8046
8112
  case "end":
8047
8113
  return _context75.stop();
8048
8114
  }
@@ -8254,7 +8320,7 @@ var Server = /*#__PURE__*/function () {
8254
8320
  }, {
8255
8321
  key: "notifySalesSearchSubscribers",
8256
8322
  value: function notifySalesSearchSubscribers(payload) {
8257
- var _this22 = this;
8323
+ var _this23 = this;
8258
8324
  if (this.salesSearchSubscribers.size === 0) return;
8259
8325
  var changedOrders = this.extractChangedOrdersFromPayload(payload);
8260
8326
  if (changedOrders.length === 0) {
@@ -8272,21 +8338,21 @@ var Server = /*#__PURE__*/function () {
8272
8338
  subscriber = _step20$value[1];
8273
8339
  try {
8274
8340
  var changedVisibleOrders = changedOrders.filter(function (order) {
8275
- var orderId = _this22.getSalesSearchOrderId(order);
8341
+ var orderId = _this23.getSalesSearchOrderId(order);
8276
8342
  return !!orderId && subscriber.visibleOrderIds.has(orderId);
8277
8343
  });
8278
8344
  if (changedVisibleOrders.length === 0) {
8279
8345
  return 1; // continue
8280
8346
  }
8281
- subscriber.callback(_this22.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
8282
- _this22.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
8347
+ subscriber.callback(_this23.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
8348
+ _this23.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
8283
8349
  subscriberId: subscriberId,
8284
8350
  kind: subscriber.kind,
8285
8351
  count: changedVisibleOrders.length
8286
8352
  });
8287
8353
  } catch (error) {
8288
8354
  var errorMessage = error instanceof Error ? error.message : String(error);
8289
- _this22.logError('notifySalesSearchSubscribers: 推送失败', {
8355
+ _this23.logError('notifySalesSearchSubscribers: 推送失败', {
8290
8356
  subscriberId: subscriberId,
8291
8357
  error: errorMessage
8292
8358
  });