From a123009159591f4ea13733861ed1507865a5f1ab Mon Sep 17 00:00:00 2001 From: liufumingren Date: Thu, 8 Oct 2026 16:07:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(stockout):=20=E5=87=BA=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E6=98=8E=E7=BB=86=20item=5Fid=20=E7=BB=9F=E4=B8=80=E8=90=BD=20?= =?UTF-8?q?StockStore=20=E4=B8=BB=E9=94=AE=20id=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=9D=9E=E6=95=B0=E5=AD=97=20itemId=20=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=BB=BA=E5=8D=95=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 奇门 stockout.create 调用方把「编码+名称」拼接串同时放入 itemId/itemCode/itemName, itemCode 降级精确匹配成功并解析出 stock_id 后,item_id 仍落报文原值(非数字), 写入 BIGINT 列触发 MySQL 严格模式 1366 Incorrect integer value 建单失败 - 对齐 entry_order 建单口径:item_id 统一写实际匹配到的 StockStore 主键 id(纯数字) - 验证:test/temp_test_stockout_itemid_normalize.js 5/5 PASS(非数字 itemId 降级匹配 建单成功 + 数字主键回归);生产日志核实:2026-10-08 10:09 奇门请求 app_key=23204092,stock_id 解析正确仅 item_id 落库报错 - 文档同步:methods/qimen.json 0.3.10 -> 0.3.11,stockout.create 补充 item_id 归一化 notes + changes 变更记录 --- app/service/systems/stockout_order.js | 5 ++++- methods/changes/qimen.json | 16 ++++++++++++++++ methods/qimen.json | 11 ++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/service/systems/stockout_order.js b/app/service/systems/stockout_order.js index 9f349da..9d15204 100644 --- a/app/service/systems/stockout_order.js +++ b/app/service/systems/stockout_order.js @@ -209,7 +209,10 @@ class StockoutOrderService extends MainService { orderLineNo: line.orderLineNo, ownerCode: line.ownerCode, itemCode: line.itemCode, - itemId: line.itemId, + // item_id 统一写入实际匹配到的 StockStore 主键 id(纯数字), + // 避免调用方把「编码+名称」等非数字值放进 itemId 时写入 BIGINT 列 + // 触发 MySQL 严格模式报错(与 entry_order 建单口径一致) + itemId: wmsStock.id, itemName: line.itemName, planQty, inventoryType: line.inventoryType, diff --git a/methods/changes/qimen.json b/methods/changes/qimen.json index 57221a2..3831ca9 100644 --- a/methods/changes/qimen.json +++ b/methods/changes/qimen.json @@ -1,4 +1,20 @@ [ + { + "version": "2026.10.08-qimen-stockout-item-id-normalize", + "date": "2026-10-08", + "type": "updated", + "module": "stockout", + "summary": "qimen stockout.create 明细 item_id 落库口径修正:统一写入实际匹配到的 StockStore 数字主键 id,修复调用方把「编码+名称」拼接串放进 itemId(同时 itemCode 可精确匹配)时写入 BIGINT 列触发 MySQL 严格模式 1366(Incorrect integer value for column item_id)导致建单失败的问题;与 entryorder.create 建单口径对齐。", + "methods": [ + "stockout.create" + ], + "notes": [ + "app/service/systems/stockout_order.js#create 校验循环 items.push:itemId 由 line.itemId 改为 wmsStock.id(StockStore 主键,纯数字);itemCode/itemName 仍落报文原值,stockId 仍为 wmsStock.stock_id", + "回传影响:stockout 确认回传(order_async.js buildStockoutConfirmDataInternal)itemId 改为 StockStore 主键 id,符合奇门 itemId=「仓储系统商品ID」语义,与入库单确认回传口径一致", + "生产案例:2026-10-08 10:09 奇门 stockout.create(app_key=23204092)报 Incorrect integer value: LB006小光兔灵感五色眼影盘#01情懒落日 for column item_id,调用方 itemId/itemCode/itemName 三字段均为拼接串,系统按 itemCode 匹配到 StockStore(stock_id=162580)但落库仍用报文原值", + "验证:test/temp_test_stockout_itemid_normalize.js(非数字 itemId + itemCode 降级匹配 → 建单成功且 item_id=StockStore 主键;数字主键回归通过),5/5 PASS" + ] + }, { "version": "2026.09.12-qimen-order-cancel-rk-entry-order-support", "date": "2026-09-12", diff --git a/methods/qimen.json b/methods/qimen.json index ea7ec7e..9420321 100644 --- a/methods/qimen.json +++ b/methods/qimen.json @@ -1,8 +1,8 @@ { "module": "qimen", "description": "奇门接口标准入口,method 对应 qimenMethods 异步方法,全部使用 POST 请求,参数包含 query 与 XML body(request 节点)", - "version": "0.3.10", - "updatedAt": "2026-09-12", + "version": "0.3.11", + "updatedAt": "2026-10-08", "headers": [], "methods": { "groups": [ @@ -1375,7 +1375,12 @@ "description": "出库单号" } ], - "errors": [] + "errors": [], + "notes": [ + "明细行商品匹配二级策略:itemId 主键直查(货主一致)> itemCode 精确匹配(warehouse_id + store_id + app_key 维度)", + "item_id 统一写入实际匹配到的 StockStore 数字主键 id(wms_stock_store.id),避免非数字值(如「编码+名称」拼接串)写入 BIGINT 列触发 MySQL 严格模式报错(Incorrect integer value for column item_id)", + "item_code / item_name / plan_qty / inventory_type 落报文原值,stock_id 落系统解析值" + ] }, { "method": "stockout.query",