# `Sp_ProductProcessPack` (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_ProductProcessPack`'`._

## Narrative

**Business context:** 销售管理 / 备货流程 — increments the per-package "已备货" counter on a sales-order line (`salsalesorderslave`), one click per package. Used by warehouse pickers when a sales-order line is packed in trunks/packages and progress is logged package-by-package rather than marked complete in one shot.

**What it does:** Parses `$.params[*].value[*].sSlaveId` from `sProInParam`. Per slave id, if `dReturnTrunkQty + 1 > dTrunkQty` it ignores the click; otherwise it `UPDATE salsalesorderslave SET dReturnTrunkQty = dReturnTrunkQty + 1`, then returns a status string `总共N包,剩余M包` in `sReturn`. After incrementing, if the remaining count reaches 0 it sets `bStockupComplete = 1` to mark the line fully prepared.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — bound to a per-package "+1" toolbar/grid button on the 备货 (stockup) flow of the sales-order grid. Bulk-complete sibling: `Sp_ProductProcessPackAll`. xly-src ships `script/标版/30100101/Sp_ProductProcessPack.sql` (install script).
