# `Sp_Manufacture_SetTime2` (procedure)

> @author:钱豹
							@date:20210530 封存
							@describe: 按当前机台的排单次序,重算开始时间，耗时，结束时间，考虑因素有 单双休，工作时间
							条件为： 已排程 或 已下达 的未撤单记录


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `varchar(10000)` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(1000)` |
| 6 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 生产管理 → 机台作业任务执行 — second-generation variant of `Sp_Manufacture_SetTime` for the same per-machine 排单 recompute. Shares the comment header ("按当前机台的排单次序,重算开始时间..."), differs in how the per-row update is composed: this one drives `Sp_System_ReplaceField` for templatable field updates and also writes `mftworkordermaterials` (material side of the work-order) in addition to `mftproductionplanslave` and `elemachine`.

**What it does:** Same outer JSON-param contract as `Sp_Manufacture_SetTime`, but the inner loop uses `call Sp_System_ReplaceField` to splice dynamic column assignments into `UPDATE mftproductionplanslave` and `UPDATE mftworkordermaterials`, then `update elemachine` for machine state. No direct call to `Sp_CalcPlan_dHour` — duration logic is inlined.

**Invocation:** No caller found in any channel — no gdsmodule hook, no form-master binding, no other-routine `CALL Sp_Manufacture_SetTime2`, and no xly-src reference. Author 钱豹, comment marks it 封存 (frozen). Status: appears orphaned — kept alongside `Sp_Manufacture_SetTime` as an alternative implementation; candidate for maintainer audit before deletion.
