Sp_Insert_fixedassetsprovision.md 2.07 KB

Sp_Insert_fixedassetsprovision (procedure)

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

Parameters

# Mode Name Type
1 IN sProInParam longtext
2 IN sMakePerson varchar(255)
3 IN sFormId varchar(50)
4 IN sBrId varchar(50)
5 IN sSuId varchar(50)
6 OUT sReturn text
7 OUT sCode int

Body

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

Narrative

Business context: 固定资产 / 折旧计提 — generates the period's 固定资产折旧计提 (fixed-asset depreciation provision) rows by snapshotting equipment masters into elefixedassetsprovision. The target period is derived from the latest 固定资产→凭证 voucher in udfvouchermaster, so it always lines up with the next month after the most-recent depreciation voucher.

What it does: Parses $.params from sProInParam (count is read but currently ignored — the commented-out early-return shows an intended "no rows selected" guard). Reads MAX(tVoucherDate)+1 month from udfvouchermaster WHERE sType='固定资产->凭证' into p_sCostPeriod. DELETE FROM elefixedassetsprovision WHERE sCostPeriod=p_sCostPeriod to keep it idempotent, then INSERT INTO elefixedassetsprovision copying the machine master columns from elemachine / elefixedassets (machine no/name/style/type/property, work-type/calendar, APS rules, all sMReserve*/dMReserve*/iMReserve* reserves), stamped with the new period.

Invocation: Status: appears orphaned at the dispatcher level. The signature matches the GenericProcedureCallServiceImpl.doGenericProcedureCall() button-event contract (sProInParam + sFormId + OUT sReturn/sCode), suggesting it's meant to be wired to a 折旧计提 button on the 固定资产 module, but no form-master/gdsmodule/workflow binding currently references it and no xly-src match exists. Candidate for maintainer audit before relying on it.