# `Sp_ImportSubjectAssociate_materialsclassify` (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_ImportSubjectAssociate_materialsclassify`'`._

## Narrative

**Business context:** 财务 → 凭证 → 辅助核算 (sissubject) seeding — 材料分类 (`sismaterialsclassify`) variant of the `Sp_ImportSubjectAssociate_*` family. `sFormId='5'` is the subject-type code for material-classify within `sissubject`.

**What it does:** Reads `MAX(iOrder)` for `sFormId='5'`, then INSERTs into `sissubject` (`sId=newId()`, `sSrcId=E.sId`, `sFormId='5'`, incremented `iOrder`) for every `sismaterialsclassify` row whose `sId` is not already a `sissubject.sSrcId`. Idempotent.

**Invocation:** Status: appears orphaned in production runtime. Defined in `xly-src/script/标版/upgrade/20211115生成凭证/Sp_ImportSubjectAssociate_materialsclassify.sql` (one-shot 凭证生成 DBA seeding bundle, run during tenant provisioning). No form/button/gdsmodule hook references it. See `Sp_ImportSubjectAssociate_Customer` for the family mapping.
