Fun_GetAddBillNo (function)
获取新增的单据号
- Type: FUNCTION
-
Returns:
varchar(100) - Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | p_sBillNo |
varchar(50) |
| 2 | IN | p_num |
int |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTIONFunGetAddBillNo'._
Narrative
Business context: Bill-number arithmetic — 获取新增的单据号. Takes a bill number with a numeric tail (e.g. SO-2024-0001) and produces the same prefix with the trailing counter incremented by p_num, preserving the original zero-padding width.
What it does: splits the input by reusing Fun_GetGb (alpha-only prefix) and Fun_GetNum (digits-only tail). Casts the digits to int, adds p_num, then re-prefixes with the original prefix and re-pads with leading zeros so the total length matches the input. Returns the new bill number.
Invocation: Status: appears orphaned. No caller found in any channel (form-master sSqlStr, gdsmodule hooks, other routines, exhaustive xly-src grep, dynamic-dispatch search) — candidate for maintainer audit. Bill-number assignment in production flows through SysBillNoSettings / Fun_GetBillNo, not this helper.