# `Sp_Task_StockKeepLongSmallai` (procedure) > 小ai保驾护航-材料存货核算分析报告 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | OUT | `cardTitle` | `varchar(255)` | | 2 | OUT | `title` | `varchar(255)` | | 3 | OUT | `sAbstract` | `varchar(255)` | | 4 | OUT | `cardDate` | `varchar(255)` | | 5 | OUT | `itemMemo` | `varchar(255)` | | 6 | OUT | `sCode` | `int` | | 7 | OUT | `sReturn` | `longtext` | | 8 | OUT | `sUserList` | `longtext` | | 9 | OUT | `sUserData` | `longtext` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Task_StockKeepLongSmallai`'`._ ## Narrative **Business context:** 小ai保驾护航 — scheduled push of the 材料呆滞库存 (raw-materials stagnant-stock) digest. Member of the `Sp_Task_*` quartz-scheduled message family; pairs with `Sp_Task_ProductStockKeepLongSmallai` (finished-goods side). **What it does:** Defaults `sBrId/sSuId/sCode`, sets the materials-aging title, aggregates from `elematerialsstock A` join `elematerials B`, left-join the per-material max-storage-date subquery on `mitmaterialsstore` filtered to `sFormId='192116810113315220315711060'` (joining on `sMaterialsId, sMaterialsStyle, sDefineNo, sDefineNo2, sWarehouseId, sLocationId, sWarehouseLocationId`). Keeps rows where `dMaterialsMoney > 0`, builds the card-rows into `Sp_Task_doTestMsg` (库存金额/库存数量/计价数量/全月加权单价/呆滞天数) ordered by `dMaterialsMoney DESC`. **Invocation:** Dispatched by the Quartz scheduler — `QuartzTask`/`TaskServiceImpl.doProOne()` runs the procedure named in the scheduler-job config; `sendMsgDoNew(...)` renders via the configured `sMestemplateId`. Install script `script/标版/30100101/Sp_Task_StockKeepLongSmallai.sql`; no `gdsmodule`/form-master binding.