# `Sp_System_ProductionCostAllSure` (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_ProductionCostAllSure`'`._

## Narrative

**Business context:** 成本管理 → 成本核算 — batch confirm (批量核算) of every cost line in one or more 会计期间. Forward pair of `Sp_System_ProductionCostAllReSure`. Marks all cost-source rows for the period as `bConfirm=1` so the downstream 工单成本计算 (`Sp_System_ProductionCost`) can consume them.

**What it does:** Parses `$.params[*].value[*].sId` to period ids, refuses if `sysaccountperiod.bCost=1` ("数据已核算不能批量操作"). For each `p_sPeriodId` sets `bConfirm=1, sConfirmMonth=p_sPeriodId` on `accordercostanalysis` (iType 1/2/3/4/5/7 — same six cost subjects as the un-confirm twin: 直接材料, 本期作业汇总, 发外发票, 计件工资, 上期发外暂估抵消, 本期暂估发外入库), `accworkcenter`, `accdepart`, `accproductstore` (for 成品入库 forms `192116810113315228246447250`/`192116810113315235917608210`), and `accproductionmaterialsslave`.

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