# `Sp_Task_ProductStockKeepLongSmallai` (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_ProductStockKeepLongSmallai`'`._

## Narrative

**Business context:** 小ai保驾护航 — scheduled push of the 产品呆滞库存 (finished-goods stagnant-stock) digest. Member of the `Sp_Task_*` quartz-scheduled message family; pairs with `Sp_Task_StockKeepLongSmallai` (materials side).

**What it does:** Defaults `sBrId/sSuId/sCode`, sets the digest title for 产品呆滞库存超期天数, then aggregates from `eleproductstock A` join `eleproduct B`, left-join `elecustomer d`, left-join the per-product max-storage-date subquery on `pitproductstore` filtered to `sFormId='192116810113315228246447250'`. Keeps rows where `dProductQty > 0` and `TIMESTAMPDIFF(DAY, c.tCreateDate, now()) > 30`. Builds the card-rows into `Sp_Task_doTestMsg` (库存数量/销售单价/积压金额/呆滞天数 by 客户+产品名).

**Invocation:** Dispatched by the Quartz scheduler — `QuartzTask` (xlyFlow) calls `TaskServiceImpl.doProOne()` which executes the procedure named in the scheduler-job config; `sendMsgDoNew(...)` renders via the configured `sMestemplateId`. Install script `script/标版/30100101/Sp_Task_ProductStockKeepLongSmallai.sql`; no `gdsmodule`/form-master binding.
