# `Sp_Task_PrintWorkshop2` (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` |
| 10 | OUT | `sUrl` | `varchar(255)` |

## Body

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

## Narrative

**Business context:** 小ai任务自动派送 — scheduled push of the 印刷车间异常汇报 (print-workshop machine-anomaly digest). Member of the `Sp_Task_*` quartz-scheduled message family; pairs with `Sp_Task_PrintWorkshop1` (production angle) and `Sp_Task_PrintWorkshop3` (net-profit reuse).

**What it does:** Defaults `sBrId/sSuId/sCode`, sets `title='印刷车间异常汇报'` and `sUrl` to the YSCJFX BI bigscreen. Spans yesterday-07:30 → today-07:30, inserts into `Tmp_Report` every distinct (`sMachineId`, `sMachineStateName`) seen in `mftproducereportmachinestate` joined to `mftproductionreportslave/master`, and aggregates per state: `iCount` (异常次数) and `dErrorHour` (异常时间小时). Renders one row per machine+status into `Sp_Task_doTestMsg`; `cardTitle` summarises 合计时间 / 异常次数. Resolves recipients from `sftlogininfo` where `sUserName IN ('杨恒林','曹建英')`.

**Invocation:** Dispatched by the Quartz scheduler — `QuartzTask`/`TaskServiceImpl.doProOne()` runs whichever `Sp_Task_*` the scheduler-job config names; in-procedure-computed `sUserList` drives recipients; `sendMsgDoNew(...)` renders via the configured `sMestemplateId`. No `gdsmodule`/form-master binding; not in xly-src 30100101 install scripts — DB-only / introduced via upgrade scripts.
