# `Sp_ChooseSupply` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sLoginId` | `varchar(100)` | | 2 | IN | `tStartDate` | `datetime` | | 3 | IN | `tEndDate` | `datetime` | | 4 | IN | `sBrId` | `varchar(100)` | | 5 | IN | `sSuId` | `varchar(100)` | | 6 | IN | `bFilter` | `longtext` | | 7 | IN | `sUnTaskFormId` | `varchar(100)` | | 8 | IN | `pageNum` | `int` | | 9 | IN | `pageSize` | `int` | | 10 | OUT | `totalCount` | `int` | | 11 | IN | `countCloumn` | `text` | | 12 | OUT | `countMapJson` | `longtext` | | 13 | IN | `sFilterOrderBy` | `text` | | 14 | IN | `sGroupby_select_sql` | `text` | | 15 | IN | `sGroupby_group_sql` | `text` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_ChooseSupply`'`._ ## Narrative **Business context:** 选择供应商 (supplier picker) paged data source — enumerates the suppliers that have transacted in a given date window across `purpurchaseordermaster` (采购订单) and `opsoutsideprocessmaster` (外购/发外), then joins `elesupply` to surface name/no/type. Designed as the data provider for a 选择供应商 popup. The header comment notes "没有根据[系统设置]-- >[未对账印件清单来源]中的设置取相关单据" so the source-table set is hard-coded here rather than driven by `SysSystemSettings`. **What it does:** Defaults `tStartDate`/`tEndDate` to the current month if blank (`tEndDate` is exclusive — `+1 day` then `+1 month`). Parses `bFilter` (JSON → SQL via `Fun_bFilter_toWhere`). Creates temp table `TmpChooseSupply`. Inserts distinct `sSupplyId` from `purpurchaseordermaster` filtered by `tCreateDate` window + brand/subsidiary + filter; repeats the insert from `opsoutsideprocessmaster`. Joins `elesupply` to fill `sSupplyName`/`sSupplyNo`/`sSupplyType`. Finally selects the distinct page (`SELECT DISTINCT sId,sSlaveId,sSupplyId,sSupplyNo,sSupplyName,sSupplyType FROM TmpChooseSupply`). Note: the `pageNum`/`pageSize` parameters are accepted but the live `SELECT` does not apply `LIMIT` — `pageSize` is locally overridden to 500 and `p_sLimit` is built only for the temp-table insert, so the final result is capped at ~1000 rows regardless of the requested page. **Invocation:** Status: appears orphaned. No `gdsmodule.sProcName`/`sSaveProName` hook on `选择供应商` (sId `192116810113315232543913910`), no `gdsconfigformmaster` binding (the matching form-master uses a plain `select sId as sSlaveId,#sRelationAll# from elesupply`), no other-routine caller, no xly-src reference. The proc's signature matches the paged-report pattern (`pageNum`/`pageSize`/`totalCount`/`countMapJson`/`bFilter`) used by `Sp_Outstanding_Query` and friends, suggesting it is the data source for a custom 选择 popup that is wired in Java rather than via the standard form-master. Candidate for maintainer audit.