# `Sp_System_ReProductMoney` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `varchar(10000)` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(4000)` |
| 6 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 成本管理 → 产品存货核算 — un-finalise a 会计期间's product-inventory calc, allowing `Sp_System_ProductMoney` to be re-run. Companion to `Sp_System_ReCostStructure`/`Sp_System_ProductMoney`: clears the `bCalProducts`/`sCalProducts`/`tCalProducts` flags on `sysaccountperiod` so the period drops back to "not yet closed for product inventory".

**What it does:** Parses `$.params[*].value[*].sId` to a list of period ids, refuses if no row matches in `sysaccountperiod` (sBrId/sSuId-scoped). Reads the period's `sPeriodId` and guards: if any *later* period already has `bCalProducts=1` then this earlier period cannot be reopened ("本会计期间之后有会计期间已核算，本会计期间不能重新核算"). For each selected period sets `sysaccountperiod.bCalProducts=Null, sCalProducts=Null, tCalProducts=Null`. The commented-out check on `accproductstore`+`sVoucherBillNo` shows an earlier rule that blocked reopen when 成本凭证 had already been generated — relaxed in the current version.

**Invocation:** No `gdsmodule` binding, no form-master, no other-proc, no xly-src match beyond `script/标版/30100101/cost/Sp_System_ReProductMoney.sql` install script — dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` from the 产品存货核算 period grid's 重新核算 toolbar button (the reverse of the AllSure→ProductMoney chain).
