Sp_unifiedPlanning_BtnCalculation (procedure)
@author:钱豹 @date:20210711 封存 @describe: 主生产计划界面,确认计划 调用本过程,主要功能: 1、收回特定条件(如故障 返回重排) 的机台任务 2、计算每个机台的任务开始时间,负荷, 3、按机器中的排程规格,更新每个机台的IORDER 4、按工艺路线,更改机台的开始时间,推算交期
- 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 PROCEDURESpunifiedPlanning_BtnCalculation'._
Narrative
Business context: 生产管理 → 生产排程 / 主生产计划 — 统一规划(机台) recompute. Author 钱豹's header documents the four-step pipeline run when a planner clicks 确认计划 on the 主生产计划 screen: (1) reclaim machine tasks flagged for rescheduling (e.g. failures, return-for-rework), (2) recompute every machine's task-start time and load, (3) re-sequence iOrder per machine according to its scheduling rule, (4) walk the routing to update successor-process start times and back-derive 交期.
What it does: Parses $.params[*].value[*] from sProInParam to get the target machine, sCurrStatus, and tCStartTime. Iterates the active mftproductionplanslave rows (sState in 1,2, bFrozen=0) for that machine, calls Sp_GetMachineByApsRule per slave to fit the APS rule, then inserts a marker row into mftproductionplancalc. The companion 工艺路线 walk is delegated to Sp_unifiedPlanning_BtnCalculation_workorder, which fans out to Sp_unifiedPlanning_BtnCalculation_workorder_calc per work-order.
Invocation: Two entry points — both Java-side. (1) GenericProcedureCallServiceImpl.doGenericProcedureCall() short-circuits the generic CALL when sProName='Sp_unifiedPlanning_BtnCalculation' and sCurrStatus IN (2,3), instead calling BtnCalculationServiceImpl.doSp_unifiedPlanning_BtnCalculation(sMachineId, sBrandsId, sSubsidiaryId, iOrder, sMakePerson, tCStartTime, sLanguage) — the per-machine APS path that uses MyBatis cursors and a parallel ExecutorService. (2) Same service's overload (sProInParam, sMakePerson, sBrId, sSuId) {CALL Sp_unifiedPlanning_BtnCalculation(...)} invokes this proc directly. xly-src ships script/标版/30100101/schedule/Sp_unifiedPlanning_BtnCalculation.sql.