liufumingren
|
0a6e82e00a
|
feat(order): B2B 订单作业链路(列表/转换/取消/波次排除/作业明细表重构)
- 新增 order.pendingOrder2b.list / order.deliveryOrder2b.list:复用待处理与配送列表条件,
强制 is_b2b='Y'(fixedWhere 以 AND 追加,请求 where 无法覆盖),并带出 wms_order_b2b
作业明细字段(total_box_count/pickup_plate_number/prep_remark/prep_duration_seconds/
prep_at/is_picked_up/picked_up_at/created_at),无明细行时输出空值占位
- B2B 列表 where 支持按作业明细字段筛选:先按 warehouse_id + order_id 查副表取 order_id,
再以 id IN (...) 回填;该筛选仅这两个接口开放,不影响普通订单列表
- 其余订单列表(order/reviewOrder/pendingOrder/outboundOrder/expectionOrder/entrustOrder/
deliveryOrder/deliveryExpectionOrder/archiveOrder 及 waveStrategyFallbackOrderList)
统一追加 (is_b2b IS NULL OR is_b2b = 'N'),B2B 订单不再混入普通列表
- order.convertToB2b 收紧准入:status!=cancel、step in [1,2,3]、未拣货、未复核、未锁定、
未拦截、未 B2B(打印状态不限制);已在波次中的订单转换后在同一事务内从波次摘除
(含库内抓取订单),波次存在进行中拣货任务则跳过
- order.cancelB2b 放开打印限制,作业明细由软删除改为物理删除
- 波次抓取全链路排除 B2B:补上自动加团 appendOrderToWave / countCandidateGroupOrders
两处遗漏;抽出 detachOrdersFromWavesInTransaction 供 batchRemoveOrders 与转 B2B 复用
- wms_order_delivery 分表新增 is_b2b 列表索引(current/dispatch,等值列前置 + 排序列),
由订单工厂结构漂移同步自动补建
- 迁移 20261115180000-refactor-wms-order-b2b:新增 prep_at;移除 is_print/updated_at/
deleted_at/delivery_order_code/store_id;唯一键改 uk_warehouse_order(warehouse_id, order_id);
迁移前清理历史软删除行与重复行(开发库与生产库均已执行)
- operation_log 兜底用 changeSummary 写入 message,修复转/取消 B2B 日志操作说明为空
- 同步 methods/system.json 与变更记录 0.3.351~0.3.360
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
2026-11-17 01:30:08 +08:00 |
|
liufumingren
|
9af7dcf8fb
|
feat(storeWarehouse): 签约关系接口配置按货主开放接口落库且回调地址统一取配置
- storeWarehouse.store.saveApiConfig:新增 resolveContractApiInterfaceType,
interface_type_id=3(OPEN_API_WAREHOUSE 仓库开放接口)自动映射为 2(OPEN_API 货主开放接口)落库,
不再要求当前主体为仓库(货主可维护自身签约关系下的接口配置)
- callback_url 不再取入参(含 callbackUrl 别名),统一写入 config.openapi.defaultCallbackUrl(新增配置项,默认空)
- storeWarehouse.store.listApiConfig:interface_type_id 过滤同步映射(传 3 按 2 查询)
- 文档:methods/system.json 升级 0.3.350、methods/changes/system.json 变更记录、docs/openapi-callback-events.md 回调地址来源说明
- 测试:saveApiConfig 新增 4 条用例(3→2 落库、忽略入参回调地址、默认值未配置、货主主体可保存、缺失类型 404),listApiConfig 新增 1 条过滤映射用例
同时提交工作区其余在制品改动:
- waybill:移除 wms_order_express_trace 模型并新增 drop 迁移,轨迹查询/取号/打印链路调整
- order:订单 SN 编码(order_item_sn / order_item_sn_log / sn_code_rule、has_sn_item 回填迁移),pendingOrder/recheckOrder/wave/base 调整
- express_platform、order_async、order_export、order_storage_allocation、storage.report、stock_store 配套修复
- lib:新增 jd_client,调整 qimen_client、callback_functions 及配套测试
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
2026-11-14 17:14:04 +08:00 |
|
liufumingren
|
25dac21b4b
|
feat(waybill): OMS 取号与抖音打印 params 按店铺隔离
- express/express_platform: 新增 OMS 回源取号(need_oms_waybill=1)与统一失败收尾,
失败时标记订单异常、写失败日志并清理未完成占位行;队列消费与手工分配共用同一口径
- order_print: 抖音打印按运单落库的 logistics_interface_id 精确命中取号接口配置,
临时 key 缓存键带店铺与 token 指纹,避免多店铺串用 token;打印前按 OMS 记录换新 params
- order_express: 新增 print_history_id、cai_niao_auth_info_id 字段
- consume_waybill_allocate_queue / pendingOrder / delivery_order / order_async /
printer_data_builder / order_delivery_table_schema: 配套调整
- migrations: 运单 wave_no 索引、OMS 打印字段
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
2026-11-10 02:53:15 +08:00 |
|
liufumingren
|
765bb2c0f7
|
feat(order): from_key 改为承载上游应用 appKey 字符串
背景:from_key 是「回原通道」的应用标识,出库单回传与取号业务分支都依赖它。
历史只存过奇门/ERP 的纯数字 appKey(聚水潭 23060081、吉客云 24869601),
OpenAPI 创建来源的 appKey 是字符串(wms_api_app.self_app_key,如
WMSD08A3696BBA9551F261C88BBF7F462BD),INTEGER 列无法承载,
normalizeOrderFromKey 会把字符串归一化成 null,导致 API 渠道订单 from_key 全为空。
改动:
- from_key 列 INTEGER(11) -> VARCHAR(100),迁移覆盖基表与全部分表
(current/history/dispatch/outsourced),整数改字符串需重建表,
迁移在改列后校验并恢复 AUTO_INCREMENT 水位,避免分表 id 区间重叠
- normalizeOrderFromKey 不再按整数归一化,改为去空白 + 截断 100 落库
- DY 平台聚水潭判断改为字符串比较,兼容改造后的存量数据
落库口径:QM 取 wms_qimen_apps.app_key,API 取 wms_api_app.self_app_key,
MANUAL/STOCKOUT 为空。
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
2026-11-04 04:46:38 +08:00 |
|
liufumingren
|
ce3e0185e1
|
fix(order): 推单跨分表单号查重
delivery_order_code 查重由仅查 current 分表扩展为 current/dispatch/history
三表并发查重,命中任一表即拒绝重复建单;dispatch/history 模型获取可能执行
DDL(隐式提交),已移至事务外完成。
|
2026-09-20 18:39:20 +08:00 |
|
liufumingren
|
a3ec20098f
|
fix(stock): getStoreStocks 修复 store_id 过滤失效导致跨货主/跨仓库数据泄漏
- store_id/warehouse_id/软删条件原先放在 LEFT JOIN(required:false) 的 include.where 上,只进 ON 子句无法过滤主表 wms_stock_store,传 store_id 仍返回跨货主商品
- 过滤条件改为直接落在主表 where,count/findAll 同条件,total 恢复准确
- 返回的 store_id 字段补取 warehouse_stock.store_id,并加空列表访问保护
- 订单创建报错"库存记录不存在"补上商品编码 item_code,并区分场景改为"仓库已解绑,请联系仓库关联绑定"
|
2026-09-20 16:01:01 +08:00 |
|
liufumingren
|
dfaaa7f060
|
fix(order): 建单统计列随 INSERT 写入与锁冲突退避重试
- 统计列 items/items_hash/items_crc 均为 wms_order_delivery_* 二级索引列:
先插占位值再 UPDATE 回写会让并发建单在同一索引区间反复「删标记旧条目 + 插入新条目」,
批量推单高并发下必然死锁(生产 2026-09-10 单批 354 个事务因此失败)
→ 新增 buildOrderStats,统计列与主表 INSERT 同一条语句写入;
快递策略命中时只 UPDATE 非索引的快递字段
- 建单顺序调整为先写明细、后写主表(库存预占失败直接回滚,不留悬挂主表行)
- 重试策略:最多 3 次;主键冲突修复水位后重试,新增 isRetryableLockError
(1213/1205/deadlock/lock wait timeout)带抖动退避重试,
失败文案统一为「重试后仍未成功,请稍后重试」
- 同文件一并包含 need_oms_waybill 写入与取号分流(新增 normalizeNeedOmsWaybill、
prepareOrderData 第 7 参、appendNeedOmsWaybillWaitLog 与 asyncProcessOrderCreated 分流),
该字段的模型/迁移/入口见相邻提交
- test: delivery_order.addOrder.test.js 补 allocateOrderId 桩、按新写入顺序断言,
并覆盖 need_oms_waybill 根节点取值/归一化
|
2026-09-13 15:30:54 +08:00 |
|
liufumingren
|
b6ae8313a1
|
fix(order): 自动分配快递排除备注生效并补写跳过日志,储位分配默认禁止存储储位
订单备注命中仓库「自动分配快递排除备注」时跳过自动分配快递,并补写 ORDER_AUTO_EXPRESS_SKIP 操作日志说明原因与命中关键字
储位分配默认排除存储储位(库位类型过滤下沉到 JS 层按货主存拣分离策略逐 SKU 生效),仅当货主关闭存拣分离或前端传入 allow_storage_location=true 时放行;自动分配不再强制 allow_storage_location=true
按当前实现基准修正 order_storage_allocation 过期单测,补充排除备注与存拣分离放行用例(26/26 通过,ESLint 0 错误)
|
2026-09-05 22:42:39 +08:00 |
|
liufumingren
|
66ea0c4c36
|
feat(storeWarehouse): 新增开始自动分配时间 allocate_start_time,支持跨天自动分配窗口,截单时间下限放开到 00:00,开始时间等于截单时间时保存拒绝
|
2026-09-03 17:00:46 +08:00 |
|
liufumingren
|
80c73bb34b
|
feat(order): 订单创建自动分配快递改为队列+定时批量消费,消除取号死锁
- 新增 wms_waybill_allocate_queue 队列表(migration + model),订单创建异步流程仅入队(截单/未审核不入队)
- 新增 consume_waybill_allocate_queue 定时任务:15s/worker/重入保护,按仓库+货主串行批量消费,同关系下同一时刻仅一个取号事务
- express_platform 三处结算事务统一先 FOR UPDATE wms_store_warehouse 再更新 wms_order_express(lockAndDeductWaybillSettlement),消除 AB-BA 死锁
|
2026-08-27 20:11:52 +08:00 |
|
liufumingren
|
a6d67a17fe
|
feat(order): 快递策略漏斗支持外部编码开启时仅匹配纯货主维度策略
|
2026-08-26 17:24:03 +08:00 |
|
liufumingren
|
73d12cdf1a
|
feat(order): 订单新增 oaid_order_source_code 字段落库,取号链路 plattradeno 优先取该字段
|
2026-08-26 15:33:11 +08:00 |
|
liufumingren
|
51f6b27d6a
|
fix(qimen): itemId 非主键时降级按 item_code 查找商品,修复奇门推单误报未同步推送到仓库
|
2026-08-25 13:09:53 +08:00 |
|
liufumingren
|
705678487d
|
fix(returnUnpack): 拆包视频拼接 CDN 域名,商品复核字段透出与缓存失效修复
- returnUnpack: list/detail/videoList/queryByWaybill 输出 videos[].video_url 自动拼接
http://w{warehouseId}-c{recordingComputerId}.o.gztbyc.com{path},与 order.packing 同口径
(录制电脑从 wms_print_computer 按 is_recording=true 获取,无录制电脑时保持原始相对路径)
- recheckOrder: scanOrder/scanTask 报文 stock 明细新增 need_recheck 字段(缺省 Y)
- stock: getStockDetails 双实现透出 need_recheck;saveWarehouseStock/handleBatchChange 更新成功后
显式清除商品详情缓存(bulk update 不触发实例级 afterUpdate hook,修复旧缓存被持续读取)
- delivery_order: 订单创建时间统一取服务器当前时间,不采用报文 createTime,避免被平台上报时间覆盖
- 同步 methods/system.json 文档与 methods/changes/system.json 变更记录
|
2026-08-23 22:13:33 +08:00 |
|
liufumingren
|
f2d1ed0849
|
fix(order): 异步链路显式传递仓库上下文,避免 Qimen 无登录用户静默失败
- pendingOrder/orderStorageAllocation: 优先取显式传入的 warehouse_id,缺失时回退 getWarehouseId
- deliveryOrder: buildExpressAllocateRequest 携带 warehouse_id,并补充自动分配开关判定日志
|
2026-08-22 17:22:46 +08:00 |
|
liufumingren
|
9894e15ccd
|
fix(express-policy): 违禁品策略无法命中——订单创建时聚合商品违禁品类型参与匹配
- addOrderLines 批量查询 StockWarehouse 增加 prohibited_id 字段并聚合去重
- itemsInfo 返回 prohibited_type_ids,matchPolicy 由写死 null 改为传入真实值
- 修复限定违禁品类型的快递策略此前永远被跳过、订单降级默认快递的问题
|
2026-08-21 22:56:01 +08:00 |
|
liufumingren
|
59019e07a6
|
feat(deliveryOrder): 快递解析快照与策略漏斗调整、手动单库存归属校验
- resolveExpressSnapshot 全路径补日志与回退快递名称, 未匹配也写快递回退操作日志
- enable_external_express_code 开启时跳过快递策略漏斗, 保留外部匹配/兜底结果
- 手动单直接传 stock_id 时校验库存归属货主, 跨货主库存拒绝下单
|
2026-08-21 02:20:36 +08:00 |
|
liufumingren
|
3817948b35
|
feat(order): 锁定订单作业门禁与订单列表 lock_status 转 Y/N
- lock_guard: 新增 isLockedOrderStatus,lock_status 非 none 一律视为已锁定
- 储位分配(allocatePicking)跳过锁定订单,skipped_reason=locked
- 快递分配(createWaybillCodePipeline、wave.batchAllocateExpress)跳过锁定订单并返回 skipped_locked_order_ids
- 抓取波次 singleFetchByIds 排除锁定订单并返回 excluded_locked_order_ids
- 自动加团(delivery_order)锁定订单跳过自动分配快递/储位/自动加团
- 订单列表 normalizeOrderListItem 统一 lock_status 输出 Y/N(none→N,其余→Y)
- 同步 methods/system.json、methods/changes/system.json 文档
|
2026-08-18 16:25:12 +08:00 |
|
liufumingren
|
37104079e5
|
feat(order): 订单/明细 id 防回退——序列表唯一发号 + 分表免重建 + 水位自愈 + 迁移任务执行历史
|
2026-08-15 20:12:23 +08:00 |
|
liufumingren
|
358fef0f71
|
chore: apply ESLint auto-fixes, JSDoc additions, and CRLF→LF normalization (no logic changes)
|
2026-08-08 20:28:18 +08:00 |
|
liufumingren
|
0b781a7e70
|
feat: 店铺快递绑定策略模块 + 订单创建链路集成 + 运单号分配优化
【新增模块】
- app/model/store_express_binding_policy.js: 策略数据模型(17字段,JSON数组)
- app/service/systems/store_express_binding_policy.js: CRUD+列表(含名称批量解析)
- app/service/systems/express_policy.js: 缓存优先策略查询 + 6维漏斗匹配引擎
- app/service/systemMethods/store_express_binding_policy.js: method路由层
- database/designs/store-express-binding-policy-design.md: 设计文档
【策略漏斗匹配逻辑】
- 按priority DESC逐条匹配: store_ids→shop_name→prohibited→regions→exclude→weight
- NULL/空数组=不限, 未命中自动continue到下一条
- 地区/店铺匹配使用子串包含(省/市/区/详细地址均生效)
- 违禁品匹配使用数组交集
- 输出快递编码+重量类型, 未命中返回null
【订单创建链路集成】
- addOrder→addOrderLines后触发matchPolicy(weight可用)
- 命中: 写入logistics/sys_logistics 4字段+weight_type+操作日志
- 未命中: 降级到resolveExpressSnapshot默认值+兜底DEFAULT_STORE_SUBJECT_CONFIG(STO)
- 系统快递4字段一致, 自定义映射(express_setting)分流写入
【运单号分配优化】
- pickWaybillExpressInterface两步兜底:
Step1: logistics_code仅匹配express_code(自定义编码精确)
Step2: sys_logistics_code匹配全候选码(系统编码兜底)
- 新增weight_type过滤器(接口NULL=通配, 设限须精确匹配)
- groupedOrder.options新增sys_logistics_code/weight_type传递
【操作码翻译】
- ORDER_EXPRESS_POLICY_MATCH: '策略命中'
- ORDER_EXPRESS_FALLBACK: '快递降级'
- 无策略命中时写入快递降级日志
【API文档】
- methods/system.json: 策略模块4接口+响应字段(express_name/数组类型等)
【数据库迁移】
- 13个migration: 建表→字段迭代→TEXT改JSON→prohibited改数组(dev+prod均执行)
|
2026-08-04 08:18:43 +08:00 |
|
liufumingren
|
da4208707d
|
fix: 修复自动分配快递时 warehouse_id 上下文丢失导致 FK 约束失败及平台解析异常
- express.js: createWaybillCode 优先使用传入的 warehouse_id,修复 setImmediate 后 ctx.user 丢失导致 wms_order_express.warehouse_id 外键约束失败
- delivery_order.js: asyncProcessOrderCreated 中平台/快递解析逻辑修正
- recheckOrder.js: 复核单快递分配状态判断优化
- express_platform.js: 快递平台自动同步回传链路修正
- order_async.js: 奇门异步下单上下文增强
- polo_api_client.js: PolyAPI 客户端微调
|
2026-08-02 22:40:58 +08:00 |
|
liufumingren
|
02b3a5e813
|
fix(order): 订单同步/运单/库位分配防御性修复
- express: 运单查询补充 pay_no/from_key 字段;step 更新增加 status!=cancel 过滤
- order_async: 同步分发前过滤 sync_status=fin 的已完成订单;修复 Op.ne 引用缺失;强制 SELECT FOR UPDATE 重读;多处更新增加 status!=cancel 守卫
- order_storage_allocation: SN/快递分配失败回写增加 status!=cancel 守卫
- methods: allocateExpressCode 文档更新为异步接口说明
|
2026-08-02 00:38:34 +08:00 |
|
liufumingren
|
f747e73aea
|
fix(deliveryOrder): 货主默认配置统一读取合约 policy_config,移除对 wms_store.subject_config 的错误依赖
- prepareOrderData 不再调用 getStoreSubjectConfig(storeId) 读取死数据
- resolveExpressSnapshot: 默认快递编码统一从合约 policy_config 读取
- resolvePlatformSnapshot: 兜底平台编码只走合约 policy_config
- resolveEnableExternalExpressCode: 移除 storeSubjectConfig 死数据兜底
- 仓库级 getStoreSubjectConfig(warehouseId) 保留(有 warehouse setting 更新入口)
|
2026-08-01 15:59:22 +08:00 |
|
liufumingren
|
fbb12cf205
|
fix(deliveryOrder): resolveExpressSnapshot 兜底读取 policy_config.default_express_code
- 修复前只读 store.subject_config.default_express_code,导致 subject_config 为 NULL 时始终命中默认 STO
- 修复后货主 subject_config 优先,未配置时兜底读仓库 policy_config.default_express_code
- 解决广州趣电贸易等 subject_config 为空的货主无法使用仓库级 ZTO 配置的问题
- 新增 resolveExpressSnapshot 单测 14 个用例全覆盖两大分支
|
2026-08-01 13:56:21 +08:00 |
|
liufumingren
|
19c3fe09a7
|
refactor(weight): 重量字段统一为 INTEGER(g),取代 DECIMAL(kg)
- 8 个 model 重量字段类型 DECIMAL→INTEGER,注释 kg→g
- order_express 称重校验改为正整数(g)
- delivery_order 手动单查 StockStore + warehouse 称重毛重
- openapi.json 毛重/净重描述 kg→g
- 迁移: 20260725120000-unify-weight-fields-to-int-g
- 脚本: update-stock-warehouse-weight.cjs
|
2026-07-27 03:46:07 +08:00 |
|
liufumingren
|
16d5f18fa1
|
feat(openapi): interface_type_id=2 强制合约注入 + 全链路 store_id 防护
核心改动:
- openapi.js: 新增 resolveOpenapiContract 强制合约解析(required:true JOIN),
dispatchOpenapiMethod 统一注入上下文(setInfo)
- 5个 openapiMethods: 移除重复 resolveAppInfo, 统一使用 this.getInfo()
- deliveryorder/entryorder/stockout: findByPk(itemId) 后增加 store_id 一致性校验
安全修复:
- 修复 itemId 路径跨货主越权漏洞(FindByPk 无 store_id 过滤)
- deliveryorder/inventory/singleitem 查询补全 store_id 过滤
- 合约缺失返回 403 而非穿透业务层
测试覆盖: 9方法×3层防护(合约/注入/过滤)全部通过集成测试
|
2026-07-15 00:10:40 +08:00 |
|
liufumingren
|
ca5c8a269e
|
feat: 推单二级校验 + 快递分配异步化 + 打印 stock_id 直读
- delivery_order: 新增 auth_status=2 + warehouse_use_status=1 二级签约校验
- express: createWaybillCodePipeline 支持 awaitTasks/onBatchComplete 选项
- pendingOrder: allocateExpressCode 异步进度缓存 + cancelAllocateStorage 拣货完成前置校验
- order_print: 新增 wms_picking.stock_id→wms_stock_warehouse 直读路径,消除 order_items 强依赖
|
2026-07-09 03:36:15 +08:00 |
|
liufumingren
|
76c52fa268
|
use_status 重命名为 warehouse_use_status,新增 store_use_status;仓库/货主侧独立控制签约使用状态,unbind 按身份分派字段
|
2026-07-06 22:12:23 +08:00 |
|
liufumingren
|
70ad3153a1
|
创建订单原货主策略读取字段错误调整
|
2026-07-06 17:16:42 +08:00 |
|
liufumingren
|
7f05b26db2
|
1
|
2026-07-04 21:40:31 +08:00 |
|
liufumingren
|
5ef99e3bed
|
1
|
2026-07-01 14:00:59 +08:00 |
|
liufumingren
|
77435aeb79
|
1
|
2026-06-23 18:48:33 +08:00 |
|
liufumingren
|
d743e67b9d
|
1
|
2026-06-17 01:18:55 +08:00 |
|
liufumingren
|
0b207a1c9c
|
1
|
2026-06-10 09:14:05 +08:00 |
|
liufumingren
|
43c60dd934
|
1
|
2026-06-09 14:12:02 +08:00 |
|
liufumingren
|
c2b5ffc319
|
1
|
2026-06-07 20:42:24 +08:00 |
|
liufumingren
|
eb100b056d
|
1
|
2026-06-07 01:52:06 +08:00 |
|
liufumingren
|
99367e5043
|
1
|
2026-06-06 05:15:46 +08:00 |
|
liufumingren
|
9fca81e7b5
|
1
|
2026-05-19 16:33:58 +08:00 |
|
liufumingren
|
9c2b254206
|
1
Co-authored-by: Copilot <copilot@github.com>
|
2026-05-11 08:44:27 +08:00 |
|
liufumingren
|
d711ba9c21
|
0506更新
Co-authored-by: Copilot <copilot@github.com>
|
2026-05-06 17:53:54 +08:00 |
|
liufumingren
|
9b2cc5fc73
|
fix(receiving): 修复获取收货单时重复定义属性的问题
|
2026-05-06 01:32:55 +08:00 |
|
liufumingren
|
5ce689d771
|
1
Co-authored-by: Copilot <copilot@github.com>
|
2026-04-30 19:20:31 +08:00 |
|
liufumingren
|
b7f980188f
|
1
Co-authored-by: Copilot <copilot@github.com>
|
2026-04-29 17:43:54 +08:00 |
|
liufumingren
|
0ffe290a21
|
chore: commit all current workspace changes
|
2026-04-27 16:09:26 +08:00 |
|
liufumingren
|
622869787a
|
feat: sync workspace changes
|
2026-04-17 19:21:57 +08:00 |
|
liufumingren
|
e73a311076
|
ok
|
2026-04-11 17:09:06 +08:00 |
|
liufumingren
|
3d824a3a1d
|
chore: sync lint and service fixes
|
2026-04-09 01:36:49 +08:00 |
|
|
|
63b4536766
|
chore: initialize wms project
|
2026-03-16 14:01:22 +08:00 |
|