Sp_SampleStatistics (procedure)
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sCustomerGuid |
varchar(100) |
| 2 | IN | sProductGuid |
varchar(100) |
| 3 | IN | tStartDate |
datetime |
| 4 | IN | tEndDate |
datetime |
| 5 | IN | sLoginId |
varchar(100) |
| 6 | IN | sBrId |
varchar(100) |
| 7 | IN | sSuId |
varchar(100) |
| 8 | IN | bFilter |
longtext |
| 9 | IN | pageNum |
int |
| 10 | IN | pageSize |
int |
| 11 | OUT | totalCount |
int |
| 12 | IN | countCloumn |
varchar(5000) |
| 13 | OUT | countMapJson |
longtext |
| 14 | IN | sFilterOrderBy |
varchar(5000) |
| 15 | IN | sGroupby_select_sql |
varchar(5000) |
| 16 | IN | sGroupby_group_sql |
varchar(5000) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpSampleStatistics'._
Narrative
Business context: 销售管理 → 打样统计表 — paged sample-to-order conversion report. For every product on the customer's catalogue (EleProduct), counts how many 打样订单 the customer placed (iSampleCount) versus how many real 销售订单 followed (iOrderCount) in a date window, and computes the conversion dPercentageQty = iOrderCount / iSampleCount * 100. Used by sales to see which proofs converted and which were dead samples.
What it does: Stages Tmp_EleProduct from EleProduct filtered by sCustomerGuid / sProductGuid. For each row, counts checked rows in Viw_SalSalesOrder whose sFormId is one of three 打样订单 form ids (101251240115015876853553040, 101251240115015891763306420, 101251240115015923011260880) into iSampleCount, and one of three 销售订单 form ids (11811781131121915179702987440, 101251240115015878710737470, 101251240115015923020662710) into iOrderCount, optionally between tStartDate / tEndDate. Computes the percentage, joins elecustomer for sCustomerNo / sCustomerName, then hands the final Select ... From Tmp_EleProduct A where iSampleCount > 0 to Sp_Outstanding_Query for paging.
Invocation: Bound as the data-source of the 打样统计表 form gfm.sId=15936608930005133957219822193000 (parent module 101251240115015878880530950) via gdsconfigformmaster.sTbName='Sp_SampleStatistics', sType='proc' — see the install script in script/标版/20210323/gdsconfigformmaster.sql and script/标版/30100101/Sp_SampleStatistics.sql (with an optimised variant under script/标版/optimize/).