# `Sp_interface_udfvoucher_before` (procedure)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProData` | `longtext` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sCode` | `int` |
| 6 | OUT | `sReturn` | `longtext` |
| 7 | OUT | `sHeader` | `longtext` |
| 8 | OUT | `sParam` | `longtext` |
| 9 | OUT | `sHttpUrl` | `longtext` |

## Body

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

## Narrative

**Business context:** Kingdee K3 Cloud integration before-hook for **save-voucher** push. Mirrors a local 财务凭证 (`udfvouchermaster`/`udfvoucherslave`) over to the remote K3 Cloud `DynamicFormService.Save` REST endpoint by assembling the request URL, headers, and JSON payload from the inbound `sProData` JSON (which carries the local row to push).

**What it does:** Defaults the OUTs and sets `sHttpUrl` to `https://192.168.1.232/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc` (customer-specific host). Parses `sProData` to extract `FBillNo`, `tCheckDate`, `tCreateDate`, `tVoucherDate`, `sVoucherType`, plus the entry list (`FEntity`). Composes the K3 `formid=GL_VOUCHER` payload (assembled later in the Java side via `sendMap3.put("formid","GL_VOUCHER")` and the parsed `sParam` map). Returns the JSON body in OUT `sParam`. Errors out with `sCode=-1` if `sProData` is empty or invalid JSON.

**Invocation:** Called by `JdInterfaceServiceImpl.JDUDFVOUCHER()` (xly-src `xlyInterface/src/main/java/com/xly/service/impl/JdInterfaceServiceImpl.java`) — declared as instance field `Sp_interface_udfvoucher_before` and invoked via `procedureService.getCallPro()` just before the `HttpsRequestUtil.doRequestHttpResponseCookies()` POST that pushes the voucher. The login cookies harvested by `Sp_interface_login_before` ride along with the request.
