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

## Body

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

## Narrative

**Business context:** 销售管理 / 备货流程 — promotes the stockup state on a 印刷工单 (`mftworkordermaster`) to "已备货" and back-writes the same flag onto every sales-order line (`SalSalesOrderSlave`) that drove the work-order's slave rows. Used when packaging the printed product against a work-order rather than directly against a sales-order line.

**What it does:** Parses `$.params[*].value[*].sSlaveId` from `sProInParam` (each value here is a work-order master sId). Per id: `UPDATE mftworkordermaster SET sStockup = '1'`, then `UPDATE SalSalesOrderSlave A SET bStockupComplete = 1 WHERE EXISTS (SELECT 1 FROM MftWorkOrderSlave B WHERE B.sSrcSlaveId = A.sId AND B.sParentId = p_sId)` — so every sales-order line that this work-order consumed is flipped to "备货完成" in one shot.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — bound to a "备货完成" toolbar button on the 印刷工单 备货 grid. Install script ships at `script/标版/30100101/Sp_ProductProcessWorkOrder.sql`.
