Sp_Check_sYstz (procedure)
预支调整保存之前数据校验
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sTableName |
varchar(100) |
| 2 | IN | sGuid |
varchar(100) |
| 3 | IN | sFormGuid |
varchar(100) |
| 4 | IN | sLoginId |
varchar(100) |
| 5 | IN | sBrId |
varchar(100) |
| 6 | IN | sSuId |
varchar(100) |
| 7 | IN | iFlag |
int |
| 8 | OUT | sCode |
int |
| 9 | OUT | sReturn |
varchar(4000) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpCheck_sYstz'._
Narrative
Business context: 预算调整 (budget adjustment) post-save validator on budgetAdjustmentCheckMaster/budgetadjustmentcheckslave. Enforces three budget-arithmetic rules: (1) the 调整前细项 ("from" line item) must have enough year-to-date remaining budget in the matching departmentalBudgetMaster to cover the adjustment amount for the current month; (2) the 调整前细项 must actually exist in the approved departmentalBudgetslave for that dept/year; (3) the 调整后细项 ("to" line item) for a 新增 adjustment must NOT already exist in the approved budget (avoid duplicate line creation).
What it does: Reads NetMoney/NetPrice, then resolves sYear/sMonth/sMasterDepartId from the current budgetAdjustmentCheckMaster. Joins each slave row to departmentalBudgetslave (filtered by approved master bCheck=1, matching dept and year) and computes the running 累计预算 through the current month minus dSumUseMoney; rows where this remainder is less than A.dMaterialsMoney are concatenated into p_sBeforeExpenseDetail and reported with sAgainSelectDetail ("所剩余额不足本单据调整金额"). For iAdjustmentType=1 (新增-type adjustments), checks both that the 调整前 detail exists in the approved budget (sBeforeExpenseDetail not found → sAgainSelectDetail) and that the 调整后 detail is NOT already there. Each branch aborts with sCode=-1 if its check fails.
Invocation: Status: appears orphaned. No gdsmodule.sSaveProName/sSaveProNameBefore hook in the current DB snapshot, no form-master binding, no other-routine caller, no xly-src reference. As with Sp_Check_sYstb and Sp_Check_sYzfy, the 预算 (budget) module family is staged but not wired into the live UI — the only 预算 module in gdsmodule is the disabled 年度费用预算KPI设定(暂不开放). Candidate for maintainer audit.