# `FUN_GET_DATE_UKT_ADD` (function)

> 根据传入时间获取时间


- **Type:** FUNCTION
- **Returns:** `varchar(255)`
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_tCStartTime` | `varchar(200)` |
| 2 | IN | `p_sStartDate` | `varchar(200)` |
| 3 | IN | `p_sEndDate` | `varchar(200)` |
| 4 | IN | `p_tAddTime` | `varchar(200)` |
| 5 | IN | `p_addMinut` | `int` |

## Body

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

## Narrative

**Business context:** 生产排程 → 生产计划管理 → 生产管理 — duration-stretching variant used by the workcenter-scheduling engine. Called when a job's *task duration* straddles the start boundary of a within-day rest window: if work starts at or before the rest window begins but is scheduled to end after the window opens, push the projected end time forward by `p_addMinut` minutes (the length of that rest period) so the elapsed work time still equals the planned duration.

**What it does:** with `p_tCStartTime` (task start) and `p_tAddTime` (current projected end), tests `start ≤ restWindowStart < end`; if true, adds `p_addMinut` minutes to the end time and returns it. Otherwise returns end time unchanged.

**Invocation:** called from `Sp_Manufacture_SetTime`, `Sp_Manufacture_SetTime_Employ`, `Sp_Manufacture_SetTime_process`, and `FUN_GET_CALCPLAN_DATE_END`. Day-shift loop chains the call across each defined rest window (`p_sWxStartDate`/`p_sWfStartDate`/`p_sWyStartDate`/`p_sYxStartDate`/`p_sYfStartDate`/`p_sYyStartDate` etc.). Reached via `BtnCalculationService` "计算排程时间" button.
