# `call_SP_Inventory_ProductCalcQty` (procedure)

> 成品库存重新刷新


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

_No parameters._

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `call_SP_Inventory_ProductCalcQty`'`._

## Narrative

**Business context:** 成品库存重新刷新 — one-shot data-fix wrapper that re-runs the finished-goods inventory recomputation (`SP_Inventory_ProductCalcQty`) for every existing row in `eleproductstock`. Used during deployment / data-migration when stock-key columns get out of sync with the actual qty cache.

**What it does:** counts `eleproductstock`; opens a cursor over every row, fetching the stock-key tuple (`sCustomerId`, `sProductId`, `sDefineNo`, `sDefineNo2`, `sWarehouseId`, `tCreateDate`, `sLocationId`, `sWarehouseLocationId`, `sBrandsId`, `sSubsidiaryId`); calls `SP_Inventory_ProductCalcQty` with each tuple to rebuild qty for that key. No filter — touches the entire table.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines with a `call call_SP_Inventory_ProductCalcQty` invocation, xly-src grep). Behaviour matches a manual DBA-run repair tool — the regular finished-goods qty maintenance runs `SP_Inventory_ProductCalcQty` directly from `Sp_Calc_sPaj/sPsa/sDgd/...`, this batch loop is for one-off rebuilds.
