Fun_getPlanDate (function)
- Type: FUNCTION
-
Returns:
longtext - Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sJson |
longtext |
| 2 | IN | sTableAlias |
varchar(255) |
| 3 | IN | p_sOffWork |
varchar(255) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTIONFungetPlanDate'._
Narrative
Business context: Plan-date filter compiler — translates a date-range filter JSON (with bFilterCondition ∈ month/week/weekpre/day/daybefore/tomorrowbefore/aftertomorrowbefore/between) into an AND <field> BETWEEN ... AND ... SQL fragment, anchored at the supplied p_sOffWork clock-off time and prefixed with the table alias. Lets the production-plan tree query reuse the front-end's relative-date filter widgets.
What it does: Parses bFilterName / bFilterCondition / bFilterValue from the JSON, prepends sTableAlias. to the field, then branches on bFilterCondition to assemble the BETWEEN/< clause against CURDATE() / NOW() / LAST_DAY / WEEKDAY offsets; for between, splits bFilterValue on , into the two endpoints.
Invocation: Called by sp_manufacture_productionplaninfotrace / *trace1, Sp_Manufacture_ProductionPlanInfoTree_Base, Sp_Manufacture_ProductionPlanInfoTree_Base_TC — the production-plan tree-loading procedures. Used together with Fun_getOneByKey / Fun_HasJsonKey / Fun_RemoveJsonKey to rebuild the WHERE clause from the front-end filter payload.