# `Sp_ProductionOrder_PrepareMaterials` (procedure)

> @author:zhucx 
		     @date: 
				 @describe:


- **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(1000)` |
| 6 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 生产管理 → 订单生产流程 → 销售订单->生产工单 — 备料 ("prepare materials") toolbar action. Marks selected sales-order slave rows as already material-prepared so picking/issuing flows can skip the upstream readiness check.

**What it does:** Walks `$.params[*].value[*].sSlaveId`. For each `salsalesorderslave.sId`, `UPDATE salsalesorderslave SET bPrepareMaterials=1 WHERE sId=p_sId AND sBrandsId=sBrId AND sSubsidiaryId=sSuId`. Single-flag write — no validation, no inverse handler in this proc, no back-write to BOM/stock.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — 备料 toolbar button on 销售订单->生产工单. xly-src ships `script/标版/30100101/schedule/Sp_ProductionOrder_PrepareMaterials.sql` (install script only; no Java caller).
