Sp_System_ReplaceFieldNew (procedure)
公式语言转换成sql
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sAllGuid |
longtext |
| 2 | IN | sAllTbName |
longtext |
| 3 | IN | sAllType |
longtext |
| 4 | IN | sFormulaGuid |
varchar(100) |
| 5 | OUT | sReturn |
longtext |
| 6 | IN | sTmpValue |
varchar(100) |
| 7 | OUT | sDetail |
text |
| 8 | IN | sLoginId |
varchar(100) |
| 9 | IN | sBrId |
varchar(100) |
| 10 | IN | sSuId |
varchar(100) |
| 11 | IN | sCode |
int |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpSystem_ReplaceFieldNew'._
Narrative
Business context: 生产管理 / 计价 → 公式解析 — formula-language → SQL transpiler (label "公式语言转换成sql"). ReplaceFieldNew (no underscore) is the 20220111公式解析实际详情 upgrade variant of Sp_System_ReplaceField: same signature, refactored body that wraps the lookup in a labelled top: block so the upper layer can LEAVE top cleanly on parameter errors. Note the sCode parameter is IN here (vs OUT on the original) — a signature bug that may explain its limited adoption.
What it does: Same algorithm as Sp_System_ReplaceField: reads SysSystemSettings (CbxLanguage, CbxMaterialsUnit, CbxMachineUnit, NetConversionRate, CkxMinColorCalculation) into a JSON env, loads gdsformconst constants in the active language, then expands the formula in eleformula keyed by sFormulaGuid against the (sAllGuid, sAllTbName, sAllType) triple. Builds dynamic SQL by substituting #{tag.col} tokens, runs via PREPARE/EXECUTE, returns the numeric result in sReturn and trace in sDetail.
Invocation: Status: appears orphaned. No gdsmodule binding, no form-master, no other-proc match, no xly-src caller beyond script/标版/upgrade/20220111公式解析实际详情/Sp_System_ReplaceFieldNew.sql install script. Likely a 2022-Q1 refactor draft that was superseded by Sp_System_ReplaceField_NEW (with underscore, from 20220321) and never wired into a live caller. Candidate for cleanup.