Sp_Calc_sAcc.md 2.36 KB

Sp_Calc_sAcc (procedure)

@author:zhucx @date:2021.11.29 @describe: 质量管理-质量事故报告-审核

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN iFlag int
2 IN iTmpCheck int
3 IN sFormGuid varchar(100)
4 IN sGuid varchar(100)
5 IN sLoginId varchar(100)
6 OUT sReturn varchar(5000)
7 IN sBrId varchar(100)
8 IN sSuId varchar(100)
9 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpCalc_sAcc'._

Narrative

Business context: 生产管理 → 生产单据 → 质量事故报告 — quality-incident report check / uncheck on mftqualityaccidentMaster (with slave mftqualityaccidentslave). Approves a manufacturing-quality incident write-up, posts the result into KPI tracking, and feeds the unqualified-product report.

What it does: Validates sGuid and SysLocking (concurrent edit guard). Reads master bInvalid, tCreateDate, sSrctype. Refuses if invalid or if the row's create date falls outside the accounting period (when SysSystemSettings.CkxIntervalMonthModifyBill=0, checks sysaccountperiod.bFrozen). With iFlag=1: refuses if already checked; if SysSystemSettings.CkxDefineCheck=1 and iTmpCheck<>1, runs slave-row replace-field cursor and Sp_System_CheckFlow workflow start; then sets master bCheck=1 and writes a kpidetail row plus an update to qlyunqualifiedreportmaster. Calls Sp_Bill_Used. With iFlag=0: symmetric uncheck.

Invocation: Bound to gdsmodule.sProcName on:

  • 质量事故报告 (sId 101251240115015934849804300) — 生产管理 → 生产单据
  • 设备异常单 (sId 101251240115016045682733390) — 生产管理 → 生产单据 (reuses this proc despite the YC-suffixed variant existing)
  • 01/01 新增质量事故报告 (sId 11811781131121915261093794470) — KPI流程操作菜单 → 质量管理流程

Flag: 设备异常单 (equipment-abnormal) is wired to Sp_Calc_sAcc rather than the dedicated Sp_Calc_sAcc_YC — likely intentional fallback, but the YC variant targets mftqualityaccidenteqp* not mftqualityaccident*, so this module's writes land in the general accident table.