# `Sp_ImportSubjectAssociate_WareHouse` (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 | `sFormGuid` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(1000)` |
| 7 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 系统初始化 / 科目-辅助核算关联导入 — bulk-seeds the 仓库 (warehouse) auxiliary-accounting (辅助核算) association rows for accounting subject `sFormId='8'` into `sissubject`. Run once after warehouses are set up so the GL can post by warehouse dimension.

**What it does:** Reads the current max `iOrder` from `sissubject WHERE sFormId='8'` for the (`sBrId`,`sSuId`) tenant, then `INSERT INTO sissubject` one row per `SisWareHouse` that isn't already associated (`NOT EXISTS sissubject.sSrcId=E.sId`), filling `sSrcId=warehouse.sId`, incrementing `iOrder` via a SQL session variable. Idempotent.

**Invocation:** Status: appears orphaned. Not bound to any form-master, `gdsmodule` save/proc hook, `gdsmoduleflow` workflow, or other DB routine. xly-src ships only the install scripts (`script/标版/upgrade/20211115生成凭证/Sp_ImportSubjectAssociate_WareHouse.sql` and `script/标版/30100101/Sp_ImportSubjectAssociate_WareHouse.sql`) — no Java caller found. Candidate for maintainer audit; likely intended as a manual DBA seed step alongside the rest of the `Sp_ImportSubjectAssociate_*` family.
