# `Sp_System_ProductionCostAllReSure` (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_ProductionCostAllReSure`'`._

## Narrative

**Business context:** 成本管理 → 成本核算 — batch un-confirm (反核算) of every cost line in one or more 会计期间 (`sysaccountperiod`). Inverse of `Sp_System_ProductionCostAllSure`. Used to unwind a 本期作业汇总 / 直接材料 / 发外发票 / 计件工资 cost confirmation across the whole period in a single click.

**What it does:** Parses `$.params[*].value[*].sId` from `sProInParam` to a list of period ids, refuses if any selected period already has `sysaccountperiod.bCost=1` ("数据已核算不能批量操作"). For each `p_sPeriodId` clears `bConfirm` and `sConfirmMonth` on every cost-source row: `accordercostanalysis` (iType=1 直接材料, 2 本期作业汇总, 3 发外发票, 4 计件工资, 5 上期发外暂估抵消, 7 本期暂估发外入库 for the 成品入库 forms `192116810113315228246447250`/`192116810113315235917608210`/`192116810113315234275562360`), `accworkcenter` (工作中心数据), `accdepart` (部门数据), `accproductstore` (成品入库), and `accproductionmaterialsslave` (非工单领用确认).

**Invocation:** No `gdsmodule` binding, no form-master, no other-proc, no xly-src match beyond the install script `script/标版/30100101/cost/Sp_System_ProductionCostAllReSure.sql` — dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` from the 成本核算 period grid's 批量反确认 toolbar button. Forward pair: `Sp_System_ProductionCostAllSure`.
