Sp_PurchasePriceChart.md 1.76 KB

Sp_PurchasePriceChart (procedure)

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN tStartDate datetime
2 IN tEndDate datetime
3 IN sLoginId varchar(100)
4 IN sBrId varchar(100)
5 IN sSuId varchar(100)
6 OUT sReturn varchar(1000)
7 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpPurchasePriceChart'._

Narrative

Business context: 采购管理 → 采购分析 — paper-material price trend chart procedure. Same intent as Sp_PurchasePriceChar but written before the JSON envelope was wired up: builds the wide pivot table DT for chart consumption without returning JSON in sReturn.

What it does: Builds temp T from viw_purpurchaseorder joined to elematerials/sismaterialsclassify filtered to bCheck=1 AND sMaterialsType='paper' in the date window. Then opens a cursor over DT — but DT is never populated from T (the CREATE TEMPORARY TABLE DT Select Distinct … line present in the sibling Sp_PurchasePriceChar is missing here), so the cursor reads from an undeclared/empty DT. The nested loop dynamically ALTERs DT with per-date columns t MMDD and writes per-material prices, but with no rows the work is wasted. sReturn is left empty.

Invocation: Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines, xly-src grep across all extensions) — candidate for maintainer audit. The missing DT population makes this look like a broken/half-rewritten alternative to Sp_PurchasePriceChar; flag for deletion or repair.